/* ==========================================================================
   san-pham.css — Archive page for CPT san_pham
   Depends on: base.css (CSS variables)
   ========================================================================== */

/* ─── HERO ─────────────────────────────────────────────────────────────────── */
.sp-hero {
    background: linear-gradient(135deg, var(--color-dark-navy) 0%, var(--color-secondary) 60%, #153a60 100%);
    padding: 40px 0 44px;
    position: relative;
    overflow: hidden;
}

.sp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 80% at 80% 50%, rgba(255, 200, 51, .08) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 10% 80%, rgba(255, 200, 51, .05) 0%, transparent 60%);
    pointer-events: none;
}

.sp-hero__inner {
    position: relative;
    z-index: 1;
}

.sp-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: .08em;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.sp-hero__title {
    font-size: clamp(1.6rem, 3.5vw, 2.5rem);
    font-weight: var(--weight-black);
    color: #fff;
    line-height: 1.15;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.sp-hero__sub {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, .65);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Hero search */
.sp-hero__search {
    display: flex;
    align-items: center;
    max-width: 560px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--radius-full);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.sp-hero__search-input {
    flex: 1;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 12px 18px !important;
    margin: 0 !important;
    font-size: var(--text-sm);
    color: #fff !important;
}

.sp-hero__search-input::placeholder {
    color: rgba(255, 255, 255, .5);
}

.sp-hero__search-btn {
    flex-shrink: 0;
    padding: 10px 24px;
    margin: 5px 5px 5px 0;
    background: var(--color-primary);
    color: var(--color-secondary);
    font-weight: 800;
    font-size: var(--text-sm);
    border: 0;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.sp-hero__search-btn:hover {
    background: var(--color-primary-hover);
    transform: scale(1.02);
}

/* ─── ARCHIVE WRAPPER ───────────────────────────────────────────────────────── */
.sp-archive {
    padding: 32px 0 64px;
    background: var(--bg-light);
    min-height: 60vh;
}

/* ─── BREADCRUMB ────────────────────────────────────────────────────────────── */
.sp-bc {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    letter-spacing: .1em;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(10, 38, 71, .45);
    margin-bottom: 24px;
}

.sp-bc__link {
    color: rgba(10, 38, 71, .55);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.sp-bc__link:hover {
    opacity: .75;
}

.sp-bc__sep {
    color: rgba(10, 38, 71, .3);
    font-weight: 400;
}

.sp-bc__current {
    color: var(--color-primary);
}

/* ─── LAYOUT (sidebar + main) ───────────────────────────────────────────────── */
.sp-layout {
    display: grid;
    grid-template-columns: 268px 1fr;
    gap: 28px;
    align-items: start;
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────────────── */
.sp-sidebar {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .07);
    border-radius: var(--radius-2xl);
    padding: 20px;
    position: sticky;
    top: 100px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
}

.sp-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.sp-sidebar__title {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--color-secondary);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sp-sidebar__reset {
    font-size: var(--text-xs);
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.sp-sidebar__reset:hover {
    opacity: .75;
}

/* Filter groups */
.sp-filter-group {
    border-top: 1px solid rgba(15, 23, 42, .06);
    padding: 14px 0;
}

.sp-filter-group:last-of-type {
    border-bottom: 1px solid rgba(15, 23, 42, .06);
    margin-bottom: 18px;
}

.sp-filter-group__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-secondary);
    margin-bottom: 12px;
    text-align: left;
}

.sp-filter-group__arrow {
    color: rgba(10, 38, 71, .45);
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.sp-filter-group__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease, gap 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.sp-filter-group__toggle[aria-expanded="false"]+.sp-filter-group__list {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    gap: 0;
    pointer-events: none;
}

.sp-filter-group__toggle[aria-expanded="false"] .sp-filter-group__arrow {
    transform: rotate(180deg);
}

/* Radio filter items */
.sp-filter-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: var(--text-sm);
    color: rgba(15, 23, 42, .7);
    transition: color var(--transition-fast);
}

.sp-filter-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sp-filter-radio__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, .2);
    flex-shrink: 0;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.sp-filter-radio.is-active .sp-filter-radio__dot,
.sp-filter-radio:hover .sp-filter-radio__dot {
    border-color: var(--color-primary);
    background: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(255, 200, 51, .18);
}

.sp-filter-radio.is-active {
    color: var(--color-secondary);
    font-weight: 700;
}

/* Price pills */
.sp-filter-group__list--price {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}

.sp-filter-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    border: 1px solid rgba(15, 23, 42, .12);
    color: rgba(15, 23, 42, .6);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.sp-filter-pill:hover,
.sp-filter-pill.is-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-secondary);
}

/* CTA box */
/* ─── CTA Tư vấn (CF7 minimal) ─────────────────────────────────────────────── */
.custom-ad-form-minimal {
    background: var(--color-secondary);
    border-radius: var(--radius-xl);
    text-align: center;
    margin-top: 4px;
}

.custom-ad-form-minimal .form-icon-wrap {
    margin-bottom: 14px;
}

.custom-ad-form-minimal .form-icon-wrap img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 50%;
}

.custom-ad-form-minimal h3 {
    font-size: var(--text-base) !important;
    font-weight: 800 !important;
    color: #fff;
    margin: 0 0 6px;
}

.custom-ad-form-minimal p {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, .6);
    line-height: 1.55;
    margin: 0 0 18px;
}

.custom-ad-form-minimal [type="submit"],
.custom-ad-form-minimal .wpcf7-submit {
    display: block;
    width: 100%;
    padding: 12px 0;
    background: var(--color-primary);
    color: var(--color-secondary);
    font-weight: 800;
    font-size: var(--text-sm);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.custom-ad-form-minimal [type="submit"]:hover,
.custom-ad-form-minimal .wpcf7-submit:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

/* ─── MAIN ──────────────────────────────────────────────────────────────────── */
.sp-main {
    min-width: 0;
}

/* ─── SORT BAR ──────────────────────────────────────────────────────────────── */
.sp-sortbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sp-sortbar__count {
    font-size: var(--text-sm);
    color: rgba(15, 23, 42, .55);
}

.sp-sortbar__count strong {
    color: var(--color-secondary);
    font-weight: 800;
}

.sp-sortbar__form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-sortbar__label {
    font-size: var(--text-sm);
    color: rgba(15, 23, 42, .5);
    font-weight: 600;
    white-space: nowrap;
}

.sp-sortbar__select {
    height: 36px;
    padding: 0 32px 0 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(15, 23, 42, .1);
    background: #fff;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-secondary);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, .4) 50%),
        linear-gradient(135deg, rgba(15, 23, 42, .4) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 14px,
        calc(100% - 9px) 14px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    margin-bottom: 0 !important;
    cursor: pointer;
}

.sp-sortbar__select:focus {
    border-color: rgba(245, 197, 66, .55);
    box-shadow: 0 0 0 3px rgba(245, 197, 66, .18);
}

/* ─── GRID ──────────────────────────────────────────────────────────────────── */
.sp-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

/* ─── CARD ──────────────────────────────────────────────────────────────────── */
.sp-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .06);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .06);
    transition: transform .18s ease, box-shadow .18s ease;
}

.sp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, .11);
}

.sp-card--sold {
    opacity: .8;
}

/* Media */
.sp-card__media {
    display: block;
    position: relative;
    height: 220px;
    overflow: hidden;
    background: #f3f4f6;
}

.sp-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
    transition: transform .38s ease;
}

.sp-card:hover .sp-card__img {
    transform: scale(1.08);
}

.sp-card__img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e5e7eb 0%, #f3f4f6 100%);
}

/* Badge wrapper — chứa tất cả badges theo hàng ngang ở top-left ảnh */
.sp-card__badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    max-width: calc(100% - 50px);
    /* tránh đè nút fav */
    z-index: 2;
}

/* Badge item cơ bản — không còn position:absolute riêng */
.sp-card__badge {
    font-size: var(--text-2xs);
    font-weight: 800;
    letter-spacing: .04em;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-secondary);
    backdrop-filter: blur(4px);
    white-space: nowrap;
    line-height: 1.4;
}

/* Badge color variants */
.sp-card__badge--can-ho {
    background: rgba(59, 130, 246, .9);
    color: #fff;
}

.sp-card__badge--biet-thu {
    background: rgba(245, 197, 66, .95);
    color: var(--color-secondary);
}

.sp-card__badge--shophouse {
    background: rgba(34, 197, 94, .9);
    color: #fff;
}

.sp-card__badge--nha-pho {
    background: rgba(168, 85, 247, .9);
    color: #fff;
}

.sp-card__badge--dat-nen {
    background: rgba(249, 115, 22, .9);
    color: #fff;
}

.sp-card__badge--resort {
    background: rgba(20, 184, 166, .9);
    color: #fff;
}

/* Status badges (ACF `badges` Checkbox) */
.sp-card__badge--hot {
    background: #ef4444;
    color: #fff;
}

.sp-card__badge--mo-ban {
    background: #16a34a;
    color: #fff;
}

.sp-card__badge--moi {
    background: #2563eb;
    color: #fff;
}

.sp-card__badge--deal-tot {
    background: #ea580c;
    color: #fff;
}

.sp-card__badge--da-ban {
    background: var(--text-muted);
    color: #fff;
}

/* Badge loại hình — dark semi-transparent (flow in .sp-card__badges) */
.sp-card__badge--type {
    background: rgba(5, 17, 31, .72);
    color: #fff;
    backdrop-filter: blur(6px);
}


/* Image overlay — project name ở bottom của ảnh */
.sp-card__img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 10px;
    background: linear-gradient(to top, rgba(5, 17, 31, .8) 0%, transparent 100%);
    font-size: var(--text-2xs);
    font-weight: 700;
    color: rgba(255, 255, 255, .9);
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
}

/* Fav button */
.sp-card__fav {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .7);
    background: rgba(17, 24, 39, .3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    z-index: 2;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sp-card__fav:hover {
    background: rgba(239, 68, 68, .85);
    border-color: transparent;
}

/* Sold overlay */
.sp-card__sold-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .55);
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    backdrop-filter: blur(2px);
}

/* Body */
.sp-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px 14px 12px;
}

/* Địa chỉ (dia_chi field) dưới title */
.sp-card__addr {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 2px 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-bottom: 6px;
}

.sp-card__pin {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 200, 51, .2);
    flex-shrink: 0;
}

.sp-card__title {
    font-size: var(--text-base);
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-card__title a {
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.sp-card__title a:hover {
    color: var(--color-primary);
}

.sp-card__desc {
    font-size: var(--text-xs);
    line-height: 1.5;
    color: rgba(15, 23, 42, .5);
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Specs row */
.sp-card__specs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.sp-card__spec {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: 700;
    color: rgba(15, 23, 42, .6);
}

.sp-icon {
    flex-shrink: 0;
    color: var(--color-primary);
    /* vàng theo thiết kế */
}

/* Footer */
.sp-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 23, 42, .06);
}

.sp-card__price-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(15, 23, 42, .4);
    margin-bottom: 2px;
}

.sp-card__price-value {
    font-size: var(--text-xl);
    font-weight: var(--weight-black);
    color: var(--color-primary);
    /* vàng nổi bật theo design */
    letter-spacing: -0.02em;
}

/* Thỏa thuận / deal — cũng dùng vàng nhạt theo design */
.sp-card__price-value--deal {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-primary);
    font-style: italic;
}

/* Đã bán — xám muted */
.sp-card__price-value--sold {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-muted);
}

.sp-card__go {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    border: 1px solid rgba(10, 38, 71, .12);
    color: var(--color-secondary);
    background: #fff;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.sp-card__go:hover {
    background: var(--color-accent-light);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* Nút arrow khi đã bán — disabled */
.sp-card--sold .sp-card__go {
    opacity: .4;
    pointer-events: none;
    cursor: default;
}

/* ─── PAGINATION ─────────────────────────────────────────────────────────────── */
.sp-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.sp-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(15, 23, 42, .1);
    color: var(--color-secondary);
    background: #fff;
    transition: all var(--transition-fast);
}

.sp-pagination .page-numbers:hover {
    background: rgba(255, 200, 51, .14);
    border-color: rgba(255, 200, 51, .45);
}

.sp-pagination .page-numbers.current {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
}

.sp-pagination .page-numbers.dots {
    border: 0;
    background: transparent;
    cursor: default;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────────── */
.sp-empty {
    padding: 80px 0;
    text-align: center;
}

.sp-empty__text {
    font-size: var(--text-base);
    color: rgba(15, 23, 42, .5);
    line-height: 1.7;
}

.sp-empty__text a {
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: none;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .sp-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 960px) {
    .sp-layout {
        grid-template-columns: 1fr;
    }

    .sp-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0 20px;
        align-items: start;
    }

    .sp-sidebar__header {
        grid-column: 1 / -1;
    }

    .custom-ad-form-minimal {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .sp-hero {
        padding: 28px 0 32px;
    }

    .sp-hero__title {
        font-size: 1.6rem;
    }

    .sp-sidebar {
        grid-template-columns: 1fr;
    }

    .sp-grid {
        grid-template-columns: 1fr;
    }

    .sp-sortbar {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .sp-hero__search {
        flex-direction: column;
        border-radius: var(--radius-xl);
    }

    .sp-hero__search-input {
        width: 100%;
    }

    .sp-hero__search-btn {
        width: calc(100% - 10px);
        margin: 0 5px 5px;
        text-align: center;
    }
}