/* ==========================================================================
   Agency Base CSS — Shared styles for all agency themes
   Components, utilities, and features not in Bootstrap.
   Theme-specific styling is done via CSS custom properties.
   ========================================================================== */

/* ---- Agency Logo ---- */
.agency-logo-wrapper {
    display: flex;
    align-items: center;
}
.agency-logo {
    max-height: 44px;
    max-width: 120px;
    width: auto;
    object-fit: contain;
}

/* ---- WhatsApp Float ---- */
.agency-whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: #25D366;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.agency-whatsapp-float:hover {
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

/* ---- Share Buttons ---- */
.agency-share-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.agency-share-buttons .share-label {
    font-size: 0.875rem;
    color: var(--agency-text-light, #6c757d);
    font-weight: 500;
}

.agency-share-buttons .share-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: 1px solid var(--agency-border, #e5e5e5);
    background: #fff;
    color: var(--agency-text, #333);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.agency-share-buttons .share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.share-whatsapp:hover { background: #25D366; color: #fff; border-color: #25D366; }
.share-facebook:hover { background: #1877F2; color: #fff; border-color: #1877F2; }
.share-email:hover { background: var(--agency-primary, #000); color: #fff; border-color: var(--agency-primary, #000); }
.share-copy:hover { background: var(--agency-secondary, #D4AF37); color: #fff; border-color: var(--agency-secondary, #D4AF37); }

/* ---- Breadcrumbs ---- */
.agency-breadcrumbs {
    padding: 1rem 0;
}

.agency-breadcrumbs .breadcrumb {
    background: transparent;
    margin-bottom: 0;
    font-size: 0.8125rem;
}

.agency-breadcrumbs .breadcrumb-item a {
    color: var(--agency-text-light, #6c757d);
    text-decoration: none;
}

.agency-breadcrumbs .breadcrumb-item a:hover {
    color: var(--agency-primary, #000);
}

.agency-breadcrumbs .breadcrumb-item.active {
    color: var(--agency-primary, #000);
}

/* ---- Pagination ---- */
.agency-pagination {
    margin-top: 2rem;
}

.agency-pagination .page-link {
    color: var(--agency-primary, #000);
    border-color: var(--agency-border, #e5e5e5);
    font-size: 0.875rem;
}

.agency-pagination .page-item.active .page-link {
    background-color: var(--agency-primary, #000);
    border-color: var(--agency-primary, #000);
    color: #fff;
}

.agency-pagination .page-link:hover {
    background-color: var(--agency-bg-light, #f8f9fa);
    color: var(--agency-primary, #000);
}

/* ---- Alert Form ---- */
.agency-alert-inline {
    background: var(--agency-bg-light, #f8f9fa);
    border: 1px solid var(--agency-border, #e5e5e5);
    border-radius: var(--agency-radius, 8px);
    padding: 1.5rem;
}

.agency-alert-full {
    background: var(--agency-bg-light, #f8f9fa);
    border-radius: var(--agency-radius, 8px);
    padding: 2rem;
}

/* ---- Contact Form ---- */
.agency-contact-form .form-control,
.agency-contact-form .form-select {
    border-color: var(--agency-border, #e5e5e5);
    font-size: 0.9375rem;
}

.agency-contact-form .form-control:focus,
.agency-contact-form .form-select:focus {
    border-color: var(--agency-secondary, #D4AF37);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.15);
}

/* ---- Search Form ---- */
.agency-search-full {
    background: #fff;
    border: 1px solid var(--agency-border, #e5e5e5);
    border-radius: var(--agency-radius, 8px);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Hero search bar (homepage) */
.agency-search-hero {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1rem;
}

.agency-search-hero .agency-search-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    overflow: hidden;
}

.agency-search-hero .agency-search-field {
    display: flex !important;
    align-items: center;
    flex: 1;
    min-width: 0;
    padding: 0 1rem;
    border-right: 1px solid #eee;
    gap: 0.5rem;
}

.agency-search-hero .agency-search-field i {
    color: #666;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.agency-search-hero .agency-search-field select {
    border: none !important;
    background: transparent !important;
    height: 56px;
    font-size: 0.95rem;
    color: #333;
    width: 100%;
    cursor: pointer;
    padding-right: 1.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none !important;
    outline: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0 center !important;
}

.agency-search-hero .agency-search-field select:focus {
    outline: none !important;
    box-shadow: none !important;
}

.agency-search-hero .agency-search-submit {
    height: 56px;
    padding: 0 2rem;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    border: none !important;
    border-radius: 0 !important;
    background: var(--agency-primary, #000) !important;
    color: #fff !important;
    cursor: pointer;
    transition: background 0.2s;
    display: flex !important;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.agency-search-hero .agency-search-submit:hover {
    background: var(--agency-secondary, #D4AF37) !important;
    color: #fff !important;
}

@media (max-width: 767.98px) {
    .agency-search-hero .agency-search-row {
        flex-direction: column !important;
        border-radius: 10px;
    }
    .agency-search-hero .agency-search-field {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 0 1rem;
    }
    .agency-search-hero .agency-search-field select {
        height: 48px;
    }
    .agency-search-hero .agency-search-submit {
        height: 50px;
        justify-content: center;
        border-radius: 0 0 10px 10px !important;
    }
}

/* ---- Gallery (Sotheby's-style grid) ---- */
.agency-gallery {
    position: relative;
}

.agency-gallery-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: 520px;
    gap: 6px;
    border-radius: var(--agency-radius, 8px);
    overflow: hidden;
}

.agency-gallery-grid.gallery-single {
    grid-template-columns: 1fr;
}

/* Main hero image */
.agency-gallery-hero {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.agency-gallery-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Navigation arrows */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.45);
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.2s;
    opacity: 0;
}

.agency-gallery-hero:hover .gallery-nav {
    opacity: 1;
}

.gallery-nav:hover {
    background: rgba(0,0,0,0.7);
}

.gallery-nav-prev { left: 12px; }
.gallery-nav-next { right: 12px; }

/* Counter badge (1/28) */
.gallery-counter-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    z-index: 5;
}

/* Side thumbnails (stacked vertically) */
.agency-gallery-side {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agency-gallery-side-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex: 1;
    min-height: 0;
}

.agency-gallery-side-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.agency-gallery-side-item:hover img {
    transform: scale(1.05);
}

/* "+N more" overlay on last thumbnail */
.gallery-more-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.gallery-more-overlay span {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

.gallery-more-overlay:hover {
    background: rgba(0,0,0,0.6);
}

/* Responsive: stack on mobile */
@media (max-width: 767.98px) {
    .agency-gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 280px;
    }
    .agency-gallery-side {
        flex-direction: row;
    }
    .agency-gallery-side-item {
        height: 90px;
    }
    .gallery-nav {
        opacity: 1;
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .agency-gallery-grid {
        grid-template-columns: 1fr 200px;
        grid-template-rows: 400px;
    }
}

/* ---- Lightbox ---- */
.agency-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agency-lightbox .lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
}

.agency-lightbox .lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agency-lightbox .lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.agency-lightbox .lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10001;
    padding: 0.5rem;
}

.agency-lightbox .lightbox-prev,
.agency-lightbox .lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 1rem;
    z-index: 10001;
    border-radius: 50%;
    transition: background 0.2s;
}

.agency-lightbox .lightbox-prev:hover,
.agency-lightbox .lightbox-next:hover {
    background: rgba(255,255,255,0.2);
}

.agency-lightbox .lightbox-prev { left: 16px; }
.agency-lightbox .lightbox-next { right: 16px; }

.agency-lightbox .lightbox-counter {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    z-index: 10001;
}

/* ---- Map (Mapbox GL) ---- */
.agency-map-container {
    border-radius: var(--agency-radius, 8px);
    overflow: hidden;
    border: 1px solid var(--agency-border, #e5e5e5);
}

.agency-map .mapboxgl-canvas {
    border-radius: inherit;
}

.agency-map .mapboxgl-popup-content {
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.map-popup {
    font-size: 0.875rem;
    line-height: 1.5;
}

.map-popup strong {
    display: block;
    margin-bottom: 0.25rem;
}

.map-popup-price {
    color: var(--agency-primary, #000);
    font-weight: 600;
}

/* ---- Filter Bar (v3/Properstar-style sticky) ---- */
.agency-filter-bar {
    padding: 0;
    border-bottom: 1px solid var(--agency-border, #e2e8f0);
}

.agency-filter-bar.sticky-top {
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
}

/* Filter Pill buttons (Properstar style) */
.filter-pill {
    font-size: 0.875rem !important;
    padding: 0.45rem 1rem !important;
    border-radius: 24px !important;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-pill.filter-active {
    background: var(--agency-primary, #1a1a2e) !important;
    color: #fff !important;
    border-color: var(--agency-primary, #1a1a2e) !important;
}

.filter-pill.btn-success {
    border-radius: 24px !important;
    font-weight: 600;
}

.agency-filter-tabs {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.agency-filter-tabs::-webkit-scrollbar {
    display: none;
}

.agency-filter-tab {
    display: inline-flex !important;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 20px;
    border: 1px solid #e5e5e5;
    color: #333;
    text-decoration: none;
    background: #fff;
    transition: all 0.2s;
}

.agency-filter-tab:hover {
    background: #f8f9fa;
    color: var(--agency-primary, #000);
    text-decoration: none;
}

.agency-filter-tab.active {
    background: var(--agency-primary, #1a1a2e);
    color: #fff !important;
    border-color: var(--agency-primary, #1a1a2e);
}

.agency-filter-dropdowns {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.agency-filter-dropdowns .dropdown {
    display: inline-block;
}

.agency-filter-bar .btn.agency-filter-btn,
.agency-filter-btn {
    font-size: 0.8125rem !important;
    padding: 0.4rem 0.9rem !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 20px !important;
    background: #fff !important;
    color: #333 !important;
    white-space: nowrap;
    transition: all 0.2s;
    display: inline-flex !important;
    align-items: center;
}

.agency-filter-bar .btn.agency-filter-btn:hover,
.agency-filter-btn:hover {
    background: #f8f9fa !important;
    border-color: var(--agency-primary, #333) !important;
    color: #333 !important;
}

.agency-filter-bar .btn.agency-filter-btn.filter-active,
.agency-filter-btn.filter-active {
    background: var(--agency-primary, #1a1a2e) !important;
    color: #fff !important;
    border-color: var(--agency-primary, #1a1a2e) !important;
}

.agency-filter-bar .btn.agency-filter-alert,
.agency-filter-alert {
    border-color: var(--agency-secondary, #D4AF37) !important;
    color: var(--agency-secondary, #D4AF37) !important;
    background: #fff !important;
}

.agency-filter-bar .btn.agency-filter-alert:hover,
.agency-filter-alert:hover {
    background: var(--agency-secondary, #D4AF37) !important;
    color: #fff !important;
}

.agency-filter-bar .btn.agency-filter-clear,
.agency-filter-clear {
    border-color: #dc3545 !important;
    color: #dc3545 !important;
    background: #fff !important;
}

.agency-filter-bar .btn.agency-filter-clear:hover,
.agency-filter-clear:hover {
    background: #dc3545 !important;
    color: #fff !important;
}

.dropdown-menu-scrollable {
    max-height: 300px;
    overflow-y: auto;
}

@media (max-width: 767.98px) {
    .agency-filter-dropdowns {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.5rem;
    }
    .agency-filter-dropdowns::-webkit-scrollbar {
        display: none;
    }
}

/* ---- View Toggle (Grid/Map) ---- */
.view-toggle-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--agency-border, #e5e5e5);
    border-radius: var(--agency-radius-sm, 4px);
    overflow: hidden;
}

.view-toggle-group button {
    padding: 0.5rem 1rem;
    background: #fff;
    border: none;
    font-size: 0.875rem;
    color: var(--agency-text-light, #6c757d);
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-group button + button {
    border-left: 1px solid var(--agency-border, #e5e5e5);
}

.view-toggle-group button.active {
    background: var(--agency-primary, #000);
    color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 767.98px) {
    .agency-whatsapp-float {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .agency-share-buttons .share-btn {
        width: 34px;
        height: 34px;
        font-size: 0.875rem;
    }
}

/* ---- Demo layout: box mode ---- */
html.demo-layout-box-html {
    background: #e8eaed;
}
body.demo-layout-box {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 0 60px rgba(0,0,0,.18);
}
