/* ============================================================
   FILE: index.css (v24 — FULL GỐC + SIDEBAR MỚI)
   ============================================================ */

*{margin:0;padding:0;box-sizing:border-box}

/* ============ GLOBAL FONT ============ */
html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, img, ul, li, 
form, label, input, button, select, textarea, table, tr, td, th, 
b, strong, i, em, small, code, pre {
    font-family: var(--app-font, 'Poppins'), sans-serif !important;
    letter-spacing: normal;
}

i, .fas, .far, .fab, .fa, .fa-solid, .fa-regular, .fa-brands,
[class^="fa-"], [class*=" fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", sans-serif !important;
    font-weight: 900;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    display: inline-block;
}

html{scroll-behavior:smooth; color-scheme: dark light;}

:root,
[data-theme="dark"] {
    --bg: #0a0a0f;
    --bg-2: #12121d;
    --card: #1a1a2e;
    --border: #2d3748;
    --text: #f1f5f9;
    --text-2: #94a3b8;
    
    --primary: #dc2626;
    --primary-rgb: 220, 38, 38;
    --primary-light: #ef4444; 
    --primary-dark: #991b1b;  
    
    --accent: #10b981;        
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #e63946;          
    --input-bg: #0f0f1a;
    --highlight: #fbbf24;     
}

[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-2: #ffffff;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-2: #64748b;
    
    --primary: #dc2626;
    --primary-rgb: 220, 38, 38;
    --primary-light: #ef4444;
    --primary-dark: #b91c1c;
    
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #dc2626;
    --input-bg: #f8fafc;
    --highlight: #f59e0b;
}

body {
    font-family: var(--app-font, 'Poppins'), sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
    transition: background .3s, color .3s, transform .1s ease-out;
    position: relative;
}

/* Hiệu ứng kéo iOS */
.ptr-indicator {
    position: fixed;
    top: -60px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb),0.4);
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.2s;
}

body::before, body::after {
    content: '';
    position: fixed;
    top: 0; bottom: 0;
    width: 6px;
    background: var(--primary);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s;
}
body::before { left: 0; box-shadow: 2px 0 10px var(--primary); }
body::after { right: 0; box-shadow: -2px 0 10px var(--primary); }

body.ptr-horizontal::before, body.ptr-horizontal::after {
    opacity: calc(var(--edge-glow, 0) * 0.8);
}

input, button, select, textarea { color: inherit; }

/* ============ HEADER ============ */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-2);
    height: 70px;
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 2000;
    transition: background .3s;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 15px; }

.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 36px; object-fit: contain; }

.menu-toggle-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    flex-shrink: 0;
}
@media (hover: hover) { .menu-toggle-btn:hover { border-color: var(--primary); } }
.menu-toggle-btn:active { background: var(--primary); border-color: var(--primary); color: #fff; }

.header-theme-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    transition: .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-theme-btn:hover { border-color: var(--primary); color: var(--primary); transform: rotate(20deg); }

/* Nav Links giữa header */
.header-nav-links {
    display: none;
    align-items: center;
    gap: 6px;
    background: var(--input-bg);
    padding: 5px;
    border-radius: 14px;
    border: 1px solid var(--border);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.nav-link-header {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: .2s;
    white-space: nowrap;
}
.nav-link-header:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-link-header.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb),.3);
}
.nav-link-header i { font-size: 13px; }

@media (min-width: 900px) {
    .header-nav-links { display: inline-flex; }
}

/* Nút Auth */
.auth-nav { display: flex; gap: 8px; align-items: center; }
.btn-nav { 
    padding: 8px 16px; border-radius: 10px; font-family: inherit; font-weight: 800; font-size: 13px; 
    cursor: pointer; transition: .3s; border: none; outline: none; text-transform: uppercase;
}
.btn-log-nav { 
    background: var(--primary); 
    color: #fff; 
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2); 
}
.btn-nav:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-nav:active { transform: scale(0.96); }

/* User Pill Dropdown */
.user-menu-container { position: relative; display: flex; align-items: center; }
.user-pill { 
    display: flex; align-items: center; gap: 10px; 
    background: var(--input-bg); padding: 6px 14px; border-radius: 20px; 
    border: 1px solid var(--border); 
    cursor: pointer; transition: 0.2s; 
}
.user-pill:hover { border-color: var(--primary); }
.user-name { font-weight: 700; font-size: 14px; color: var(--text); }

/* Avatar mini */
.user-avatar-mini {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    border: 2px solid var(--border);
}
.user-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

.user-dropdown { 
    position: absolute; top: calc(100% + 10px); right: 0; 
    background: var(--card); border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); 
    border: 1px solid var(--border); width: 260px; padding: 10px; 
    opacity: 0; visibility: hidden; transform: translateY(-10px); 
    transition: 0.3s; z-index: 2001; 
}
.user-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-balance { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; margin-bottom: 10px; background: var(--input-bg); 
    border-radius: 12px; border: 1px solid var(--border); font-size: 13px;
}
.dropdown-balance span { font-size: 11px; font-weight: 900; color: var(--text-2); text-transform: uppercase; }
.dropdown-balance strong { color: var(--text); font-size: 15px; } 

.dropdown-links { display: flex; flex-direction: column; gap: 4px; }
.dropdown-links a, .dropdown-links button { 
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; 
    text-decoration: none; color: var(--text); font-weight: 700; font-size: 13px;
    border-radius: 10px; transition: 0.2s; background: transparent; border: none; 
    width: 100%; text-align: left; cursor: pointer; font-family: inherit;
}
.dropdown-links a:hover, .dropdown-links button:hover { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.dropdown-links a.admin-link { color: var(--danger); font-weight: 800; }
.dropdown-links button.logout-btn { color: var(--danger); font-weight: 800; }
.dropdown-links button.logout-btn:hover { background: rgba(239, 68, 68, 0.1); }

/* ============ CSS XỬ LÝ VNĐ/PRIMOGEMS ============ */
.label-container { display: flex; align-items: center; justify-content: center; min-height: 24px; margin-bottom: 4px; }
.label-gif { display: none !important; }
.label-text { display: inline-block !important; }
body:not([data-theme="dark"]) .label-text { display: none !important; }
body:not([data-theme="dark"]) .label-gif { display: block !important; height: 24px; width: auto; object-fit: contain; border-radius: 4px; }

/* ============================================================
   SIDEBAR MỚI (CHUẨN NO1TASK)
   ============================================================ */
:root { --side-w: 280px; }

.sidebar-menu {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 2500; width: var(--side-w);
    display: flex; flex-direction: column; gap: 12px; padding: 20px 16px;
    background: var(--bg-2); border-right: 1px solid var(--border);
    overflow-y: auto; transform: translateX(-100%); transition: transform 0.3s ease;
}

.sidebar-menu.active { transform: none; box-shadow: 5px 0 25px rgba(0,0,0,0.5); }

.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7);
    z-index: 2499; opacity: 0; visibility: hidden; transition: 0.3s;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* Layout Wrapper (Đẩy nội dung không bị đè) */
@media (min-width: 1025px) {
    .sidebar-menu { transform: none; box-shadow: none; }
    .sidebar-overlay { display: none; }
    .main-content-wrapper {
        margin-left: var(--side-w);
        padding-top: 70px;
        transition: margin-left 0.3s;
    }
}
@media (max-width: 1024px) {
    .main-content-wrapper { padding-top: 70px; }
}

/* Nội dung Sidebar */
.sidebar-brand-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 2px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 800; color: var(--text); text-decoration: none; }
.sidebar-brand img { height: 42px; max-width: 100%; object-fit: contain; }
.sidebar-close { background: transparent; border: none; color: var(--text-2); font-size: 24px; cursor: pointer; }

.sidebar-wallet { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: transparent; border: 1px solid var(--border); border-radius: 12px; }
.sidebar-wallet span { font-size: .76rem; color: var(--accent); font-weight: 650; }
.sidebar-wallet strong { font-size: 1.35rem; color: var(--accent); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
/* Sidebar ví kép: VNĐ | PRY (chỉ gif, không chữ) */
.sidebar-wallet.sidebar-wallet-dual { flex-direction: row; align-items: stretch; justify-content: space-between; gap: 10px; }
.sidebar-wallet-dual .sw-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.sidebar-wallet-dual .sw-gif { height: 28px; width: auto; max-width: 100%; object-fit: contain; border-radius: 4px; display: block; }
.sidebar-wallet-dual strong { font-size: .92rem; font-weight: 900; font-family: 'Courier New', monospace; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sidebar-wallet-dual .sw-vnd { color: #10b981; }
.sidebar-wallet-dual .sw-pry { color: #0ea5e9; }
.sidebar-wallet-dual .sw-divider { width: 1px; background: var(--border); margin: 2px 0; }

.ltn-side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; }
.ltn-side-avatar { position: relative; flex: none; width: 38px; height: 38px; border-radius: 10px; overflow: hidden; background: rgba(var(--primary-rgb),0.15); color: var(--primary); display: grid; place-items: center; font-weight: 750; }
.ltn-side-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ltn-side-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ltn-side-id strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; color: var(--text); }
.ltn-side-id small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: .76rem; text-transform: capitalize; }
.ltn-side-logout { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; transition: .2s; }
.ltn-side-logout:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

.sidebar-nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; margin-right: -4px; }
.sidebar-nav-list::-webkit-scrollbar { width: 4px; }
.sidebar-nav-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-link { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; font-size: .92rem; text-align: left; transition: background .15s, color .15s; text-decoration: none; }
.nav-link > span { display: inline-flex; align-items: center; gap: 10px; }
.nav-link svg, .nav-link i { flex: none; opacity: .85; width: 18px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-link.active { background: rgba(var(--primary-rgb),0.15); color: var(--primary); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-toggle { justify-content: space-between; }
.nav-group-caret { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; transition: transform 0.2s ease; transform: rotate(180deg); color: var(--text-2); background: transparent; border: none; cursor: pointer; }
.nav-group.is-open .nav-group-caret { transform: none; }
.nav-group-caret:hover { background: var(--border); }

.nav-sub { display: none; margin: 2px 0 6px 20px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-group.is-open .nav-sub { display: flex; flex-direction: column; gap: 1px; }
.nav-sub-link { display: flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-size: .88rem; font-weight: 550; text-decoration: none; transition: .15s; }
.nav-sub-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-sub-link.active { color: var(--primary); background: rgba(var(--primary-rgb),0.1); font-weight: 650; }

.side-theme { margin-top: 4px; padding-top: 4px; padding-bottom: 6px; border-top: none; }
.side-theme-label { display: block; margin-bottom: 6px; padding-left: 4px; font-size: .68rem; letter-spacing: .08em; color: var(--text-2); font-weight: 700; }
.side-theme-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--input-bg); border-radius: 10px; }
.side-theme-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: .82rem; font-weight: 600; cursor: pointer; transition: .2s; }
.side-theme-seg button:hover { color: var(--text); }
.side-theme-seg button.active { background: var(--card); color: var(--text); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

/* ============ SECTION & SEARCH ============ */
.section { padding: 20px 20px 30px; max-width: 1200px; margin: 0 auto; }
.section-title-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.section-title-bar h2 { font-size: 22px; color: var(--text); border-bottom: 3px solid var(--primary); padding-bottom: 5px; display: inline-flex; align-items: center; gap: 10px; }
.title-search-box { position: relative; flex: 1; max-width: 380px; min-width: 160px; }
.search-input { width: 100%; padding: 10px 40px 10px 40px; background: var(--card); border: 1.5px solid var(--border); color: var(--text); border-radius: 14px; font-family: inherit; font-size: 13px; outline: none; transition: .2s; }
.search-input:focus { border-color: var(--primary); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--primary); pointer-events: none; }
.search-clear-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: rgba(239,68,68,.15); border: none; color: var(--danger); cursor: pointer; display: none; align-items: center; justify-content: center; }
.search-clear-btn.show { display: flex; }

/* ============ TOOLBAR ============ */
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.category-dropdown-wrapper { position: relative; z-index: 100; }
.category-dropdown-btn { display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; background: var(--card); border: 1.5px solid var(--border); color: var(--text); border-radius: 14px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-width: 200px; max-width: calc(100vw - 40px); transition: .25s; }
.category-dropdown-btn:hover { border-color: var(--primary); }
.category-dropdown-btn > i.fa-filter { color: var(--primary); }
.dropdown-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-arrow { color: var(--text-2); transition: .3s; }
.category-dropdown-btn.active .dropdown-arrow { transform: rotate(180deg); color: var(--primary); }
.category-dropdown-menu { position: absolute; top: calc(100% + 8px); left: 0; width: max-content; min-width: 240px; max-width: calc(100vw - 40px); background: var(--card); border: 1.5px solid var(--primary); border-radius: 14px; padding: 8px; box-shadow: 0 15px 40px rgba(0,0,0,.4); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: .25s; z-index: 500; max-height: 60vh; overflow-y: auto; }
.category-dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.category-dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; color: var(--text-2); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; background: transparent; border: none; width: 100%; text-align: left; }
.category-dropdown-item:hover { background: var(--input-bg); color: var(--text); }
.category-dropdown-item.selected { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.item-check { width: 16px; font-size: 12px; opacity: 0; }
.category-dropdown-item.selected .item-check { opacity: 1; }
.item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.item-count { font-size: 11px; background: rgba(255,255,255,.1); padding: 2px 8px; border-radius: 10px; font-weight: 600; min-width: 24px; text-align: center; }
.category-dropdown-item.selected .item-count { background: rgba(255,255,255,.2); }

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 6px 10px; }
.pagination-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border: none; color: #fff; font-size: 14px; cursor: pointer; }
.pagination-btn:hover:not(:disabled) { transform: translateY(-2px); }
.pagination-btn:disabled { opacity: .35; cursor: not-allowed; background: var(--input-bg); }
.pagination-info { padding: 0 12px; font-size: 13px; font-weight: 700; color: var(--text); min-width: 80px; height: 36px; border-radius: 10px; background: rgba(var(--primary-rgb),.15); display: flex; align-items: center; justify-content: center; gap: 4px; }
.current-page { color: var(--primary); font-size: 15px; }
.total-pages { color: var(--text-2); font-size: 13px; }
.divider { color: var(--text-2); }
.pagination-bottom-wrapper { display: flex; justify-content: center; margin-top: 25px; }

/* ============ SHOP GRID ============ */
.search-result-info { display: none; align-items: center; gap: 8px; padding: 8px 14px; margin-bottom: 15px; background: rgba(var(--primary-rgb),.1); border: 1px solid rgba(var(--primary-rgb),.3); border-radius: 12px; font-size: 12px; color: var(--primary); }
.search-result-info.show { display: flex; }
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
@media (min-width: 768px) { .shop-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.shop-card-item { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: .3s; position: relative; }
.shop-card-item:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 10px 30px rgba(var(--primary-rgb),.3); }
.shop-card-img { width: 100%; height: 130px; overflow: hidden; background: #fff; display: flex; align-items: center; justify-content: center; position: relative; }
.shop-card-img img { width: 100%; height: 100%; object-fit: cover; transition: .5s; }
.shop-card-item:hover .shop-card-img img { transform: scale(1.08); }
.sold-badge { position: absolute; top: 8px; right: 8px; background: rgba(16,185,129,.95); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 12px; z-index: 3; }
.shop-card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; height: 100%; }
.shop-card-title-row { display: flex; align-items: center; gap: 8px; justify-content: flex-start; margin-bottom: 4px; min-height: 40px; }
.shop-card-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: var(--input-bg); border: 1px solid var(--border); flex-shrink: 0; }
.shop-card-title { font-weight: 700; color: var(--text); font-size: 14px; flex: 1; text-align: left; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; white-space: normal; }
.shop-card-desc-toggle { background: transparent; border: 1px dashed var(--border); color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; width: 100%; display: flex; justify-content: space-between; align-items: center; }
.shop-card-desc-toggle:hover { border-color: var(--primary); color: var(--text); }
.shop-card-desc-content { display: none; font-size: 11.5px; color: var(--text-2); background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; text-align: left; line-height: 1.5; white-space: pre-line; max-height: 150px; overflow-y: auto; }
.shop-card-desc-content.show { display: block; }
.shop-card-stats { display: flex; gap: 12px; font-size: 11px; color: var(--text-2); justify-content: center; flex-wrap: wrap; margin-top: auto; }
.shop-card-stats b { color: var(--accent); }
.shop-card-price { font-size: 17px; font-weight: 800; color: var(--highlight); text-align: center; line-height: 1.2; min-height: 22px; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.shop-card-btn { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; padding: 10px 0; border-radius: 10px; font-weight: bold; border: none; cursor: pointer; font-size: 13px; width: 100%; font-family: inherit; transition: .2s; margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px; }
.shop-card-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(var(--primary-rgb),.5); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); grid-column: 1 / -1; }
.empty-state i { font-size: 60px; margin-bottom: 15px; opacity: .4; }

/* ============ MODAL ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 3000; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(6px); overflow-y: auto; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--card); border: 2px solid var(--primary); border-radius: 20px; width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; padding: 24px; position: relative; animation: popIn .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-x { position: absolute; top: 12px; right: 15px; width: 34px; height: 34px; border-radius: 50%; background: var(--input-bg); border: 1px solid var(--border); color: var(--text-2); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; }
.modal-x:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }
.modal-title { color: var(--primary); font-size: 17px; font-weight: 800; text-align: center; margin-bottom: 16px; text-transform: uppercase; }
.modal-sub { color: var(--text-2); font-size: 13px; text-align: center; margin-bottom: 18px; }
#orderDetailModal._forceOpen .modal-x { display: none; }

/* ============ FORM ============ */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; }
.form-group label i { margin-right: 4px; color: var(--primary); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-family: inherit; font-size: 13px; outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.15); }
.btn-primary-full { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: none; border-radius: 12px; font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; transition: .25s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary-full:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(var(--primary-rgb),.5); }
.btn-primary-full:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary-full { width: 100%; padding: 14px; background: var(--input-bg); color: var(--text); border: 1.5px solid var(--border); border-radius: 12px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: .2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-secondary-full:hover { border-color: var(--primary); color: var(--primary); }
.btn-success-full { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--accent), #059669); color: #fff; border: none; border-radius: 12px; font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; transition: .25s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-success-full:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16,185,129,.4); }
.btn-success-full:disabled { opacity: .6; cursor: not-allowed; }

/* ============ AUTH & TURNSTILE ============ */
.auth-tabs { display: flex; gap: 6px; background: var(--input-bg); padding: 6px; border-radius: 10px; margin-bottom: 16px; }
.auth-tab { flex: 1; padding: 10px; border-radius: 8px; background: transparent; color: var(--text-2); border: none; font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
#turnstile-container { display: flex; justify-content: center; margin: 10px 0; min-height: 65px; }

/* ============ AVATAR ============ */
.avatar-preview-box { display: flex; justify-content: center; margin: 16px 0 20px; }
.avatar-preview-wrap { width: 120px !important; height: 120px !important; border-radius: 50% !important; border: 4px solid var(--primary) !important; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); position: relative; overflow: hidden !important; display: flex; align-items: center; justify-content: center; }
.avatar-preview-wrap .avatar-text-large { font-size: 48px !important; color: #fff; z-index: 1; }
.avatar-preview-wrap .avatar-img { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; object-fit: cover !important; z-index: 2; }
.avatar-divider { text-align: center; color: var(--text-2); font-size: 11px; font-weight: 700; margin: 14px 0; position: relative; }
.avatar-divider::before, .avatar-divider::after { content: ''; position: absolute; top: 50%; width: 35%; height: 1px; background: var(--border); }
.avatar-divider::before { left: 0; } .avatar-divider::after { right: 0; }
.upload-file-btn { display: flex !important; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: var(--input-bg); border: 2px dashed var(--border); border-radius: 10px; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: .2s; }
.upload-file-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(var(--primary-rgb),.05); }

/* ============ BUY ============ */
.buy-product-head { display: flex; gap: 14px; align-items: center; padding: 14px; background: rgba(var(--primary-rgb),.08); border: 1px solid rgba(var(--primary-rgb),.3); border-radius: 12px; margin-bottom: 14px; }
.buy-product-logo { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; background: var(--input-bg); border: 2px solid var(--border); flex-shrink: 0; }
.buy-product-name { font-size: 16px; font-weight: 800; color: var(--text); }
.buy-product-price { font-size: 18px; font-weight: 800; color: var(--highlight); margin-top: 4px; }
.buy-desc-toggle { background: transparent; border: 1.5px dashed var(--border); color: var(--text-2); padding: 10px 14px; border-radius: 10px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.buy-desc-toggle:hover { border-color: var(--primary); color: var(--text); }
.buy-desc-content { display: none; background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-line; margin-bottom: 10px; max-height: 200px; overflow-y: auto; }
.buy-desc-content.show { display: block; }
.buy-qty-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.buy-qty-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; min-width: 70px; }
.qty-control { display: flex; align-items: center; background: var(--input-bg); border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; flex: 1; }
.qty-btn { background: transparent; border: none; color: var(--primary); width: 40px; height: 42px; font-size: 18px; font-weight: 700; cursor: pointer; }
.qty-btn:hover { background: rgba(var(--primary-rgb),.15); }
.qty-input { flex: 1; background: transparent; border: none; color: var(--text); text-align: center; font-size: 15px; font-weight: 700; outline: none; padding: 10px; font-family: inherit; }
.buy-total { display: flex; justify-content: space-between; align-items: center; padding: 14px; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); border-radius: 10px; margin: 14px 0; }
.buy-total-label { font-size: 13px; color: var(--text); font-weight: 600; }
.buy-total-value { font-size: 20px; font-weight: 800; color: var(--highlight); }

/* ============ BANK ============ */
.bank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bank-card { background: var(--input-bg); border: 2px solid var(--border); border-radius: 14px; padding: 16px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: .25s; }
.bank-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.bank-card img { width: 70px; height: 70px; object-fit: contain; background: #fff; padding: 4px; border-radius: 10px; }
.bank-card .bank-name { font-size: 12px; font-weight: 700; color: var(--text); text-align: center; }

/* ============ QR ============ */
.qr-info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; gap: 10px; }
.qr-info-row:last-child { border-bottom: none; }
.qr-label { color: var(--text-2); flex-shrink: 0; }
.qr-value { color: var(--text); font-weight: 700; text-align: right; word-break: break-word; }
.qr-value.highlight { color: var(--accent); }
.qr-status-badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; background: rgba(245,158,11,.2); color: var(--warning); border: 1px solid var(--warning); }
.qr-status-badge.paid { background: rgba(16,185,129,.2); color: var(--accent); border-color: var(--accent); }
.qr-status-badge.cancelled, .qr-status-badge.expired { background: rgba(239,68,68,.15); color: var(--danger); border-color: var(--danger); }
.qr-image-box { background: #fff; border-radius: 14px; padding: 12px; margin: 16px 0; text-align: center; }
.qr-image-box img { max-width: 100%; display: block; margin: 0 auto; }
.qr-no-image { text-align: center; padding: 20px; color: var(--text-2); font-size: 13px; background: var(--input-bg); border: 1px dashed var(--border); border-radius: 10px; margin: 16px 0; }
.qr-content-box { background: #000; color: #0f0; font-size: 14px; font-weight: 700; padding: 12px; border-radius: 10px; border: 1px solid var(--accent); text-align: center; word-break: break-all; margin: 8px 0; cursor: pointer; }
.qr-content-box:hover { background: #001a00; }

/* ============ TOPUP ============ */
.topup-section-title { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; margin-bottom: 10px; letter-spacing: .5px; }
.topup-bank-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.topup-bank-item { background: var(--input-bg); border: 2px solid var(--border); border-radius: 12px; padding: 10px 8px; cursor: pointer; text-align: center; transition: .2s; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.topup-bank-item:hover { border-color: var(--primary); transform: translateY(-2px); }
.topup-bank-item.selected { border-color: var(--accent); background: rgba(16,185,129,.08); box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
.topup-bank-item img { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.topup-bank-item span { font-size: 11px; font-weight: 700; color: var(--text-2); }
.topup-bank-item.selected span { color: var(--accent); }
.topup-amount-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.topup-amount-chip { background: var(--input-bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 6px; font-family: inherit; font-size: 12px; font-weight: 700; color: var(--text); cursor: pointer; transition: .2s; }
.topup-amount-chip:hover { border-color: var(--primary); color: var(--primary); }
.topup-amount-chip.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: var(--primary); }
.topup-desc-toggle { background: transparent; border: 1px dashed var(--border); color: var(--text-2); padding: 8px 12px; border-radius: 8px; font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; width: 100%; display: flex; justify-content: space-between; align-items: center; margin: 12px 0; }
.topup-desc-toggle:hover { border-color: var(--primary); color: var(--text); }
.topup-desc-content { display: none; font-size: 12px; color: var(--text-2); background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: left; line-height: 1.6; white-space: pre-line; margin-top: -4px; margin-bottom: 12px; }
.topup-desc-content.show { display: block; }
.topup-expire-warning { background: rgba(245,158,11,.1); border: 1px solid var(--warning); border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--warning); margin: 12px 0; line-height: 1.5; display: flex; align-items: center; gap: 8px; }
.topup-result-info { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 14px; }
.topup-result-item { background: var(--input-bg); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; }
.topup-result-label { color: var(--text-2); font-weight: 600; flex-shrink: 0; }
.topup-result-value { color: var(--text); font-weight: 700; word-break: break-word; text-align: right; }
.topup-result-value.highlight { color: var(--accent); font-size: 14px; }
.topup-qr-box { background: #fff; border-radius: 12px; padding: 12px; margin-top: 12px; text-align: center; }
.topup-qr-box img { max-width: 240px; width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.topup-status-pill { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.topup-status-pill.pending { background: rgba(245,158,11,.2); color: var(--warning); border: 1px solid var(--warning); }
.topup-status-pill.paid { background: rgba(16,185,129,.2); color: var(--accent); border: 1px solid var(--accent); }
.topup-status-pill.cancelled, .topup-status-pill.expired { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid var(--danger); }
.topup-pulse { animation: topupPulse 1.5s infinite; }
@keyframes topupPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.topup-countdown { text-align: center; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.topup-countdown b { color: var(--warning); }
.topup-waiting-cron { background: rgba(245,158,11,.1); border: 1px solid var(--warning); border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--warning); margin: 10px 0; text-align: center; line-height: 1.5; }

/* ============ PAID SUBFILTER ============ */
.paid-subfilter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--input-bg); padding: 6px; border-radius: 10px; }
.paid-subfilter-btn { padding: 9px 6px; border-radius: 8px; background: transparent; border: none; color: var(--text-2); font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: .2s; }
.paid-subfilter-btn:hover { color: var(--text); }
.paid-subfilter-btn.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }

/* ============ HISTORY ============ */
.hist-card { background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: 16px; padding: 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: .2s; }
.hist-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); border-color: var(--primary); }
.hist-card.status-pending { border-left-color: var(--warning); }
.hist-card.status-paid { border-left-color: var(--accent); }
.hist-card.status-cancelled { border-left-color: #6b7280; }
.hist-card.status-expired { border-left-color: var(--danger); }
.hist-card.hist-topup { border-left-color: var(--info); }
.hist-card.hist-topup.status-paid { border-left-color: var(--accent); }
.hist-card.hist-topup.status-pending { border-left-color: var(--warning); }
.hist-card-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.hist-tx { background: var(--input-bg); color: var(--text); padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: 13px; border: 1px solid var(--border); white-space: nowrap; }
.hist-status { background: var(--input-bg); color: var(--text-2); padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.hist-type-badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 9px; font-weight: 800; letter-spacing: .5px; margin-left: 8px; vertical-align: middle; }
.hist-type-badge.topup { background: rgba(230,57,70,.2); color: var(--info); border: 1px solid var(--info); }
.hist-type-badge.order { background: rgba(var(--primary-rgb),.2); color: var(--primary-light); border: 1px solid var(--primary-light); }
.hist-card-mid { display: flex; align-items: center; gap: 12px; }
.hist-logo { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; background: var(--input-bg); border: 1px solid var(--border); }
.hist-title { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hist-card-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.hist-stat { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 700; background: var(--input-bg); border: 1px solid var(--border); color: var(--text); }
.hist-stat-qty { color: var(--info); }
.hist-stat-price { color: var(--accent); }
.hist-card-time { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px; }
.hist-card-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.hist-btn { flex: 1; min-width: 100px; padding: 12px 0; border-radius: 12px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; border: none; transition: .2s; }
.hist-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.hist-btn-view, .hist-btn-download { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.hist-btn-delete { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); }
.hist-btn-delete:hover { background: rgba(255,255,255,0.05); }
.hist-btn-topup { background: linear-gradient(135deg, var(--accent), #059669); }
.hist-empty { text-align: center; padding: 40px 20px; color: var(--text-2); font-size: 14px; }

/* ============ ORDER DETAIL ============ */
.order-detail-head { text-align: center; margin-bottom: 16px; }
.order-detail-head img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; margin-bottom: 8px; }
.order-detail-head h3 { color: var(--text); font-size: 16px; }
.resource-box { background: #000; color: #0f0; font-size: 12px; padding: 14px; border-radius: 10px; border: 1px solid var(--accent); max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.6; margin: 10px 0; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

/* ============ TOAST ============ */
.toast { position: fixed; bottom: calc(30px + env(safe-area-inset-bottom)); right: 20px; background: var(--card); border-left: 4px solid var(--accent); padding: 14px 20px; border-radius: 8px; transform: translateX(150%); opacity: 0; transition: .3s; z-index: 6000; color: var(--text); font-weight: 600; font-size: 13px; max-width: 340px; }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

/* ============ SPINNER ============ */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.loading-spinner { border-radius: 50%; animation: spin 1s linear infinite; }

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    .section { padding: 20px 15px 30px; }
    .section-title-bar h2 { font-size: 17px; }
    .shop-card-title { font-size: 13px; }
    .modal-box { padding: 18px; }
    .category-dropdown-btn { min-width: 140px; padding: 9px 12px; font-size: 12px; }
    .pagination-btn { width: 32px; height: 32px; font-size: 12px; }
    .pagination-info { min-width: 60px; font-size: 12px; height: 32px; }
    .bank-card { padding: 12px; }
    .bank-card img { width: 55px; height: 55px; }
    .topup-bank-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .topup-bank-item { padding: 8px 4px; }
    .topup-bank-item img { width: 40px; height: 40px; }
    .topup-amount-row { grid-template-columns: repeat(2, 1fr); }
    .auth-tab { font-size: 11px; padding: 9px 4px; }
    .shop-card-img { height: 110px; }
    .main-header { padding: 8px 12px; height: 60px; }
    .brand img { height: 28px; }
    .menu-toggle-btn, .header-theme-btn { width: 34px; height: 34px; font-size: 14px; }
    .btn-nav { padding: 6px 10px; font-size: 11px; }
    .user-name { display: none; }
    .user-pill { padding: 6px; }
    .header-nav-links { display: none !important; }
}

/* ============ iOS EFFECTS ============ */
.ripple-effect { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.4); transform: scale(0); animation: rippleAnim 0.6s linear; pointer-events: none; }
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }
button, .shop-card-btn, .dock-item, .category-dropdown-btn, .pagination-btn { position: relative; overflow: hidden; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease; -webkit-tap-highlight-color: transparent; }
button:active, .shop-card-btn:active, .dock-item:active { transform: scale(0.94) !important; }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.modal-box, .user-menu, .dock-menu { transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important; }
.shop-card-item { animation: cardFadeIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards; }
@keyframes cardFadeIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============ ACCESSIBILITY ============ */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   CÁC PHẦN BỔ SUNG KHÁC
   ============================================================ */
.inline-img-link { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin: 0 3px; }
.inline-img-link img { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.inline-link-btn { display: inline-flex; align-items: center; justify-content: center; padding: 2px 8px; margin: 0 2px; background: var(--primary); color: #fff !important; font-size: 10px; font-weight: 800; border-radius: 6px; text-decoration: none !important; }
@keyframes floatNotice { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.notice-popup-title { font-family: inherit; font-size: 1.15rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; text-align: center; color: var(--text); margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.notice-popup-body { color: var(--text); font-size: .95rem; line-height: 1.6; word-break: break-word; }
.notice-popup-box { background: var(--card); border: 2px solid var(--primary); border-radius: 20px; width: 100%; max-width: 560px; padding: 26px 24px 20px; position: relative; }
.notice-popup-body { background: var(--input-bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; max-height: 380px; overflow-y: auto; }
.notice-popup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.notice-btn-skip { background: var(--input-bg); color: var(--text-2); border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; font-weight: 800; cursor: pointer; }
.notice-btn-ok { background: var(--primary); color: #fff; border: none; border-radius: 12px; padding: 14px; font-weight: 800; cursor: pointer; }

/* ============================================================
   UPGRADE v3 — Đồng bộ kiểu thẻ/nút của Admin sang cửa hàng
   (ô icon bo tròn, active gradient đỏ, hiệu ứng bấm)
   ============================================================ */
.sidebar-menu { gap: 14px; box-shadow: none; }
.sidebar-menu.active { box-shadow: 10px 0 40px rgba(0,0,0,.45); }
.sidebar-wallet { border-radius: 16px; background: var(--card); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.ltn-side-user { border-radius: 16px; background: var(--card); padding: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.ltn-side-avatar { border-radius: 12px; width: 40px; height: 40px; }

.sidebar-menu nav[aria-label] { display: flex; flex-direction: column; gap: 6px; }
.nav-link { min-height: 52px; padding: 7px 12px; border-radius: 14px; border: 1px solid transparent; gap: 12px; font-weight: 600; font-size: .92rem; transition: .2s; }
.nav-link > span {
    flex: none; width: 36px; height: 36px; border-radius: 11px; justify-content: center;
    background: var(--input-bg); color: var(--text-2); transition: .2s;
}
.nav-link svg, .nav-link i { opacity: 1; width: auto; }
@media (hover: hover) {
    .nav-link:hover { background: var(--input-bg); color: var(--text); }
    .nav-link:hover > span { color: var(--primary); }
}
.nav-link:active { transform: scale(.97); }
.nav-link.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.22), rgba(var(--primary-rgb),.06));
    border-color: rgba(var(--primary-rgb),.45); color: var(--text);
}
.nav-link.active > span { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(var(--primary-rgb),.45); }
.nav-link[href="admin.php"] > span { background: rgba(239,68,68,.12); color: var(--danger); }

/* Dropdown tài khoản */
.dropdown-links a, .dropdown-links button { border-radius: 12px; gap: 10px; }
.dropdown-links a i, .dropdown-links button i {
    width: 32px; height: 32px; border-radius: 10px; background: var(--input-bg);
    display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 13px;
}
.dropdown-links a:hover i { color: var(--primary); }
.dropdown-links a.admin-link i, .dropdown-links button.logout-btn i { background: rgba(239,68,68,.12); color: var(--danger); }

/* Thẻ & nút chung */
.shop-card-item { border-radius: var(--radius-card, 20px); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.shop-card-btn, .btn-primary-full, .notice-btn, .btn-nav { border-radius: var(--radius-btn, 12px); font-weight: 700; }
.shop-card-btn:active, .btn-primary-full:active, .notice-btn:active { transform: scale(.96); }
.modal-box { border-radius: var(--radius-card, 20px); }
.side-theme-seg { border-radius: 12px; }


/* ============================================================
   UPGRADE v4 — Thanh header cửa hàng y hệt thanh trên cùng của Admin Panel
   (thanh nổi bo tròn, kính mờ, đổ bóng, nút tròn)
   ============================================================ */
.main-header {
    top: 10px; left: 12px; right: 12px; width: auto; height: 60px;
    padding: 8px 14px;
    background: color-mix(in srgb, var(--bg-2) 88%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-bottom: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(0,0,0,.28);
}
@media (min-width: 1025px) {
    .main-header { left: calc(var(--side-w) + 12px); }
    .main-content-wrapper { padding-top: 84px; }
}
@media (max-width: 1024px) {
    .main-content-wrapper { padding-top: 84px; }
}
.header-left { gap: 10px; min-width: 0; }
.header-right { gap: 8px; min-width: 0; }
.header-theme-btn {
    width: 38px; height: 38px; font-size: 15px; flex-shrink: 0;
    background: var(--input-bg); border: 1px solid var(--border);
}
@media (hover: hover) { .header-theme-btn:hover { border-color: var(--primary); color: var(--primary); transform: none; } }
.header-theme-btn:active { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(.94); }
.user-pill { padding: 6px 12px; border-radius: 20px; font-weight: 600; }
.user-pill:active { transform: scale(.96); }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.header-nav-links { border-radius: 14px; }
.user-dropdown { top: calc(100% + 14px); border-radius: 18px; box-shadow: 0 14px 40px rgba(0,0,0,.4); }
@media (max-width: 640px) {
    .main-header { top: 8px; left: 10px; right: 10px; height: 56px; padding: 8px 10px; border-radius: 16px; }
    .menu-toggle-btn, .header-theme-btn { width: 36px; height: 36px; }
    .main-content-wrapper { padding-top: 76px; }
}


/* ============================================================
   UPGRADE v5 — Theme Studio (Tuỳ chỉnh giao diện)
   ============================================================ */
body { background-image: var(--bg-image, none); background-size: cover; background-position: center; background-attachment: fixed; }

/* Kiểu nút do người dùng chọn */
html[data-btn="solid"] .shop-card-btn, html[data-btn="solid"] .btn-primary-full, html[data-btn="solid"] .notice-btn-ok, html[data-btn="solid"] .btn-log-nav { background: var(--primary); }
html[data-btn="outline"] .shop-card-btn, html[data-btn="outline"] .btn-primary-full, html[data-btn="outline"] .notice-btn-ok, html[data-btn="outline"] .btn-log-nav {
    background: transparent; color: var(--primary); border: 2px solid var(--primary); box-shadow: none;
}

/* Nút palette trong header & sidebar */
.header-theme-btn .fa-palette { font-size: 15px; }
.side-theme-custom {
    width: 100%; margin-top: 8px; height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px dashed var(--border); border-radius: 12px; background: transparent; color: var(--text-2);
    font-size: .82rem; font-weight: 700; cursor: pointer; transition: .2s;
}
@media (hover: hover) { .side-theme-custom:hover { border-color: var(--primary); color: var(--primary); } }
.side-theme-custom:active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Bảng Theme Studio */
.ts-overlay { position: fixed; inset: 0; z-index: 9400; background: transparent; visibility: hidden; }
.ts-overlay.show { visibility: visible; }
.ts-panel {
    position: fixed; z-index: 9500; display: flex; flex-direction: column;
    background: var(--bg-2); color: var(--text); border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0,0,0,.55); visibility: hidden; opacity: 0;
    transition: transform .3s cubic-bezier(.2,.9,.3,1), opacity .25s, visibility .3s;
}
/* Máy tính: ngăn kéo bên phải */
@media (min-width: 701px) {
    .ts-panel { top: 12px; right: 12px; bottom: 12px; width: 370px; border-radius: 20px; transform: translateX(30px); }
}
/* Điện thoại: bảng trượt từ dưới lên, vẫn thấy trang phía trên để xem trước */
@media (max-width: 700px) {
    .ts-panel { left: 0; right: 0; bottom: 0; max-height: 62vh; border-radius: 22px 22px 0 0; border-bottom: none; transform: translateY(40px); }
}
.ts-panel.show { visibility: visible; opacity: 1; transform: none; }
.ts-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); flex: none; }
.ts-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ts-title i { color: var(--primary); }
.ts-close { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--input-bg); color: var(--text-2); font-size: 20px; cursor: pointer; display: grid; place-items: center; }
.ts-close:active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ts-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 16px 20px; flex: 1; }
.ts-sec { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.ts-sec:last-of-type { border-bottom: none; }
.ts-sec-title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.ts-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--input-bg); border-radius: 14px; }
.ts-seg button { height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ts-seg button.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(var(--primary-rgb), .4); }
.ts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ts-tile-wrap { position: relative; }
.ts-tile { width: 100%; padding: 6px; border: 2px solid var(--border); border-radius: 14px; background: var(--input-bg); cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: stretch; color: var(--text); transition: .2s; }
.ts-tile.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .2); }
@media (hover: hover) { .ts-tile:hover { border-color: var(--primary); } }
.ts-tile:active { transform: scale(.96); }
.ts-swatch { display: flex; align-items: flex-end; justify-content: center; height: 46px; border-radius: 9px; border: 1px solid; padding: 6px; }
.ts-sw-card { display: flex; gap: 4px; align-items: center; justify-content: center; width: 100%; height: 22px; border-radius: 6px; border: 1px solid; }
.ts-sw-card i { width: 12px; height: 12px; border-radius: 50%; display: block; font-size: 0; }
.ts-tile-name { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.2; min-height: 26px; display: flex; align-items: center; justify-content: center; }
.ts-tile-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--danger); font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.ts-colors { display: flex; flex-direction: column; gap: 8px; }
.ts-color { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ts-color-box { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.ts-color code { font-family: 'Courier New', monospace !important; font-size: 11px; color: var(--text-2); }
.ts-color input[type="color"] { width: 38px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: transparent; cursor: pointer; }
.ts-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 12.5px; font-weight: 600; }
.ts-row b { color: var(--primary); font-weight: 800; margin-left: 4px; }
.ts-row select { max-width: 170px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 12.5px; }
.ts-row input[type="range"] { width: 150px; accent-color: var(--primary); }
.ts-input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 12.5px; outline: none; }
.ts-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .15); }
.ts-code { margin-top: 8px; resize: vertical; font-family: 'Courier New', monospace !important; font-size: 11px; word-break: break-all; }
.ts-hint { font-size: 11px; color: var(--text-2); margin-top: 6px; }
.ts-save { display: flex; gap: 8px; }
.ts-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.ts-btn { height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.ts-btn:active { transform: scale(.96); }
.ts-btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; flex: none; }
.ts-btn-danger { color: var(--danger); }
.ts-msg { min-height: 18px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--accent); opacity: 0; transition: .2s; }
.ts-msg.show { opacity: 1; }
.ts-msg.bad { color: var(--danger); }
.ts-foot { margin-top: 10px; text-align: center; font-size: 11px; color: var(--text-2); }

/* GIF trạng thái thanh toán (đang xử lý / thành công / thất bại) */
.pay-gif { display: block; width: 120px; height: 120px; max-width: 60%; object-fit: contain; margin: 0 auto 14px; border-radius: 16px; }
