﻿/* ═══════════════════ HEADER ═══════════════════ */
.ap-header {
    position: relative;
    background: linear-gradient(135deg, #1a0e05 0%, #2d1a0a 50%, #1a0e05 100%);
    padding: 60px 120px 40px;
    overflow: hidden;
}

    .ap-header::before {
        content: '';
        position: absolute;
        inset: 0;
        background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23C8A27A' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        pointer-events: none;
    }

.ap-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(270deg, rgba(200,162,122,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.ap-header-inner {
    position: relative;
    z-index: 1;
    max-width: 1488px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.ap-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    flex-wrap: wrap;
    min-width: 0;
}

.ap-bc-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(200,162,122,0.7);
    text-decoration: none;
    transition: color .2s;
    flex-shrink: 0;
}

    .ap-bc-link:hover {
        color: #C8A27A;
    }

.ap-bc-sep {
    color: rgba(200,162,122,0.4);
    flex-shrink: 0;
}

.ap-bc-current {
    color: #C8A27A;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-header-title {
    font-family: 'Tajawal', sans-serif;
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(254.65deg, #69452B 10.34%, #CF8855 105.49%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-break: break-word;
}

.ap-header-sub {
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    color: rgba(255,255,255,0.5);
}

.ap-section {
    background: var(--bg);
    padding: 40px 120px 80px;
    min-height: 60vh;
    transition: background .28s ease;
    overflow-x: hidden;
}

.ap-inner {
    max-width: 1488px;
    margin: 0 auto;
    min-width: 0;
}

.ap-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.ap-toolbar-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.ap-result-count {
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    color: var(--text-muted);
}

.ap-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ap-tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: rgba(200,162,122,0.08);
    border: 1.5px solid rgba(200,162,122,0.3);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    transition: background .2s, border-color .2s;
    white-space: nowrap;
    flex-shrink: 0;
}

    .ap-tool-btn:hover {
        background: rgba(200,162,122,0.18);
        border-color: #C8A27A;
    }

.ap-view-toggle {
    display: flex;
    border: 1.5px solid rgba(200,162,122,0.3);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.ap-cat-toggle {
    display: inline-flex;
    border: 1.5px solid rgba(200,162,122,0.3);
    border-radius: 8px;
    overflow: hidden;
    margin-inline-end: 14px;
    flex-shrink: 0;
}

.ap-cat-btn {
    padding: 9px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 600;
    transition: background .2s, color .2s;
    white-space: nowrap;
}

    .ap-cat-btn.active {
        background: var(--gold-grad);
        color: #fff;
    }

    .ap-cat-btn:not(.active):hover {
        background: rgba(200,162,122,0.12);
        color: var(--text-primary);
    }

.ap-view-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: background .2s, color .2s;
    flex-shrink: 0;
}

    .ap-view-btn.active, .ap-view-btn:hover {
        background: rgba(200,162,122,0.15);
        color: #C8A27A;
    }

.ap-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 0;
    font-family: 'Tajawal', sans-serif;
    font-size: 18px;
    color: var(--text-muted);
    text-align: center;
}

.ap-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(200,162,122,0.15);
    border-top-color: #C8A27A;
    border-radius: 50%;
    animation: apSpin .8s linear infinite;
}

@keyframes apSpin {
    to {
        transform: rotate(360deg);
    }
}

.ap-empty, .ap-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 0;
    font-family: 'Tajawal', sans-serif;
    font-size: 18px;
    color: var(--text-muted);
    text-align: center;
}

    .ap-empty svg, .ap-error svg {
        color: rgba(200,162,122,0.35);
    }

.ap-retry-btn {
    padding: 10px 28px;
    background: var(--gold-grad);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: opacity .2s;
}

    .ap-retry-btn:hover {
        opacity: .85;
    }

.ap-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
}

    .ap-grid.list-view {
        grid-template-columns: 1fr;
        gap: 20px;
    }

        .ap-grid.list-view .unit-card {
            flex-direction: row;
            align-items: stretch;
            border: 1px solid rgba(200,162,122,0.2);
            border-radius: 14px;
            overflow: hidden;
            background: var(--bg-card);
            transition: box-shadow .25s, border-color .25s, transform .25s;
            text-decoration: none;
        }

            .ap-grid.list-view .unit-card:hover {
                box-shadow: 0 8px 32px rgba(200,136,90,0.18);
                border-color: rgba(200,162,122,0.5);
                transform: translateY(-3px);
            }

        .ap-grid.list-view .unit-card-img-wrap {
            width: 280px;
            min-width: 280px;
            height: 200px;
            border-radius: 0;
            flex-shrink: 0;
        }

[dir="ltr"] .ap-grid.list-view .unit-card-img-wrap {
    border-radius: 14px 0 0 14px;
}

[dir="rtl"] .ap-grid.list-view .unit-card-img-wrap {
    border-radius: 0 14px 14px 0;
}

.ap-grid.list-view .unit-card-img-wrap img {
    border-radius: 0;
}

.ap-grid.list-view .unit-card-info {
    flex: 1;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    min-width: 0;
}

.ap-grid.list-view .unit-card-price {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(200,162,122,0.15);
}

.ap-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 56px;
    flex-wrap: wrap;
}

.ap-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    border-radius: 10px;
    background: rgba(200,162,122,0.07);
    border: 1.5px solid rgba(200,162,122,0.22);
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .ap-page-btn:hover:not(:disabled) {
        background: rgba(200,162,122,0.2);
        border-color: #C8A27A;
        transform: translateY(-1px);
    }

    .ap-page-btn.active {
        background: var(--gold-grad);
        border-color: #CF8855;
        color: #fff;
        font-weight: 700;
        box-shadow: 0 4px 16px rgba(200,136,90,0.35);
    }

    .ap-page-btn:disabled {
        opacity: .3;
        cursor: not-allowed;
    }

.ap-page-dots {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
    letter-spacing: 2px;
}

.ap-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

    .ap-modal-overlay.show {
        display: flex;
        animation: apOverlayIn .25s ease both;
    }

@keyframes apOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ap-modal {
    background: var(--bg-card);
    border: 1px solid rgba(200,162,122,0.3);
    border-radius: 20px 20px 0 0;
    padding: 28px 24px 40px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: apModalUp .3s ease both;
    box-sizing: border-box;
}

@keyframes apModalUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ap-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}

.ap-modal-title {
    font-family: 'Tajawal', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
}

.ap-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(200,162,122,0.1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background .2s;
    flex-shrink: 0;
}

    .ap-modal-close:hover {
        background: rgba(200,162,122,0.22);
    }

.ap-modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ap-filter-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ap-filter-label {
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ap-filter-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(200,162,122,0.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}

    .ap-filter-input:focus {
        border-color: #C8A27A;
    }

[data-theme="light"] .ap-filter-input {
    background: rgba(255,255,255,0.8);
}

.ap-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 4px;
    background: rgba(200,162,122,0.2);
    outline: none;
}

    .ap-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #C8A27A;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(200,136,90,0.5);
    }

.ap-price-labels {
    display: flex;
    justify-content: space-between;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    color: var(--text-muted);
}

.ap-modal-divider {
    height: 1px;
    background: rgba(200,162,122,0.15);
}

.ap-modal-apply {
    width: 100%;
    height: 52px;
    margin-top: 24px;
    background: var(--gold-grad);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Tajawal', sans-serif;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
}

    .ap-modal-apply:hover {
        opacity: .88;
    }

.ap-sort-modal {
    max-height: 70vh;
}

.ap-sort-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ap-sort-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    gap: 10px;
}

    .ap-sort-item:hover {
        background: rgba(200,162,122,0.1);
    }

    .ap-sort-item input[type="radio"] {
        display: none;
    }

.ap-sort-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    color: var(--text-primary);
    min-width: 0;
}

.ap-sort-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(200,162,122,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #C8A27A;
    flex-shrink: 0;
}

.ap-sort-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(200,162,122,0.4);
    flex-shrink: 0;
    transition: background .2s, border-color .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ap-sort-item:has(input:checked) .ap-sort-radio {
    background: #C8A27A;
    border-color: #C8A27A;
}

    .ap-sort-item:has(input:checked) .ap-sort-radio::after {
        content: '';
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #fff;
    }

/* ── Chips ── */
.ap-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.ap-chip {
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(200,162,122,0.08);
    border: 1.5px solid rgba(200,162,122,0.25);
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}

    .ap-chip.active {
        background: var(--gold-grad);
        border-color: #CF8855;
        color: #fff;
        font-weight: 600;
    }

/* ── Filter section label ── */
.ap-filter-section-lbl {
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

/* ══════════════════════════════════════════════
   RESPONSIVE — TABLET (1025px → 1280px range handled
   first since it's the smallest reduction from desktop)
   ══════════════════════════════════════════════ */
@media (max-width: 1280px) {
    .ap-grid {
        grid-template-columns: repeat(3,1fr);
        gap: 24px;
    }

    .ap-section {
        padding: 32px 40px 60px;
    }

    .ap-header {
        padding: 44px 40px 28px;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE — TABLET / SMALL LAPTOP ≤ 1024px
   ══════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .ap-header {
        padding: 40px 24px 26px;
    }

    .ap-header-title {
        font-size: 32px;
    }

    .ap-section {
        padding: 28px 24px 60px;
    }

    .ap-toolbar {
        align-items: flex-start;
    }

    .ap-toolbar-left {
        flex: 1 1 100%;
    }

    .ap-toolbar-right {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE — MOBILE / TABLET ≤ 768px
   (matches the breakpoint used across the rest of Samra)
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {

    body, html {
        overflow-x: hidden;
    }

    /* ── Header ── */
    .ap-header {
        padding: 28px 16px 20px;
    }

    .ap-header-inner {
        gap: 10px;
    }

    .ap-breadcrumb {
        font-size: 12px;
        gap: 6px;
    }

    .ap-bc-current {
        max-width: 140px;
    }

    .ap-header-title {
        font-size: 24px;
    }

    .ap-header-sub {
        font-size: 13px;
    }

    /* ── Categories bar (container only; pill styling
         itself lives in responsive.css ❺ block) ── */
    .cats-bar-wrap {
        padding: 0 12px 14px !important;
    }

    /* ── Main section ── */
    .ap-section {
        padding: 18px 12px 48px;
    }

    /* ── Toolbar: wraps to two rows instead of overflowing ── */
    .ap-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 20px;
    }

    .ap-toolbar-left {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .ap-cat-toggle {
        margin-inline-end: 0;
        flex: 1 1 auto;
    }

    .ap-cat-btn {
        flex: 1;
        padding: 8px 10px;
        font-size: 13px;
        text-align: center;
    }

    .ap-result-count {
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .ap-toolbar-right {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .ap-tool-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 8px;
        font-size: 0;
        gap: 0;
        min-width: 0;
    }

        .ap-tool-btn svg {
            flex-shrink: 0;
        }

    .ap-view-toggle {
        flex-shrink: 0;
    }

    .ap-view-btn {
        width: 36px;
        height: 36px;
    }

    /* ── Grid: 2 columns on phones ── */
    .ap-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

        .ap-grid.list-view {
            gap: 14px;
        }

            .ap-grid.list-view .unit-card {
                flex-direction: column;
            }

            .ap-grid.list-view .unit-card-img-wrap {
                width: 100%;
                min-width: 0;
                height: 180px;
                border-radius: 14px 14px 0 0 !important;
            }

            .ap-grid.list-view .unit-card-info {
                padding: 14px 16px;
            }

    /* ── Loading / empty / error ── */
    .ap-loading, .ap-empty, .ap-error {
        padding: 56px 16px;
        font-size: 15px;
    }

    /* ── Pagination ── */
    .ap-pagination {
        margin-top: 36px;
        gap: 5px;
    }

    .ap-page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 14px;
    }

    /* ── Modals (filter / sort) ── */
    .ap-modal {
        padding: 22px 16px 32px;
        max-height: 88vh;
    }

    .ap-modal-title {
        font-size: 18px;
    }

    .ap-sort-content {
        font-size: 15px;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE — SMALL PHONES ≤ 600px
   ══════════════════════════════════════════════ */
@media (max-width: 600px) {
    .ap-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ap-header {
        padding: 24px 14px 18px;
    }

    .ap-header-title {
        font-size: 22px;
    }

    .ap-section {
        padding: 16px 12px 40px;
    }

    .ap-toolbar-left {
        flex-wrap: wrap;
    }

    .ap-result-count {
        order: 3;
        width: 100%;
    }
}

/* ══════════════════════════════════════════════
   DESKTOP — modal centers instead of bottom sheet
   ══════════════════════════════════════════════ */
@media (min-width: 769px) {
    .ap-modal-overlay {
        align-items: center;
        padding: 20px;
    }

    .ap-modal {
        border-radius: 20px;
        max-height: 80vh;
    }
}
