/* ===== COMPLEXES PAGE STYLES ===== */

.complexes-page {
    background: #FFFFFF;
    min-height: 100vh;
    color: #333;
}

/* Page-specific breadcrumb customization - add styles here if needed */

/* Results count summary */
.results-count {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #F7FAF7;
    border: 1px solid #E2F1E4;
    border-radius: 9999px;
    color: #55616A;
    font-size: 14px;
}

.results-count strong {
    color: var(--color-primary);
    font-weight: 800;
    padding: 2px 8px;
    background: #E9F6EB;
    border-radius: 9999px;
}

/* Adjust appearance when inside green filters panel */
.filters-panel .results-count {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.filters-panel .results-count strong {
    background: #FFFFFF;
    color: var(--color-primary);
}

/* Add a subtle search icon before the text inside filters panel */
.filters-panel .results-count::before {
    content: "";
    width: 16px;
    height: 16px;
    background: #FFFFFF;
    opacity: 0.9;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Основний контейнер */
.complexes-container {
    padding-top: 105px;
    padding-bottom: 24px;
    background: #FFFFFF;
}

.complexes-layout {
    display: grid;
    grid-template-columns: 413px 1fr;
    gap: 24px;
    max-width: 1720px;
    margin: 0 auto;
    /* padding: 0 20px; */
}
@media (max-width: 1752px) {
    .complexes-layout {
        width: 100% !important;
        max-width: unset !important;
        padding: 0 15px;
    }
}

/* Бічна панель з фільтрами */
.filters-sidebar {
    position: sticky;
    top: 120px;
    height: fit-content;
}

.filters-panel {
    background: var(--color-primary);
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 30px rgba(70, 163, 81, 0.3);
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px;
}

/* Fixed header section */
.filters-panel-header {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* Scrollable content section */
.filters-panel-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Fixed footer section */
.filters-panel-footer {
    flex-shrink: 0;
}

.filters-title {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    text-transform: none;
    text-align: left;
    font-family: var(--font-family-secondary);
}

.btn-close-filters {
    display: none;
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.btn-close-filters:hover {
    background: rgba(255, 255, 255, 0.1);
}

.close-icon {
    line-height: 1;
    font-weight: 300;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Active filters block */
.active-filters {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
}

.active-filters-title {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 13px;
    margin: 0 0 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.active-filters-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFFFFF;
    color: var(--color-primary);
    border: 1px solid #FFFFFF;
    border-radius: 9999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    margin: 0;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Smooth height animation for collapsible content */
.filter-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

/* Spec groups inside room specs */
.spec-group {
    margin-bottom: 10px;
}

.spec-group-title {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 13px;
    margin: 6px 0 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.95;
}

/* Enhanced styling for spec checkboxes */
.spec-checkbox {
    min-width: fit-content;
    padding: 8px 12px;
}

.spec-checkbox .option-text {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
}

.spec-value {
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
}

.spec-unit {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 600;
    line-height: 1;
}

/* When checked, make value more prominent */
.spec-checkbox:has(input:checked) .spec-value {
    font-weight: 800;
}

.filter-search {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Collapsible header */
.filter-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 6px 4px;
    border-radius: 8px;
}

.filter-group-header:hover {
    background: rgba(255, 255, 255, 0.12);
}

.filter-toggle-indicator {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    position: relative;
}

.filter-toggle-indicator::before,
.filter-toggle-indicator::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.85);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.filter-toggle-indicator::before {
    width: 10px;
    height: 2px;
    border-radius: 1px;
}

.filter-toggle-indicator::after {
    width: 2px;
    height: 10px;
    border-radius: 1px;
}

/* Collapsed state */
.filter-group.collapsed .filter-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.filter-group.collapsed .filter-toggle-indicator::after {
    opacity: 0;
    transform: translate(-50%, -50%) scaleY(0);
}

.filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
    font-family: var(--font-family-secondary);
}

.filter-input {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    color: #333333;
    font-family: inherit;
    transition: all 0.2s ease;
}

.filter-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.filter-input::placeholder {
    color: #6b7280;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 3px;
}

.filter-option,
.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    transition: all 0.15s ease;
    user-select: none;
}

.filter-option:hover,
.filter-checkbox:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}

/* Ховаємо стандартні інпути всередині ярликів */
.filter-option input[type="radio"],
.filter-checkbox input[type="checkbox"] {
    display: none;
}

/* Активний стан через :has підтримується у сучасних браузерах */
.filter-option:has(input:checked),
.filter-checkbox:has(input:checked) {
    background: #FFFFFF;
    border-color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

.option-text {
    font-size: 14px;
    line-height: 1;
    color: #FFFFFF;
    font-weight: 500;
}

.filter-option:has(input:checked) .option-text,
.filter-checkbox:has(input:checked) .option-text {
    color: var(--color-primary);
}

/* Ensure badge is readable on active white chips */
.filter-checkbox:has(input:checked) .count-badge {
    color: var(--color-primary);
}

.count-badge {
    margin-left: 4px;
    font-size: 14px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.85);
}

.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
}

.btn-filter {
    background: #FFFFFF;
    color: var(--color-primary);
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    font-family: var(--font-family-secondary);
}

.btn-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(255, 255, 255, 0.25);
}

.btn-reset {
    background: transparent;
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family-secondary);
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #FFFFFF;
}

/* Основний контент */
.complexes-main {
    min-height: 600px;
}

.complexes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    justify-content: stretch;
}

/* Посилання на картки комплексів */
.complex-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* When only one card is present, center it and limit width */
.complexes-grid:not(:has(> *:nth-child(2))) {
    grid-template-columns: minmax(320px, 629px);
    justify-content: start;
}

.complexes-grid:not(:has(> *:nth-child(2))) .complex-card {
    max-width: 629px;
    margin: 0;
}

@media (max-width: 992px) {
    .complexes-grid:not(:has(> *:nth-child(2))) {
        grid-template-columns: minmax(320px, 720px);
        justify-content: start;
    }
    .complexes-grid:not(:has(> *:nth-child(2))) .complex-card {
        max-width: 720px;
        margin: 0;
    }
}

@media (max-width: 768px) {
    .complexes-grid:not(:has(> *:nth-child(2))) {
        grid-template-columns: 1fr;
        justify-content: start;
    }
    .complexes-grid:not(:has(> *:nth-child(2))) .complex-card {
        max-width: none;
        margin: 0;
    }
}

/* Картки комплексів */
.complex-card {
    background: #1a1a1a;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 240px;
    display: flex;
    flex-direction: column;
}

/* Hover effects only on devices that support hover */
@media (hover: hover) and (pointer: fine) {
    .complex-card-link:hover .complex-card {
        transform: translateY(-5px);
        box-shadow: 0 15px 40px rgba(70, 163, 81, 0.2);
    }
}

/* Keyboard focus accessibility */
.complex-card-link:focus-visible .complex-card {
    outline: 3px solid rgba(70, 163, 81, 0.5);
    outline-offset: 3px;
}

.card-image {
    position: relative;
    height: 100%;
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 10;
}

.card-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
     filter: brightness(70%);
}

@media (hover: hover) and (pointer: fine) {
    .complex-card-link:hover .card-bg {
        transform: scale(1.05);
    }
}

.card-bg-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #46A351 0%, #2d6b35 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #FFFFFF;
}

/* Логотип/текст по центру картки */
.card-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
}

/* Зображення логотипів */
.logo-image {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
    object-fit: contain;
    margin: 0 auto;
    margin-bottom: 20px;
}


/* Назва комплексу під логотипом */
.card-title {
    font-size: 32px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    font-family: var(--font-family-secondary);
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.9);
    text-align: center;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

/* Приховуємо контент внизу картки */
.card-content {
    display: none;
}

.card-address,
.card-rating,
.card-actions {
    display: none;
}

/* Повідомлення про відсутність результатів */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results h3 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
    font-family: var(--font-family-secondary);
}

.no-results p {
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}


/* Адаптивність */
@media (max-width: 1200px) {
    .complexes-layout {
        grid-template-columns: 300px 1fr;
        gap: 15px;
    }
    
    .complexes-grid {
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
        gap: 15px;
    }
    .filters-header {

            align-items: flex-start;
            justify-content: space-between;
            margin-bottom: 0;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 10px;
    }
    
    .spec-value {
        font-size: 15px;
    }
    
    .spec-unit {
        font-size: 11px;
    }
}

/* Large tablets / small laptops */
@media (max-width: 992px) {
    .complexes-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 22px;
    }

    .complex-card {
        border-radius: 16px;
        min-height: 300px;
    }

    .card-image {
        aspect-ratio: 16 / 11;
    }

    .logo-image {
        max-width: 100px;
        max-height: 100px;
        margin-bottom: 16px;
    }

    .card-title {
        font-size: 26px;
    }
}

/* Mobile filter toggle button */
.mobile-filter-toggle {
    display: none;
    position: sticky;
    top: 20px;
    z-index: 100;
}

.btn-mobile-filters {
    display: flex;
    align-items: center;
    gap: 8px;
   
    color: black;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family-secondary);
}


.filter-icon-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.filter-icon-svg path {
    stroke: #000000;
}

.filter-count {
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* Mobile overlay and sidebar behavior */
@media (max-width: 768px) {
    .mobile-filter-toggle {
        display: block;
      
    }
    
    .complexes-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .filters-sidebar {
        position: fixed;
        top: 105px;
        left: 0;
        width: 100%;
        height: calc(100vh - 105px);
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: flex;
        align-items: flex-start;
        justify-content: flex-end;
        padding: 15px;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .filters-sidebar.mobile-open {
        opacity: 1;
        visibility: visible;
    }
    
    .filters-panel {
        background: var(--color-primary);
        border-radius: 16px;
        width: 100%;
        /* max-width: 320px; */
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        padding: 20px;
    }
    
    .btn-close-filters {
        display: block;
        position: absolute;
        right: 5px;
        top: 2px;
        height: 20px;
    }
    
    .filters-sidebar.mobile-open .filters-panel {
        transform: translateX(0);
    }
    
    .complexes-main {
        order: 1;
    }
    
    /* Prevent body scroll when filters are open */
    body.filters-open {
        overflow: hidden;
    }
    
    .complexes-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    
    .filters-panel {
        padding: 16px;
        border-radius: 14px;
    }
    
    .filters-title {
        font-size: 18px;
        /* margin-bottom: 14px; */
    }

    .complex-card {
        min-height: 280px;
    }

    .card-image {
        aspect-ratio: 16 / 12;
    }

    .logo-image {
        max-width: 90px;
        max-height: 90px;
        margin-bottom: 12px;
    }

    .card-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .complexes-container {
        padding-top: 78px;
    }
    
    .filters-sidebar {
        top: 78px;
        height: calc(100vh - 78px);
    }
    
    .complexes-layout {
        padding: 0 15px;
        gap: 20px;
    }
    

    
    
    
    .complex-card {
        min-height: 250px;
    }
    
    .card-image {
        height: 150px;
        aspect-ratio: 16 / 12;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .card-title {
        font-size: 20px;
    }
    
    .card-actions {
        flex-direction: column;
    }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .complex-card,
    .card-bg {
        transition: none;
    }
}
