/* ==========================================================
   DESIGN SYSTEM V3 — Centralized Design Tokens
   ==========================================================
   Import this file FIRST in every HTML page.
   All components reference these tokens via var().
   ========================================================== */

:root {
    /* ── Brand ── */
    --color-primary: #d0bd95;
    --color-primary-dark: #a68b5a;
    --color-primary-bright: #e8d5b0;
    --color-primary-focus: #c4aa77;
    --color-on-primary: #1d1d1f;
    --color-primary-rgb: 208, 189, 149;

    /* ── Surfaces ── */
    --color-canvas: #ffffff;
    --color-parchment: #f5f5f7;
    --color-pearl: #fafafc;
    --color-tile-dark: #1d1d1f;
    --color-tile-dark-2: #2a2a2c;
    --color-black: #000000;
    --color-chip-translucent: rgba(210, 210, 215, 0.64);

    /* ── Text ── */
    --color-ink: #1d1d1f;
    --color-ink-on-dark: #ffffff;
    --color-ink-muted: #7a7a7a;
    --color-ink-secondary: #86868b;

    /* ── Borders ── */
    --color-hairline: #e0e0e0;
    --color-divider: rgba(0, 0, 0, 0.04);

    /* ── Functional ── */
    --color-success: #2ecc71;
    --color-danger: #ff3b30;
    --color-warning: #ff9500;
    --color-info: #5ac8fa;

    /* ── Spacing (8px base) ── */
    --space-xxs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 17px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;
    --space-section: 80px;

    /* ── Border Radius ── */
    --radius-xs: 5px;
    --radius-sm: 8px;
    --radius-md: 11px;
    --radius-lg: 18px;
    --radius-pill: 9999px;

    /* ── Typography ── */
    --font-display: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

    /* ── Shadows ── */
    --shadow-product: 3px 5px 30px 0 rgba(0, 0, 0, 0.22);
    --shadow-card-subtle: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-dropdown: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-floating: 0 4px 24px rgba(0, 0, 0, 0.08);

    /* ── Z-Index Architecture ── */
    --z-canvas: 100;
    --z-screen: 200;
    --z-overlay: 300;
    --z-controls: 310;
    --z-dock: 320;
    --z-sidebar-overlay: 390;
    --z-sidebar: 400;
    --z-modal: 500;
    --z-notification: 1000;
    --z-tooltip: 2000;
    --z-max: 9999;

    /* ── Transitions ── */
    --ease-spring: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-smooth: cubic-bezier(0.25, 0.8, 0.25, 1);

    /* ── Component Sizes ── */
    --nav-height: 44px;
    --subnav-height: 52px;
    --touch-target: 44px;
}

/* ==========================================================
   BASE TYPOGRAPHY
   ========================================================== */

body,
html,
button,
input,
textarea,
select {
    font-family: var(--font-body);
}

body {
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.374px;
    color: var(--color-ink);
    background-color: var(--color-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography Utility Classes ── */

.text-hero {
    font-size: 56px;
    font-weight: 600;
    line-height: 1.07;
    letter-spacing: -0.28px;
}

.text-display-lg {
    font-size: 40px;
    font-weight: 600;
    line-height: 1.10;
    letter-spacing: 0;
}

.text-display-md {
    font-size: 34px;
    font-weight: 600;
    line-height: 1.47;
    letter-spacing: -0.374px;
}

.text-lead {
    font-size: 28px;
    font-weight: 400;
    line-height: 1.14;
    letter-spacing: 0.196px;
}

.text-tagline {
    font-size: 21px;
    font-weight: 600;
    line-height: 1.19;
    letter-spacing: 0.231px;
}

.text-body-strong {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.24;
    letter-spacing: -0.374px;
}

.text-body {
    font-size: 17px;
    font-weight: 400;
    line-height: 1.47;
    letter-spacing: -0.374px;
}

.text-caption {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.43;
    letter-spacing: -0.224px;
}

.text-caption-strong {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.29;
    letter-spacing: -0.224px;
}

.text-nav {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.0;
    letter-spacing: -0.12px;
}

.text-fine-print {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.0;
    letter-spacing: -0.12px;
    color: var(--color-ink-muted);
}

/* ── Button Base ── */

.btn-primary-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring);
    text-decoration: none;
}

.btn-primary-pill:active {
    transform: scale(0.95);
}

.btn-secondary-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    background: transparent;
    color: var(--color-primary-dark);
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring);
    text-decoration: none;
}

.btn-secondary-pill:active {
    transform: scale(0.95);
}

.btn-dark-utility {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    background: var(--color-ink);
    color: var(--color-ink-on-dark);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.224px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring);
}

.btn-dark-utility:active {
    transform: scale(0.95);
}

.btn-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target);
    height: var(--touch-target);
    border-radius: 50%;
    background: var(--color-chip-translucent);
    color: var(--color-ink);
    border: none;
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring);
}

.btn-icon-circle:active {
    transform: scale(0.95);
}

/* ── Card Base ── */

.card-utility {
    background: var(--color-canvas);
    border: 1px solid var(--color-hairline);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: border-color 0.3s ease;
}

.card-utility:hover {
    border-color: var(--color-primary);
}

/* ── Link ── */

.link-primary {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.link-primary:hover {
    text-decoration: underline;
}

.link-primary-on-dark {
    color: var(--color-primary-bright);
    text-decoration: none;
}

/* ── Responsive Typography ── */

@media (max-width: 1068px) {
    .text-hero {
        font-size: 40px;
    }
}

@media (max-width: 640px) {
    .text-hero {
        font-size: 34px;
    }
    .text-display-lg {
        font-size: 28px;
    }
    .text-lead {
        font-size: 21px;
    }
}

@media (max-width: 419px) {
    .text-hero {
        font-size: 28px;
    }
    .text-display-lg {
        font-size: 24px;
    }
}

/* ── Inline CSS Replacements (Phase 2) ── */
.d-none { display: none !important; }
.d-none-important { display: none !important; }
.d-flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 2px; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }

.pe-none { pointer-events: none; }
.pe-auto { pointer-events: auto; }

.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-24 { font-size: 24px; }

.fw-bold { font-weight: bold; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.z-1 { z-index: 1; }
.z-2 { z-index: 2; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-100 { z-index: 100; }
.z-999 { z-index: 999; }
.z-9999 { z-index: 9999; }

.pos-rel { position: relative; }
.pos-abs { position: absolute; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-auto { bottom: auto; }
.top-50 { top: 50%; }
.left-50 { left: 50%; }
.translate-middle { transform: translate(-50%, -50%); }

.w-0 { width: 0; }
.h-0 { height: 0; }
.w-100p { width: 100%; }
.h-100p { height: 100%; }

.bg-transparent { background: transparent; }
.bg-glass-dark { background: var(--glass-dark-bg, rgba(0,0,0,0.8)); }

.border-none { border: none; }
.outline-none { outline: none; }
.shadow-none { box-shadow: none; text-shadow: none; }
.cursor-pointer { cursor: pointer; }

/* Modal and Search Bar Actions Group (Replaces old absolute positions) */
.search-action-group { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; z-index: 10; }
.btn-search-action-in-group { background: transparent; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: none; cursor: pointer; transition: background 0.2s ease; }
.btn-search-action-in-group:hover { background: rgba(255,255,255,0.1); }
.search-input-pr { padding-right: 96px !important; }
.suggestions-dropdown-pos { top: 100%; left: 0; width: 100%; margin-top: 5px; z-index: 9999; }

.vr-wheel-rotator-container { position: absolute; top: 50%; left: 50%; width: 0; height: 0; z-index: 1; }
.vr-wheel-rotator-inner { position: absolute; top: 0; left: 0; width: 0; height: 0; }
.vr-context-panel { position: absolute; right: -2px; top: 0px; z-index: 999; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; margin: 0; bottom: auto; transform-origin: calc(100% - 26px) 24px; transition: transform 0s, opacity 0.3s, scale 0.3s; }
.vr-main-anchor-btn { margin-top: -24px; margin-left: -24px; width: 48px; height: 48px; position: absolute; top: 50%; left: 50%; z-index: 2; }

.modal-fullscreen-bg { padding:0; margin:0; width:100vw; height:100dvh; max-width:100vw; border-radius: 0; overflow:hidden; background: var(--color-canvas, #ffffff); backdrop-filter: none; border: none; box-shadow: none; }
.modal-close-tr { position: absolute; top: calc(15px + env(safe-area-inset-top)); right: calc(25px + env(safe-area-inset-right)); z-index: 100; }
.iframe-fullscreen { width: 100%; height: 100%; border: none; border-radius: 0; }

.btn-icon-clear { background: transparent; color: #475569; border: none; outline: none; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; box-shadow: none; text-shadow: none; }
.btn-icon-clear-gold { background: transparent; color: #d0bd95; border: none; outline: none; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: none; text-shadow: none; }

html.light-theme .vr-controls-vertical-transparent,
html.dark-theme .vr-controls-vertical-transparent,
.vr-controls-vertical-transparent { padding: 0 !important; display: block !important; background: transparent !important; border: none !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; width: 48px !important; height: 48px !important; position: absolute !important; }

.matbang-opacity-val { color: #475569; font-size: 13px; font-weight: bold; width: 34px; text-align: left; text-shadow: none; }
.matbang-range { cursor: pointer; accent-color: #d0bd95; width: 100px; }
.btn-clear-search-sidebar { display: none; right: 12px; border: none; background: transparent; cursor: pointer; padding: 5px; border-radius: 50%; align-items: center; justify-content: center; position: absolute; top: 50%; transform: translateY(-50%); }

.p-0 { padding: 0; }
.zalo-icon-img { width: 20px; height: 20px; object-fit: contain; margin: auto; pointer-events: none; }
.text-white-important { color: #ffffff !important; }
.divider-v { width: 1px; height: 20px; background: rgba(0,0,0,0.1); margin: 0 4px; }

.btn-shuffle-grid { display:none; position:absolute; top:12px; left:12px; z-index:20; background:rgba(0,0,0,0.5); border:1px solid rgba(255,255,255,0.2); border-radius:50%; width:36px; height:36px; color:#fff; cursor:pointer; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
.render-overlay-msg { display:none; position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); background:rgba(0,0,0,0.7); padding:8px 16px; border-radius:8px; color:#fff; font-weight:600; font-size:14px; pointer-events:none; z-index:10; white-space:nowrap; }

.flex-row-between-start-10 { display:flex !important; flex-direction:row !important; justify-content:space-between !important; align-items:flex-start !important; gap:10px !important; }
.flex-col-start-2-flex-1 { display:flex !important; flex-direction:column !important; gap:2px !important; flex:1 !important; flex-basis:0 !important; min-width:0 !important; justify-content:flex-start !important; }
.flex-row-center-8 { display:flex !important; flex-direction:row !important; align-items:center !important; gap:8px !important; }
.text-truncate { white-space:nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important; }
.v4-pill-ppm-override { margin: 0 !important; padding: 2px 8px !important; flex-shrink: 0 !important; }

.price-history-mini-chart { width: 100%; height: 28px; margin-top: 4px; cursor: pointer; position: relative; }
.price-history-svg-container { width: 100%; height: 120px; position: relative; }

/* UI Refactoring Utilities Phase 2 */
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.z-max { z-index: 2147483647; }
.pos-abs { position: absolute; }
.text-accent-blue { color: #00BFFF; }
.modal-content-large { max-width: 90%; height: 80vh; display: flex; flex-direction: column; }
.flex-row-between { display: flex; align-items: center; justify-content: space-between; }
.icon-lg { font-size: 20px; }

/* Product Chat Component */
.product-chat-panel-container { position: fixed; z-index: 2147483647 !important; bottom: 15px; right: 15px; box-sizing: border-box !important; width: 380px !important; max-width: calc(100vw - 30px); height: 560px !important; max-height: 85vh; display: flex !important; flex-direction: column; overflow: hidden; border-radius: 16px; box-shadow: 0 15px 50px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); background: rgb(23, 23, 23); }
.pc-header-container { padding: 16px 20px; border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08)); background: transparent; display: flex; justify-content: space-between; align-items: center; }
.pc-header-title-text { margin: 0; font-size: 16px; font-weight: 700; color: var(--gold-primary, #d0a064); }
.pc-live-viewers-text { font-size: 12px; font-weight: 500; color: #10b981; display:flex; align-items: center; gap: 5px; margin-top: 3px; }
.pc-close-btn { cursor: pointer; color: var(--text-muted, #666); transition: 0.2s; }
.pc-close-btn:hover { color: #ef4444 !important; }
.pc-body-container { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; background: transparent; }
.pc-footer-container { padding: 14px 20px; border-top: 1px solid var(--border-color, rgba(255,255,255,0.08)); background: transparent; display: flex; gap: 10px; align-items: center; }
.pc-chat-input-field { flex: 1; background: var(--glass-input-bg, rgba(0,0,0,0.04)); border: 1px solid var(--border-color, rgba(0,0,0,0.1)); border-radius: 20px; padding: 12px 18px; color: #fff; caret-color: var(--gold-primary, #d0a064); outline: none; font-size: 14px; transition: height 0.1s, box-shadow 0.2s; resize: none; overflow: hidden; line-height: 1.4; max-height: 120px; font-family: inherit; }
.pc-chat-input-field:focus { box-shadow: 0 0 0 2px var(--gold-primary, #d0a064); }
.pc-btn-send-circle { background: var(--gold-primary, #d0a064); color: #fff; border: none; border-radius: 50%; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 12px rgba(208,160,100,0.3); }

/* Spacing and Flex Utilities */

/* Spacing and Flex Utilities */
.m-0 { margin: 0; }
.mb-20 { margin-bottom: 20px; }
.flex-1 { flex: 1; }
.overflow-y-auto { overflow-y: auto; }
.left-12 { left: 12px; }
.search-box-wrapper { display: flex; align-items: center; flex: 1; max-width: 400px; position: relative; }

/* Visibility Overrides */
.d-none, .d-none-important, .product-chat-panel-container.d-none { display: none !important; }
