/**
 * san-pham-single.css
 * Styles cho trang chi tiết sản phẩm (single-san_pham.php)
 *
 * Sử dụng CSS variables từ base.css
 */

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE WRAPPER — top padding để gallery không sát header nav
   ═══════════════════════════════════════════════════════════════════════════ */

.single-san_pham .container {
    padding-top: 28px;
    padding-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GALLERY HERO
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Gallery wrapper: Flex → height cố định, stretch tự động ── */
.sp-gallery {
    display: flex;
    height: 480px;
    gap: 8px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 28px;
}

/* ─── Ảnh lớn trái: flex-basis ~58% ─────────────────────────── */
.sp-gallery__main {
    flex: 3 0 0;
    min-width: 0;
    position: relative;
    overflow: hidden;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: #e5e7eb;
    display: block;
    /* Radius xử lý bởi parent overflow:hidden */
}

/* ─── Thumbs bên phải: flex chiếm phần còn lại ─────────────── */
.sp-gallery__thumbs {
    flex: 2 0 0;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    /* Không cần height:100% — flex parent stretch tự động → fr resolve đúng */
}

.sp-gallery__thumb {
    position: relative;
    overflow: hidden;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: #e5e7eb;
    display: block;
}

/* ─── Ảnh fill container ─────────────────────────────────────── */
.sp-gallery__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.sp-gallery__main:hover .sp-gallery__img,
.sp-gallery__thumb:hover .sp-gallery__img {
    transform: scale(1.05);
}

/* ─── +N ảnh overlay ─────────────────────────────────────────── */
.sp-gallery__more-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 30, 55, .48);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .03em;
    backdrop-filter: blur(2px);
    pointer-events: none;
    gap: 4px;
}

/* ─── Tablet (≤ 900px) ───────────────────────────────────────── */
@media (max-width: 900px) {
    .sp-gallery {
        height: 360px;
        border-radius: 10px;
        gap: 6px;
    }

    .sp-gallery__thumbs {
        gap: 6px;
    }
}

/* ─── Mobile (≤ 560px): chỉ hiện ảnh lớn ──────────────────── */
@media (max-width: 560px) {
    .sp-gallery {
        height: 240px;
        border-radius: 8px;
    }

    .sp-gallery__thumbs {
        display: none;
    }

    .sp-gallery__main {
        flex: 1;
    }
}



/* ═══════════════════════════════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 17, 31, .96);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.sp-lightbox[hidden] {
    display: none;
}

body.sp-lightbox-open {
    overflow: hidden;
}

.sp-lightbox__viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 80px 40px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.sp-lightbox__img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
}

.sp-lightbox__close,
.sp-lightbox__prev,
.sp-lightbox__next {
    position: fixed;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    z-index: 1;
}

.sp-lightbox__close:hover,
.sp-lightbox__prev:hover,
.sp-lightbox__next:hover {
    background: rgba(255, 255, 255, .22);
}

.sp-lightbox__close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
}

.sp-lightbox__prev {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

.sp-lightbox__next {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

.sp-lightbox__counter {
    color: rgba(255, 255, 255, .7);
    font-size: var(--text-sm);
    font-weight: 700;
    padding-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SINGLE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-single-header {
    padding: 24px 0 20px;
    border-bottom: 1px solid rgba(10, 38, 71, .08);
    margin-bottom: 28px;
}

/* Breadcrumb — reuse from archive */
.sp-bc {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.sp-bc__link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.sp-bc__link:hover {
    color: var(--color-secondary);
}

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

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

/* Header badges */
.sp-header__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.sp-header__badge {
    font-size: var(--text-2xs);
    font-weight: 800;
    letter-spacing: .04em;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-secondary);
}

.sp-header__badge--type {
    background: var(--color-secondary);
    color: #fff;
}

.sp-header__badge--hot {
    background: #ef4444;
    color: #fff;
}

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

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

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

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

/* Title */
.sp-header__title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: var(--weight-black);
    color: var(--color-secondary);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 10px;
}

/* Meta: dự án + địa chỉ + giá */
.sp-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.sp-header__proj {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.sp-header__proj svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.sp-header__addr {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.sp-header__price {
    font-size: var(--text-xl);
    font-weight: var(--weight-black);
    color: var(--color-primary);
    letter-spacing: -0.02em;
    margin-left: auto;
}

.sp-header__price--sold {
    color: var(--text-muted);
    font-size: var(--text-base);
}

/* Specs bar */
.sp-specs-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 1px solid rgba(10, 38, 71, .1);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: #fff;
    width: 100%;
}

.sp-spec {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-right: 1px solid rgba(10, 38, 71, .07);
    border-bottom: 1px solid rgba(10, 38, 71, .07);
    overflow: hidden;
}

/* Xóa border phải cột cuối (3, 6) */
.sp-spec:nth-child(3n) {
    border-right: 0;
}

/* Xóa border dưới hàng cuối */
.sp-spec:nth-last-child(-n+3) {
    border-bottom: 0;
}

.sp-spec__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

.sp-spec__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sp-spec__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.sp-spec__value {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .sp-specs-bar {
        grid-template-columns: repeat(2, 1fr);
        border-radius: var(--radius-lg);
    }

    .sp-spec:nth-child(3n) {
        border-right: 1px solid rgba(10, 38, 71, .07);
    }

    .sp-spec:nth-child(2n) {
        border-right: 0;
    }

    .sp-spec:nth-last-child(-n+2) {
        border-bottom: 0;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   TWO-COLUMN LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-single-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
    padding-bottom: 64px;
}

.sp-single-main {
    min-width: 0;
}

.sp-single-sidebar {
    position: sticky;
    top: 90px;
}

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

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

    .sp-single-sidebar {
        position: static;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS (shared)
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-section {
    padding: 32px 0;
    border-bottom: 1px solid rgba(10, 38, 71, .07);
}

.sp-section:last-child {
    border-bottom: 0;
}

.sp-section__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--text-lg);
    font-weight: var(--weight-black);
    color: var(--color-secondary);
    letter-spacing: -0.01em;
    margin: 0 0 20px;
}

.sp-section__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Description */
.sp-desc__content {
    font-size: var(--text-sm);
    line-height: 1.8;
    color: rgba(10, 38, 71, .75);
}

.sp-desc__content p {
    margin: 0 0 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AMENITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-amenities__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.sp-amenities__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    color: var(--color-secondary);
    font-weight: 600;
    transition: background var(--transition-fast);
}

.sp-amenities__item:hover {
    background: rgba(255, 200, 51, .14);
}

.sp-amenities__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLOOR PLAN
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-floorplan__figure {
    margin: 0;
    text-align: center;
}

.sp-floorplan__img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: 0 6px 24px rgba(10, 38, 71, .1);
}

.sp-floorplan__caption {
    margin-top: 10px;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POLICY
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-policy__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sp-policy__card {
    background: var(--color-secondary);
    border-radius: var(--radius-2xl);
    padding: 24px;
    color: #fff;
}

.sp-policy__card-header {
    margin-bottom: 16px;
}

.sp-policy__card-eyebrow {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .6);
    margin-bottom: 8px;
}

.sp-policy__price {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: var(--weight-black);
    color: var(--color-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.sp-policy__unit {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, .55);
    display: block;
    margin-top: 4px;
}

.sp-policy__highlights {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sp-policy__highlight {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, .85);
    line-height: 1.5;
}

.sp-policy__check {
    color: var(--color-primary);
    font-weight: 900;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Bank card */
.sp-policy__card--bank .sp-policy__card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sp-policy__card-icon {
    font-size: 1.5rem;
}

.sp-policy__card-title {
    font-size: var(--text-base);
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.sp-policy__bank-name {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, .65);
    margin: 0;
}

.sp-policy__bank-facts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sp-policy__bank-fact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.sp-policy__bank-fact:last-child {
    border-bottom: 0;
}

.sp-policy__bank-label {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, .6);
    font-weight: 600;
}

.sp-policy__bank-value {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--color-primary);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   VIDEO
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-video__wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-2xl);
    background: var(--color-secondary);
    box-shadow: 0 8px 32px rgba(10, 38, 71, .15);
}

.sp-video__iframe,
.sp-video__wrapper iframe {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR — CONTACT BOX
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-sidebar-sticky {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sp-contact-box {
    background: var(--color-secondary);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(10, 38, 71, .18);
}

.sp-contact-box__header {
    background: rgba(255, 255, 255, .05);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sp-contact-box__eyebrow {
    display: block;
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.sp-contact-box__sub {
    font-size: var(--text-2xs);
    color: rgba(255, 255, 255, .6);
    margin: 0;
}

.sp-contact-box__form {
    padding: 16px 20px;
}

/* CF7 form overrides for dark sidebar */
.sp-contact-box .wpcf7-form input,
.sp-contact-box .wpcf7-form textarea,
.sp-contact-box .wpcf7-form select {
    background: rgba(255, 255, 255, .07) !important;
    border: 1px solid rgba(255, 255, 255, .15) !important;
    color: #fff !important;
    border-radius: var(--radius-lg) !important;
    font-size: var(--text-sm) !important;
    padding: 10px 14px !important;
    width: 100% !important;
    margin-bottom: 10px !important;
    transition: border-color var(--transition-fast) !important;
}

.sp-contact-box .wpcf7-form input::placeholder,
.sp-contact-box .wpcf7-form textarea::placeholder {
    color: rgba(255, 255, 255, .35) !important;
}

.sp-contact-box .wpcf7-form input:focus,
.sp-contact-box .wpcf7-form textarea:focus {
    border-color: var(--color-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(255, 200, 51, .15) !important;
}

.sp-contact-box .wpcf7-form textarea {
    resize: vertical;
    min-height: 80px;
}

.sp-contact-box .wpcf7-form input[type="submit"] {
    background: var(--color-primary) !important;
    color: var(--color-secondary) !important;
    font-weight: var(--weight-black) !important;
    border: 0 !important;
    border-radius: var(--radius-full) !important;
    cursor: pointer !important;
    padding: 12px 0 !important;
    transition: background var(--transition-fast), transform var(--transition-fast) !important;
    letter-spacing: .04em;
}

.sp-contact-box .wpcf7-form input[type="submit"]:hover {
    background: var(--color-primary-hover) !important;
    transform: translateY(-1px) !important;
}

/* Action buttons */
.sp-contact-box__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 20px 20px;
}

.sp-contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 0;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 800;
    text-decoration: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.sp-contact-btn:hover {
    opacity: .88;
    transform: translateY(-1px);
}

.sp-contact-btn--phone {
    background: rgba(255, 255, 255, .1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
}

.sp-contact-btn--zalo {
    background: #0068ff;
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR — RELATED PRODUCTS
   ═══════════════════════════════════════════════════════════════════════════ */

.sp-related {
    background: #fff;
    border: 1px solid rgba(10, 38, 71, .08);
    border-radius: var(--radius-2xl);
    padding: 18px;
    box-shadow: 0 4px 16px rgba(10, 38, 71, .06);
}

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

.sp-related__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-related__item {
    display: flex;
    gap: 12px;
    text-decoration: none;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(10, 38, 71, .06);
    transition: opacity var(--transition-fast);
}

.sp-related__item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.sp-related__item:hover {
    opacity: .82;
}

.sp-related__thumb {
    width: 72px;
    height: 56px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-light);
}

.sp-related__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.sp-related__body {
    flex: 1;
    min-width: 0;
}

.sp-related__name {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-secondary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-related__specs {
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.sp-related__price {
    font-size: var(--text-xs);
    font-weight: var(--weight-black);
    color: var(--color-primary);
}