﻿.npbnb-card {
    border-radius: 0.75rem;
    box-shadow: var(--bs-box-shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1rem;
    background-color: var(--bs-body-bg);
}

.property-card {
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--bs-card-bg);
}

.property-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

/* ==================== Layout ==================== */
.properties-section {
    overflow-y: auto;
    max-height: calc(100vh - 60px);
}

.map-section {
    position: relative;
    height: calc(100vh - 60px);
}

.map-container {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    background-color: hsl(210, 30%, 95%);
}

/* ==================== Grid Flex Layout ==================== */
#npbnb-property-grid {
    border: none;
    background: transparent;
    width: 100%;
}

/* Convert table to flex container */
#npbnb-property-grid table {
    display: flex;
    flex-direction: column;
    width: 100%;
}

#npbnb-property-grid tbody {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    width: 100%;
}

/* Transparent rows: the cards carry their own surface */
#npbnb-property-grid tbody tr,
#npbnb-property-grid tbody tr:hover {
    display: flex;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    flex: 0 0 calc((100% - 48px) / 3);
    max-width: calc((100% - 48px) / 3);
}

#npbnb-property-grid tbody td {
    border: none !important;
    padding: 0 !important;
    display: block;
    width: 100%;
    background: transparent !important;
    /* Same fix as tenant/browse.css: keep td overflow visible so hovered
       cards' lifted borders + edge shadow are not clipped. */
    overflow: visible !important;
}

/* ==================== Property Card ==================== */
.rental-card {
    background: var(--bs-card-bg) !important;
    background-color: var(--bs-card-bg) !important;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 12px 0 hsla(0, 0%, 0%, 0.06);
    border: 2px solid transparent;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.rental-card:hover {
    box-shadow: 0 4px 20px 0 hsla(0, 0%, 0%, 0.12);
    border-color: var(--bs-border-color);
}

/* ==================== Property Image ==================== */
.rental-card-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--rq-surface-sunken);
    flex-shrink: 0;
    border-radius: 10px 10px 0 0;
}

.rental-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rental-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--rq-surface-sunken) 0%, var(--rq-border-med) 100%);
}

.rental-image-placeholder i {
    font-size: 3rem;
    color: var(--rq-sub);
}

/* ==================== Badges & Buttons ==================== */

/* Favorite Button - Default State */
.favorite-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 3;
    padding: 0;
    /* Perfect centering fixes */
    line-height: 1;
    vertical-align: middle;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

.favorite-btn i {
    font-size: 1rem;
    color: var(--rq-text);
    transition: color 0.2s ease;
    /* Perfect icon centering */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* Favorite Button - Favorited State */
.favorite-btn.favorited {
    background: rgba(255, 255, 255, 0.95);
}

.favorite-btn.favorited i {
    color: var(--rq-favorite) !important;
}

.favorite-btn.favorited:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Click feedback */
.favorite-btn:active {
    transform: scale(0.95);
}

/* Legacy - keep for backwards compatibility */
.favorite-btn.active {
    background: rgba(255, 255, 255, 0.95);
}

.favorite-btn.active i {
    color: var(--rq-favorite);
}

/* Photo Count Badge */
.photo-count-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--rq-on-inverse);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.photo-count-badge i {
    font-size: 0.8125rem;
}

/* Superhost Badge */
.superhost-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--rq-surface);
    color: var(--rq-text);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.6875rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

/* ==================== Card Content ==================== */

/* Card Body */
.rental-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--rq-surface);
    border-radius: 0 0 10px 10px;
}

/* Title */
.rental-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--rq-text);
    margin: 0;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Rating */
.rating-display {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.rating-display i {
    font-size: 0.8125rem;
    color: var(--rq-text);
}

.rating-display span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rq-text);
}

/* Location */
.rental-location {
    font-size: 0.8125rem;
    color: var(--rq-sub);
    margin: 2px 0;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Features */
.rental-features {
    font-size: 0.8125rem;
    color: var(--rq-sub);
    margin: 2px 0;
    line-height: 1.25;
}

/* Availability */
.rental-availability {
    font-size: 0.8125rem;
    color: var(--rq-sub);
    margin: 2px 0;
    line-height: 1.25;
}

/* Price */
.rental-price {
    margin: 0;
    line-height: 1.25;
}

.price-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--rq-text);
}

.price-label {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--rq-sub);
}

/* ==================== Card Actions ==================== */

/* Action buttons container */
.card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Secondary action buttons (map, info) */
.btn-action {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    border: 1px solid var(--rq-border);
    background: var(--rq-page);
    color: var(--rq-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-action:hover {
    background: var(--rq-muted);
    border-color: var(--rq-accent);
    color: var(--rq-accent);
}

.btn-action i {
    font-size: 1.125rem;
}

/* Primary action button (Book Now) */
.btn-primary-action {
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: none;
    background: var(--rq-accent);
    color: var(--rq-on-accent);
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary-action:hover {
    background: var(--rq-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(93, 135, 255, 0.3);
}

.btn-primary-action:active {
    transform: translateY(0);
}

.btn-primary-action i {
    font-size: 1rem;
}

/* Border top for actions section */
.rental-card-body .border-top {
    border-top: 1px solid var(--rq-border) !important;
    margin-top: 8px;
    padding-top: 8px;
}

/* ==================== Map Controls ==================== */
.map-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--rq-surface);
    border: 1px solid var(--rq-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--rq-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: background 0.2s ease;
}

.map-control-btn:hover {
    background: var(--rq-muted);
}

/* ==================== Dark mode overrides ==================== */
/* Shadows use rgba so can't use CSS variables — override explicitly.
   Also fix backgrounds: --bs-card-bg is not defined by the Modernize
   theme in dark mode, so var(--rq-surface) always falls back
   to #fff. We override every usage explicitly. */
[data-bs-theme="dark"] .rental-card {
    background: var(--rq-muted) !important;
    background-color: var(--rq-muted) !important;
    box-shadow: 0 0 0 1px var(--bs-border-color);
}
[data-bs-theme="dark"] .rental-card:hover {
    box-shadow: 0 0 0 1px var(--bs-border-color), 0 4px 20px rgba(0,0,0,0.4);
    border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .rental-card-body {
    background: var(--rq-muted);
}
[data-bs-theme="dark"] .superhost-badge {
    background: var(--rq-muted);
}
[data-bs-theme="dark"] .map-control-btn {
    background: var(--rq-muted);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-bs-theme="dark"] .rental-image-placeholder {
    background: linear-gradient(135deg, var(--rq-surface-sunken) 0%, var(--rq-muted) 100%);
}

/* ==================== Responsive Design ==================== */

/* Extra Large screens (1400px+) - 3 columns */
@media (min-width: 1400px) {
    #npbnb-property-grid tbody tr {
        flex: 0 0 calc((100% - 48px) / 3);
        max-width: calc((100% - 48px) / 3);
    }
}

/* Large screens (1200px - 1399px) - 2 columns */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    #npbnb-property-grid tbody tr {
        flex: 0 0 calc((100% - 24px) / 2);
        max-width: calc((100% - 24px) / 2);
    }
}

/* Medium to Large screens (992px - 1199px) - 2 columns */
@media (min-width: 992px) and (max-width: 1199.98px) {
    #npbnb-property-grid tbody tr {
        flex: 0 0 calc((100% - 24px) / 2);
        max-width: calc((100% - 24px) / 2);
    }
    #npbnb-property-grid tbody {
        gap: 20px;
    }
}

/* Tablets and below (< 992px) */
@media (max-width: 991.98px) {
    .map-section {
        height: 400px;
        order: 2;
    }
    .properties-section {
        max-height: none;
        order: 1;
    }
    .map-container {
        position: relative;
    }
    #npbnb-property-grid tbody tr {
        flex: 0 0 calc((100% - 16px) / 2);
        max-width: calc((100% - 16px) / 2);
    }
    #npbnb-property-grid tbody {
        gap: 16px;
    }
}

/* Mobile phones (< 768px) - 1 column */
@media (max-width: 767.98px) {
    #npbnb-property-grid tbody tr {
        flex: 0 0 100%;
        max-width: 100%;
    }
    #npbnb-property-grid tbody {
        gap: 16px;
    }
    .rental-card-body {
        padding: 10px;
    }
    .rental-title {
        font-size: 0.875rem;
    }
    .map-section {
        height: 300px;
    }
}

/* Small mobile phones (< 576px) */
@media (max-width: 575.98px) {
    #npbnb-property-grid tbody {
        gap: 12px;
    }
    .rental-image-placeholder i {
        font-size: 2.5rem;
    }
    .favorite-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    .favorite-btn i {
        font-size: 1rem;
    }
}

/* ==================== Scrollbar Styling ==================== */
.properties-section::-webkit-scrollbar {
    width: 8px;
}

.properties-section::-webkit-scrollbar-track {
    background: var(--rq-muted);
}

.properties-section::-webkit-scrollbar-thumb {
    background: var(--rq-sub);
    border-radius: 4px;
}

.properties-section::-webkit-scrollbar-thumb:hover {
    background: var(--rq-text);
}

/* ==================== Loading Animation ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Book Now Button ==================== */
.btn-book-now {
    background: var(--rq-accent);
    color: var(--rq-on-accent);
    border: none;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.btn-book-now:hover {
    background: var(--rq-accent-hover);
    transform: translateY(-1px);
}

.btn-book-now:active {
    transform: translateY(0);
}

.btn-book-now i {
    font-size: 1rem;
}

/* Adjust price section to work with button */
.rental-price {
    margin: 0;
    line-height: 1.25;
}

.favorite-btn i.fa-heart {
    /* Font Awesome specific centering */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Phase 4: the heart is the most-tapped control on a listing card, and at
   32x32 it was the smallest target on the page. 44px is the minimum a
   thumb can hit reliably. Sized here rather than in rq-utilities.css
   because this file sets min-width/min-height explicitly and would win
   against it — better one rule that is right than two that disagree. */
@media (max-width: 767.98px) {
    .favorite-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}
