/* ============================================================
   CSS dùng chung cho khu vực Showroom (/demo): Showroom.aspx +
   ThemeDetail.aspx. Chỉ chứa các class lặp lại ở cả 2 trang
   (card, chip, nút, feature-grid...) để tránh trùng code.
   ============================================================ */
:root {
    --brand-1: #2563eb;
    --brand-2: #7c3aed;
    --accent: #0f766e;
    --ink: #172033;
    --muted: #5f6b7c;
    --border: #e3e9f2;
    --bg: white;
}
* { box-sizing: border-box; }
html {
    background: var(--bg);
}
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

/* ===================== Lưới thẻ mẫu ===================== */
/* Đúng 4 cột cố định, mỗi cột 1fr (chia đều hết chiều rộng hàng).
   - Đủ 4 mẫu trở lên: 4 card lấp đầy hàng, không còn khoảng trống.
   - Hàng cuối thiếu mẫu: card vẫn nằm đúng trong 1 cột (1fr),
     KHÔNG bị giãn to lấp hết hàng. */
.demo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 1100px) {
    .demo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .demo-grid { grid-template-columns: minmax(0, 1fr); }
}

.demo-card {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid var(--border); border-radius: 18px;
    box-shadow: 0 10px 28px rgba(24, 40, 72, .08);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    overflow: hidden;
}
.demo-card:hover {
    transform: translateY(-4px);
    border-color: #b9cdfb;
    box-shadow: 0 18px 38px rgba(24, 40, 72, .16);
}
.demo-card.is-hidden { display: none; }

/* Ảnh mẫu — viewport 3:4 trừ 50px, hover cuộn xem full giao diện dài */
.demo-card-media {
    position: relative; width: 100%;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    overflow: hidden;
}
.demo-card-media:not(.detail-hero-media) {
    aspect-ratio: unset;
    height: 0;
    padding-bottom: calc(133.333333% - 50px);
}
/* Click avatar → trang mô tả chi tiết (/thems/style/{GROUP}/{VERSION}) */
.demo-card-media:not(.detail-hero-media) .demo-card-avatar-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.demo-card-media:not(.detail-hero-media) .demo-thumb {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; display: block;
    object-fit: cover; object-position: top center;
    transform: translateY(0);
    will-change: transform;
}
.demo-card-media--can-scroll:not(.detail-hero-media) .demo-thumb {
    object-fit: unset;
    min-height: 100%;
}
.demo-card-media--looping .demo-thumb {
    transition: none !important;
}
.demo-card-media:not(.detail-hero-media)::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
    height: 52px;
    background: linear-gradient(to top, rgba(15, 23, 42, .16), transparent);
    pointer-events: none;
    transition: opacity .35s;
}
.demo-card-media--no-scroll::after { display: none; }

/* Vệt sáng lần lượt — mềm/chậm kiểu Maxweb .btn-hover (pxl_btn_shine) */
.demo-card-media:not(.detail-hero-media)::before {
    content: '';
    position: absolute;
    top: 0;
    left: -200%;
    width: 200%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    background-image: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.28),
        transparent
    );
    transform: skewX(-20deg);
    opacity: 0;
    will-change: left, opacity;
}
.demo-card-media:not(.detail-hero-media).is-shine::before {
    opacity: 1;
    animation: demoCardShineSweep 1.6s ease 0.08s 1 forwards;
}
@keyframes demoCardShineSweep {
    0% { left: -200%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 200%; opacity: 0; }
}
/* Preview video/poster — phủ kín khung card (khác ảnh dài cuộn hover) */
.demo-card-media--video-preview:not(.detail-hero-media) .demo-thumb-video-poster {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
    transform: translate(-50%, -50%);
    will-change: auto;
}
.demo-card-media--video-preview:not(.detail-hero-media) .demo-thumb-video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center center;
    transform: none !important;
    will-change: auto;
}
.demo-card-media--video-preview:not(.detail-hero-media) {
    background: #0f172a;
}
.detail-hero-media.demo-card-media--video-preview .demo-thumb-video-poster {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
    transform: translate(-50%, -50%);
}
.detail-hero-media.demo-card-media--video-preview .demo-thumb-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transform: none !important;
}
.demo-card:hover .demo-card-media:not(.detail-hero-media)::after,
.demo-card:focus-within .demo-card-media:not(.detail-hero-media)::after {
    opacity: 0;
}
/* Trang chi tiết — ảnh hero trong browser frame (cuộn hover như Showroom) */
.detail-hero-media:not(.detail-browser-viewport) {
    aspect-ratio: 9 / 16;
    max-width: 320px; margin: 0 auto;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(24, 40, 72, .14);
}
.detail-hero-media:not(.detail-browser-viewport) .demo-thumb {
    width: 100%; height: 100%;
    object-fit: cover; object-position: top center;
    transform: none !important;
    transition: none !important;
}
.demo-thumb { display: block; }
.demo-icon-fallback {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 40px; font-weight: 800; color: #c7d2fe;
}
.demo-version-chip {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--brand-1);
    background: rgba(255,255,255,.95); border-radius: 999px; padding: 5px 12px; white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
    pointer-events: none;
}
.demo-group-chip {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #fff;
    background: rgba(23, 32, 51, .65); border-radius: 999px; padding: 5px 12px; white-space: nowrap;
    pointer-events: none;
}
.demo-video-badge {
    position: absolute; right: 10px; bottom: 10px; z-index: 4;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(15, 23, 42, .72); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; text-decoration: none; cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,.22); transition: .15s;
}
.demo-video-badge:hover { background: var(--brand-1); transform: scale(1.06); }

/* Tiêu đề mẫu — overlay đáy ảnh (gradient đen + chữ trắng, kiểu SHOP)
   chừa cột phải cho icon video (~40px) để thẳng hàng 1 dòng với tên */
.demo-card-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 36px 44px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .42) 55%, transparent 100%);
    pointer-events: none;
}
.demo-card-title-overlay .demo-title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.demo-card-body {
    display: flex; flex-direction: column;
    padding: 12px 14px 14px; flex: 1;
    min-height: 0;
    justify-content: flex-end;
}
.demo-card-row {
    --demo-card-ctrl-h: 25px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-width: 0;
    margin-top: auto;
}
.demo-theme-code {
    box-sizing: border-box;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--demo-card-ctrl-h) !important;
    min-height: var(--demo-card-ctrl-h) !important;
    max-height: var(--demo-card-ctrl-h) !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--brand-1);
    background: #eef2ff;
    border: 0 !important;
    box-shadow: inset 0 0 0 1px #c7d2fe; /* viền không làm nhỏ chiều cao */
    border-radius: 999px;
    padding: 0 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
}
.demo-title {
    margin: 0; font-size: 15px; font-weight: 800; line-height: 1.35;
    color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.demo-card-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.demo-price-row { flex: 1; min-width: 0; line-height: 1.2; }
.demo-price-text {
    font-size: 18px; font-weight: 800; color: #b45309; letter-spacing: -.01em;
}
.demo-price-text--muted { font-size: 14px; font-weight: 700; color: var(--muted); }

/* Pill hotline trên card — gọn, bo tròn icon + số */
.demo-price-hotline {
    display: inline-flex; align-items: center; gap: 6px;
    max-width: 100%;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff; font-weight: 700; font-size: 12.5px;
    padding: 4px 11px 4px 4px; border-radius: 999px;
    text-decoration: none; transition: opacity .15s, transform .15s;
}
.demo-price-hotline:hover { opacity: .94; transform: translateY(-1px); }
.demo-price-hotline-num { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.demo-price-hotline .demo-phone-icon {
    width: 28px; height: 28px;
    background: rgba(255, 255, 255, .22);
    animation: none;
}
.demo-price-hotline .demo-phone-icon svg { width: 13px; height: 13px; }

/* Nút card — cùng chiều cao tuyệt đối với mã mẫu (28px, cùng box-model border) */
.demo-card-actions {
    display: flex; flex-shrink: 0; align-items: center; gap: 6px;
    height: var(--demo-card-ctrl-h);
}
.demo-btn {
    box-sizing: border-box;
    font-family: inherit; cursor: pointer;
    border: 0;
    text-decoration: none; transition: filter .15s, background .15s, box-shadow .15s;
}
.demo-card-row .demo-btn-demo {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    height: var(--demo-card-ctrl-h) !important;
    min-height: var(--demo-card-ctrl-h) !important;
    max-height: var(--demo-card-ctrl-h) !important;
    padding: 0 10px 0 8px !important;
    border: 0 !important;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    color: #fff; font-size: 10px; font-weight: 700; white-space: nowrap;
    line-height: 1;
    overflow: hidden;
    letter-spacing: -.01em;
}
.demo-card-row .demo-btn-demo:hover { filter: brightness(1.06); }
.demo-btn-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; flex: none;
}
.demo-btn-ico svg { width: 13px; height: 13px; display: block; }
.demo-card-row .demo-btn-square {
    display: inline-flex; align-items: center; justify-content: center;
    box-sizing: border-box;
    width: var(--demo-card-ctrl-h) !important;
    height: var(--demo-card-ctrl-h) !important;
    min-width: var(--demo-card-ctrl-h) !important;
    min-height: var(--demo-card-ctrl-h) !important;
    max-width: var(--demo-card-ctrl-h) !important;
    max-height: var(--demo-card-ctrl-h) !important;
    flex: none;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--brand-1);
    border: 0 !important;
    box-shadow: inset 0 0 0 1px #e2e8f0;
    padding: 0 !important;
    line-height: 1;
    overflow: hidden;
}
.demo-btn-square svg { width: 14px; height: 14px; display: block; }
.demo-card-row .demo-btn-square:hover {
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px #c7d2fe;
}

/* Nút dùng chung trang chi tiết */
.demo-btn-outline {
    flex: 1; text-align: center; border-radius: 10px; padding: 10px 14px;
    font-size: 13.5px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.demo-btn-outline { background: #fff; color: var(--brand-1); border: 1.5px solid #dbe4fd; }
.demo-btn-outline:hover { background: #eef2ff; }
.demo-btn-solid {
    flex: 1; text-align: center; border-radius: 10px; padding: 10px 14px;
    font-size: 13.5px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.demo-btn-solid { background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff; }
.demo-btn-solid:hover { filter: brightness(1.06); }

.demo-price-hotline-icon,
.demo-phone-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex: none;
    background: rgba(255, 255, 255, .28); color: #fff; border-radius: 50%;
}
.demo-price-hotline-icon svg,
.demo-phone-icon svg { width: 14px; height: 14px; display: block; }
@keyframes priceHotlinePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); }
    70% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.demo-empty {
    padding: 32px; background: #fff; border: 1px dashed #b9c5d6; border-radius: 16px;
    color: var(--muted); text-align: center;
}
.demo-footnote { margin-top: 28px; text-align: center; font-size: 12.5px; color: #94a1b5; }

/* ===================== Trust row (Demo chạy thật, Responsive...) ===================== */
.demo-trust-row {
    display: flex; flex-wrap: wrap; gap: 20px;
    font-size: 13px; font-weight: 600;
}
.demo-trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.demo-trust-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex: none; }

/* ===================== Nút nổi "Tư vấn ngay" ===================== */
.demo-float-consult {
    position: fixed; right: 22px; bottom: 22px; z-index: 900;
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff;
    border-radius: 999px; padding: 14px 22px; font-size: 14px; font-weight: 800;
    text-decoration: none; box-shadow: 0 12px 28px rgba(37, 99, 235, .35);
    animation: demoPulse 2.4s infinite;
}
@keyframes demoPulse {
    0%, 100% { box-shadow: 0 12px 28px rgba(37, 99, 235, .35); }
    50% { box-shadow: 0 12px 28px rgba(37, 99, 235, .6); }
}

/* ===================== Lưới "Tính năng nổi bật" (từ ContentBlocks) ===================== */
.demo-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.demo-feature-card {
    border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center;
    background: #f8fafc;
}
.demo-feature-icon { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; margin: 0 auto 8px; display: block; }
.demo-feature-icon-fallback {
    width: 44px; height: 44px; border-radius: 50%; background: #dcfce7; color: #16a34a;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-size: 18px; font-weight: 800;
}
.demo-feature-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.demo-feature-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ===================== Lưới thư viện ảnh (Gallery, mở lightbox Fancybox) ===================== */
.demo-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.demo-gallery-grid a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.demo-gallery-grid img { width: 100%; height: 100%; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
    .demo-card-media:not(.detail-hero-media) .demo-thumb {
        transition: none !important;
        transform: none !important;
    }
    .demo-card-media:not(.detail-hero-media)::before,
    .demo-card-media:not(.detail-hero-media).is-shine::before {
        display: none !important;
        animation: none !important;
    }
}

@media (max-width: 560px) {
    .demo-card-row { gap: 6px; }
    .demo-card-title-overlay { padding: 28px 40px 10px 10px; }
    .demo-card-title-overlay .demo-title { font-size: 13px; }
    .demo-video-badge { width: 28px; height: 28px; bottom: 9px; right: 9px; font-size: 10px; }
    .demo-card-row { --demo-card-ctrl-h: 25px; }
    .demo-btn-demo { padding: 0 10px 0 8px; font-size: 10.5px; }
    .demo-float-consult { right: 14px; bottom: 14px; padding: 12px 18px; font-size: 13px; }
}
