/* =========================================
   BIẾN MÀU SẮC CHUNG (DARK/LIGHT MODE)
========================================= */
:root {
    --bg-main: #0b0e11;
    --bg-card: #1e2329;
    --text-main: #eaecef;
    --text-muted: #848e9c;
    --border-color: #333333;
    --header-bg: #2b2f36;
    --input-bg: #0b0e11;
    --btn-bg: #2b2f36;
    --hover-bg: #3a3f4a;
    --kpi-bg: rgba(240, 185, 11, 0.05);
    --kpi-silver-bg: rgba(192, 192, 192, 0.05);
    --green-text: #00ff88;
    --red-text: #ff4444;
    --zalo-yellow: #f0b90b;
}

/* =========================================
   🚀 BỘ MÀU LIGHT MODE (CHUẨN TÀI CHÍNH BLOOMBERG)
========================================= */
[data-theme="light"] {
    --bg-main: #EEF2F7;
    --bg-card: #FFFFFF;
    --text-main: #111827; 
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --header-bg: #FFFFFF;
    --input-bg: #F9FAFB;
    --btn-bg: #F3F4F6;
    --hover-bg: #E5E7EB;
    --kpi-bg: #FFFFFF; 
    --kpi-silver-bg: #F9FAFB;
    --green-text: #15803D; /* Xanh đậm sắc nét */
    --red-text: #DC2626;   /* Đỏ báo động mạnh */
    --zalo-yellow: #B8962E; /* Vàng trầm Muted Gold */
}

/* =========================================
   🔨 BÚA TẠ: CƯỠNG CHẾ GIAO DIỆN INDEX.HTML KHI SÁNG
========================================= */

/* 1. Ép các con số Giá tiền thành Đen, nét chữ Semi-bold thanh mảnh sắc nét */
[data-theme="light"] .price,
[data-theme="light"] .kpi-value,
[data-theme="light"] .pl-val-text,
[data-theme="light"] #val-quydoi,
[data-theme="light"] #val-chenhlech,
[data-theme="light"] .gold-table td.buy,
[data-theme="light"] .gold-table td.sell,
[data-theme="light"] #bang-gia-tinh td:nth-child(2),
[data-theme="light"] #bang-gia-tinh td:nth-child(3) {
    color: #111827 !important;
    font-weight: 600 !important; /* Trả về 600 cho thanh thoát */
}

/* 1.5. Ép màu Xanh/Đỏ ở cột Tăng/Giảm cực đậm, chống chói lóa trên nền trắng */
[data-theme="light"] .val-up, 
[data-theme="light"] .price.up,
[data-theme="light"] .live-tag {
    color: #15803D !important; /* Xanh lá đậm trầm */
    font-weight: 600 !important;
}

[data-theme="light"] .val-down, 
[data-theme="light"] .price.down {
    color: #DC2626 !important; /* Đỏ cờ mạnh mẽ */
    font-weight: 600 !important;
}

/* 2. Ép bóng đổ (Shadow) mỏng nhẹ, viền bo tinh tế */
[data-theme="light"] .domestic-section, 
[data-theme="light"] .price-card, 
[data-theme="light"] .ledger-section,
[data-theme="light"] .spdr-inner-card,
[data-theme="light"] #live-gold-board {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
    border: 1px solid #E5E7EB !important;
}

/* 3. Tối ưu Bảng giá (Tăng khoảng cách, nền sọc vằn xen kẽ) */
[data-theme="light"] .gold-table td {
    border-bottom: 1px solid #E5E7EB !important;
    padding: 16px 15px !important;
}
[data-theme="light"] .gold-table tbody tr:nth-child(even) {
    background-color: #F9FAFB !important; /* Chỉ sọc vằn cho bảng Vàng Miếng/Nhẫn */
}

/* 4. Khử màu Vàng chóe của các Tiêu đề bị fix cứng trong HTML */
[data-theme="light"] h1, 
[data-theme="light"] h3, 
[data-theme="light"] h4,
[data-theme="light"] .ledger-title,
[data-theme="light"] .widget-title {
    color: var(--zalo-yellow) !important; 
}

/* 5. Tối ưu UX Bảng giá Tỉnh lẻ (Card trắng, Hover nổi khối, Active mạ vàng) */
[data-theme="light"] #bang-gia-tinh td:nth-child(1) {
    color: #111827 !important;
}
[data-theme="light"] #bang-gia-tinh td:nth-child(1) span:first-child {
    color: var(--zalo-yellow) !important; 
    font-size: 18px !important; /* 🚀 Phóng to tên thương hiệu lên x1.5 */
}
[data-theme="light"] #bang-gia-tinh td:nth-child(4) {
    color: #111827 !important;
    background: transparent !important; /* 🚀 Xóa nền xám, đồng bộ màu thẻ Card */
}
/* Trạng thái mặc định: Card trắng tinh, viền nhạt */
[data-theme="light"] #bang-gia-tinh tr {
    background: #FFFFFF !important;
    border: 1px solid #E5E7EB !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
}
/* Hiệu ứng Hover: Sáng màu xám cực nhẹ, nổi bóng đổ */
[data-theme="light"] #bang-gia-tinh tr:hover {
    background: #F9FAFB !important;
    border-color: #D1D5DB !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.06) !important;
}
/* Hiệu ứng Active: Viền vàng Gold, nền ám vàng sang trọng y như Dark Mode */
[data-theme="light"] #bang-gia-tinh tr.active-row {
    background: rgba(184, 150, 46, 0.05) !important;
    border: 1px solid var(--zalo-yellow) !important;
    box-shadow: inset 0 0 0 1px var(--zalo-yellow), 0 4px 10px rgba(184, 150, 46, 0.1) !important;
}

/* 6. Giải cứu Modal Popup (Xóa nền đen) */
[data-theme="light"] .chart-modal-content,
[data-theme="light"] .success-modal-content,
[data-theme="light"] .modal-content,
[data-theme="light"] #tinhle-brand-modal .modal-content,
[data-theme="light"] .success-icon-wrapper {
    background: #FFFFFF !important;
    border-color: #E5E7EB !important;
}
[data-theme="light"] #sell-modal-desc,
[data-theme="light"] .success-title,
[data-theme="light"] .receipt-row .r-value,
[data-theme="light"] #search-tinhle-modal {
    color: #111827 !important;
}
[data-theme="light"] #search-tinhle-modal {
    background: #F9FAFB !important;
    border-color: #E5E7EB !important;
}
/* 7. Cứu tiêu đề bảng: Đổ nền xám nhạt để tách khối với thân bảng trắng */
[data-theme="light"] .gold-table th,
[data-theme="light"] .board-table th {
    background-color: #F3F4F6 !important; /* Xám lạnh nhạt tạo khối */
    border-bottom: 2px solid #E5E7EB !important; /* Đường gạch chân chia tách */
}

body { background-color: var(--bg-main); color: var(--text-main); font-family: 'Segoe UI', Roboto, sans-serif; margin: 0; padding-bottom: 100px; text-align: center; transition: 0.3s; font-size: 16px; }

.news-ticker { background: var(--zalo-yellow); color: #000; padding: 14px 0; overflow: hidden; white-space: nowrap; font-weight: bold; position: sticky; top: 0; z-index: 990; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.news-content { display: inline-block; animation: ticker 45s linear infinite; font-size: 18px; }
@keyframes ticker { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

.header-container { display: flex; justify-content: center; align-items: center; gap: 20px; margin: 30px 0; position: relative; }
h1 { color: var(--zalo-yellow); margin: 0; text-shadow: 0 0 15px rgba(240, 185, 11, 0.3); font-size: 38px; }
.btn-theme-toggle { background: var(--header-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 18px; border-radius: 20px; cursor: pointer; transition: 0.3s; font-size: 18px; }
/* =========================================
   MENU ĐIỀU HƯỚNG CHÍNH (DESKTOP)
========================================= */
.main-nav-group { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
}

.main-nav-btn { 
    color: var(--text-muted); 
    text-decoration: none; /* Xóa gạch chân mặc định của thẻ a */
    font-size: 16px; 
    font-weight: bold; 
    padding: 8px 16px; 
    border-radius: 12px; 
    transition: all 0.3s ease; 
    display: flex; 
    align-items: center; 
    gap: 8px;
    border: 1px solid transparent;
}

.main-nav-btn:hover { 
    color: var(--text-main); 
    background: var(--hover-bg); 
}

.main-nav-btn.active { 
    color: var(--zalo-yellow); 
    background: rgba(240, 185, 11, 0.1); 
    border: 1px solid rgba(240, 185, 11, 0.3); 
}
.tables-wrapper { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; padding: 0 20px; max-width: 1400px; margin-inline: auto;}
.domestic-section { background: var(--bg-card); border: 1px solid var(--border-color); padding: 25px; border-radius: 20px; flex: 1; min-width: 300px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); overflow: hidden; }
.calculator-section { max-width: 800px; margin: 0 auto 40px; background: var(--bg-card); padding: 35px; border-radius: 24px; border: 1px dashed var(--zalo-yellow); }

/* 3 Ô TO TRÊN CÙNG */
.container { display: flex; justify-content: center; gap: 15px; width: 100%; max-width: 800px; margin: 0 auto 30px; padding: 0 20px; box-sizing: border-box; }
.price-card { background: var(--bg-card); border: 1px solid var(--border-color); padding: 15px; border-radius: 12px; flex: 1; box-shadow: 0 4px 10px rgba(0,0,0,0.05); text-align: center; min-width: 0; }
.card-icon { font-size: 32px; margin-bottom: 10px; } 
.card-title { color: var(--zalo-yellow); font-size: 13px; font-weight: bold; margin: 0 0 8px 0; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price { font-size: 24px; font-weight: bold; color: var(--zalo-yellow); font-family: 'Consolas', monospace; margin: 5px 0; white-space: nowrap; }
.price-vnd { color: var(--text-muted); font-size: 14px; border-top: 1px solid var(--border-color); padding-top: 8px; }
.price.up { color: var(--green-text) !important; } 
.price.down { color: var(--red-text) !important; }

.update-time { font-size: 14px; color: var(--text-muted); margin-bottom: 18px; font-style: italic; }

/* BẢNG GIÁ VÀNG MỚI (Tối ưu Mobile) */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gold-table { width: 100%; border-collapse: collapse; }
.gold-table th { background: var(--header-bg); color: var(--zalo-yellow); padding: 18px 15px; text-align: left; font-size: 16px; border-radius: 8px 8px 0 0; white-space: nowrap; }
/* 🚀 FIX: Ép nhỏ chữ và giảm padding để cứu cột Tăng/Giảm */
.gold-table td { padding: 12px 5px; text-align: left; border-bottom: 1px solid var(--header-bg); font-size: 15px; color: var(--text-main); vertical-align: middle; white-space: normal; }
.buy { color: var(--green-text); font-weight: bold; } 
.sell { color: var(--red-text); font-weight: bold; }
.live-tag { color: var(--green-text); font-weight: bold; font-size: 13px; animation: blinkLive 1.5s infinite; }

/* CSS cho cột Tăng/Giảm */
.diff-box { display: flex; justify-content: flex-end; gap: 15px; font-size: 15px; white-space: nowrap; }
.diff-label { color: var(--text-muted); font-size: 13px; margin-right: 3px; }
.val-up { color: var(--green-text); font-weight: bold; }
.val-down { color: var(--red-text); font-weight: bold; }

/* CSS cho Logo Thương Hiệu */
.brand-icon { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.brand-name { font-size: 16px; }

@keyframes blinkLive { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.calc-grid { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.input-group { flex: 1; min-width: 220px; text-align: left; }
.input-group label { color: var(--text-main); font-weight: bold; display: block; margin-bottom: 10px; font-size: 16px;}
.input-group input, .input-group select { width: 100%; padding: 14px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-main); font-size: 18px; box-sizing: border-box; outline: none; transition: 0.3s;}
.input-group input:focus { border-color: var(--zalo-yellow); }

/* CSS CHO KHỐI QUY ĐỔI & CHÊNH LỆCH */
.conversion-grid { display: flex; gap: 15px; margin-top: 15px; }
.conversion-card { flex: 1; background-color: var(--input-bg); padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); text-align: left; }
.conversion-card.left { border-left: 4px solid var(--zalo-yellow); }
.conversion-card.right { border-left: 4px solid var(--red-text); }
.conversion-title { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: bold; text-transform: uppercase;}
.conversion-value { font-size: 22px; font-weight: bold; color: var(--text-main); line-height: 1.3;}

.tv-wrapper { position: relative; width: 95%; max-width: 1400px; margin: 0 auto 40px; }
.chart-box { width: 100%; height: 600px; border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; background: var(--bg-card); }
.tv-watermark { position: absolute; bottom: 25px; right: 25px; background: rgba(240, 185, 11, 0.85); color: #000; padding: 10px 25px; border-radius: 8px; font-weight: 800; font-size: 18px; z-index: 10; pointer-events: none; }

.btn-chart-day { background: var(--btn-bg); color: var(--text-muted); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.2s; font-size: 14px;}
.btn-chart-day:hover { background: var(--hover-bg); color: var(--text-main); border-color: var(--text-muted); }
.btn-chart-day.active { background: rgba(240, 185, 11, 0.15); color: var(--zalo-yellow); border-color: var(--zalo-yellow); }

.btn-google { background: #fff; color: #333; padding: 10px 20px; border-radius: 20px; font-size: 16px; font-weight: bold; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.user-profile { display: none; align-items: center; gap: 12px; background: var(--header-bg); padding: 8px 20px; border-radius: 25px; border: 1px solid var(--border-color); }
.user-profile img { width: 30px; border-radius: 50%; border: 1px solid var(--zalo-yellow); }
.btn-logout { background: transparent; color: var(--red-text); border: none; cursor: pointer; font-size: 18px; }

/* GIAO DIỆN SỔ TAY */
.ledger-section { max-width: 800px; margin: 0 auto 40px; background: var(--bg-card); padding: 30px; border-radius: 24px; border: 1px solid var(--border-color); transition: 0.3s; position: relative;}
.ledger-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px;}
.ledger-title { color: var(--text-main); margin: 0; font-size: 26px; font-weight: bold; display: flex; align-items: center; gap: 10px;}

.login-box-compact { background: var(--bg-main); padding: 40px 20px; border-radius: 16px; border: 1px dashed var(--border-color); display: flex; flex-direction: column; align-items: center; gap: 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 20px; }
.kpi-box { background: var(--kpi-bg); border-radius: 16px; padding: 20px; text-align: left; display: flex; flex-direction: column; position: relative; border: 1px solid rgba(240,185,11,0.2);}
.kpi-box.silver { background: var(--kpi-silver-bg); border: 1px solid var(--border-color);}
.kpi-title { color: var(--text-muted); font-size: 14px; margin-bottom: 10px;}
.kpi-icon { position: absolute; right: 15px; top: 15px; width: 32px; height: 32px; background: var(--zalo-yellow); color: #000; border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 16px;}
.kpi-box.silver .kpi-icon { background: #c0c0c0; }
.kpi-value { color: var(--text-main); font-size: 24px; font-weight: bold; }

.pl-row { display: flex; justify-content: space-between; align-items: center; padding: 0 10px 25px; border-bottom: 1px solid var(--border-color); margin-bottom: 25px; }
.pl-label { font-size: 18px; color: var(--text-muted); display: flex; align-items: center; gap: 10px; font-weight: bold;}
.pl-val-box { display: flex; align-items: center; gap: 15px; }
.pl-val-text { font-size: 24px; font-weight: bold; }
.pl-percent { padding: 6px 12px; border-radius: 20px; font-size: 16px; font-weight: bold; color: #fff; background: var(--text-muted);}

.metal-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 25px; }
.metal-tab-btn { padding: 10px 25px; border-radius: 20px; font-size: 16px; font-weight: bold; cursor: pointer; border: 1px solid var(--border-color); background: var(--bg-main); color: var(--text-muted); transition: 0.2s;}
.metal-tab-btn.active-gold { background: var(--zalo-yellow); color: #000; border-color: var(--zalo-yellow); }
.metal-tab-btn.active-silver { background: #c0c0c0; color: #000; border-color: #c0c0c0; }

.history-header { display: flex; align-items: center; justify-content: space-between; font-size: 20px; font-weight: bold; margin-bottom: 15px; color: var(--text-main);}
.history-header .badge { background: var(--zalo-yellow); color: #000; padding: 2px 10px; border-radius: 12px; font-size: 14px; margin-left: 10px;}
.search-box { position: relative; margin-bottom: 20px; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input { width: 100%; padding: 12px 12px 12px 40px; background: var(--input-bg); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 12px; outline: none; font-size: 15px; box-sizing: border-box;}

.history-list { display: flex; flex-direction: column; gap: 15px; }
.history-card { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 16px; padding: 20px; text-align: left; }
.hc-top { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-color); padding-bottom: 15px; margin-bottom: 15px; align-items: center;}
.hc-date { color: var(--text-main); font-weight: bold; font-size: 18px; display: flex; align-items: center; gap: 10px;}
.hc-actions button { background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 5px; margin-left: 10px;}
.hc-actions button:hover { color: var(--zalo-yellow); }
.hc-actions .btn-del:hover { color: var(--red-text); }

.hc-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 16px; align-items: center;}
.hc-label { color: var(--text-muted); }
.hc-val { color: var(--text-main); font-weight: bold; }
.hc-val.highlight { color: var(--zalo-yellow); font-size: 18px;}

.hc-images { display: flex; gap: 10px; margin-top: 15px; overflow-x: auto; padding-bottom: 5px;}
.hc-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-color); cursor: pointer; }
.hc-note { background: var(--kpi-bg); padding: 12px 15px; border-radius: 8px; margin-top: 15px; font-size: 14px; font-style: italic; color: var(--text-muted); border-left: 3px solid var(--zalo-yellow);}
.hc-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px dashed var(--border-color); }

/* =========================================
   🚀 BỘ KHUNG POPUP SIÊU BỌC THÉP (ycFA)
   Chống lún, chống đè, chuẩn 100% Mobile & PC
========================================= */
.modal-overlay { 
    position: fixed !important; 
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; 
    background: rgba(0,0,0,0.85) !important; 
    z-index: 99999 !important; 
    display: none; 
    justify-content: center !important; 
    align-items: flex-end !important; /* Mobile bật từ dưới lên */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Trên PC thì hiện ở giữa màn hình */
@media (min-width: 769px) {
    .modal-overlay { align-items: center !important; }
}

.modal-content { 
    position: relative !important;
    z-index: 100000 !important;
    background: var(--bg-card); 
    width: 100%; 
    max-width: 600px; 
    border-radius: 24px 24px 0 0; /* Bo góc trên cho Mobile */
    padding: 25px; 
    box-sizing: border-box; 
    transform: translateY(100%); 
    transition: transform 0.3s ease-out; 
    max-height: 90vh !important; 
    overflow-y: auto !important;
}

@media (min-width: 769px) {
    .modal-content { border-radius: 20px !important; transform: scale(0.9); }
}

.modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

/* Riêng Lịch sử tích lũy ép căn trên cho dễ nhìn */
#history-modal { align-items: flex-start !important; padding-top: 50px !important; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.modal-header h3 { margin: 0; font-size: 22px; color: var(--text-main); }
.btn-close-modal { background: var(--header-bg); border: none; width: 35px; height: 35px; border-radius: 50%; color: var(--text-main); font-size: 16px; cursor: pointer; }

.radio-group { display: flex; gap: 15px; margin-bottom: 20px; }
.radio-group label { flex: 1; text-align: center; padding: 14px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 12px; cursor: pointer; font-weight: bold; color: var(--text-muted); transition: 0.2s;}
.radio-group input { display: none; }
.radio-group input:checked + span { color: var(--zalo-yellow); }
.radio-group label:has(input:checked) { border-color: var(--zalo-yellow); background: rgba(240, 185, 11, 0.1); }

.form-row { margin-bottom: 20px; text-align: left; }
.form-row label { display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;}
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 15px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 12px; color: var(--text-main); font-size: 16px; outline: none; font-family: inherit; box-sizing: border-box;}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--zalo-yellow); }
.read-number { display: block; text-align: left; color: var(--green-text); font-size: 13px; margin-top: 8px; font-style: italic; min-height: 18px;}

.tabs { display: flex; gap: 15px; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;}
.tab-btn { background: transparent; border: none; color: var(--text-muted); font-size: 16px; font-weight: bold; cursor: pointer; padding: 5px 10px; }
.tab-btn.active { color: var(--zalo-yellow); border-bottom: 2px solid var(--zalo-yellow); }
.tab-content { display: none; } .tab-content.active { display: block; animation: fadeIn 0.3s; }

.img-preview-box { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 15px;}
.img-preview-wrapper { position: relative; }
.img-preview { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border-color); cursor: pointer;}
.img-remove { position: absolute; top: -5px; right: -5px; background: var(--red-text); color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; justify-content: center; align-items: center; font-size: 12px; cursor: pointer; }
.btn-submit-form { width: 100%; background: var(--zalo-yellow); color: #000; font-weight: bold; font-size: 18px; padding: 18px; border: none; border-radius: 12px; margin-top: 15px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px;}

/* FAB & CHUÔNG */
.fab-add { position: fixed; bottom: 30px; right: 30px; width: 65px; height: 65px; background: var(--zalo-yellow); color: #000; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 30px; border: none; box-shadow: 0 4px 20px rgba(240, 185, 11, 0.4); cursor: pointer; z-index: 1000; transition: 0.3s; }
.fab-add:hover { transform: scale(1.1) rotate(90deg); }

.floating-bell-container { position: fixed; bottom: 30px; left: 30px; z-index: 1000; display: flex; align-items: center; gap: 15px; cursor: pointer; }
.floating-bell { background: var(--green-text); color: #000; width: 65px; height: 65px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 30px; box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4); animation: shakeBell 1.5s infinite; transition: 0.3s; }
.floating-bell:hover { transform: scale(1.1); animation: none; }
.bell-tooltip { background: var(--bg-card); color: var(--text-main); padding: 10px 18px; border-radius: 8px; font-size: 15px; font-weight: bold; border: 1px solid var(--border-color); opacity: 0; transform: translateX(-20px); transition: 0.3s; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.floating-bell-container:hover .bell-tooltip { opacity: 1; transform: translateX(0); }

@keyframes shakeBell { 0%, 50%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(15deg); } 20%, 40% { transform: rotate(-15deg); } }
@keyframes rippleGold { 0% { box-shadow: 0 0 0 0 rgba(240, 185, 11, 0.7); } 70% { box-shadow: 0 0 0 25px rgba(240, 185, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(240, 185, 11, 0); } }
@keyframes rippleGreen { 0% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7); } 70% { box-shadow: 0 0 0 25px rgba(0, 255, 136, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); } }
@keyframes shakeBox { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.anim-shake-gold { animation: shakeBox 0.4s ease-in-out, rippleGold 1.2s ease-out; border-color: #f0b90b !important; }
.anim-ripple-green { animation: rippleGreen 1.2s ease-out; }

/* FOOTER */
.footer-section { background: var(--bg-card); border-top: 1px solid var(--border-color); padding: 40px 20px 20px; margin-top: 60px; text-align: left; }
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; margin-bottom: 30px; }
.footer-brand h3 { color: #f0b90b; margin: 0 0 15px 0; font-size: 24px; }
.footer-brand p { color: var(--text-muted); font-size: 15px; max-width: 400px; line-height: 1.6; margin: 0;}
.footer-contact h4 { color: var(--text-main); font-size: 18px; margin: 0 0 15px 0; text-transform: uppercase;}
.footer-contact p { color: var(--text-muted); font-size: 15px; margin: 10px 0; display: flex; align-items: center; gap: 10px; }
.footer-contact i { color: #f0b90b; width: 20px; text-align: center;}
.footer-disclaimer { max-width: 1200px; margin: 0 auto; border-top: 1px dashed var(--border-color); padding-top: 25px; text-align: center; }
.footer-disclaimer p { color: var(--text-muted); font-size: 13px; line-height: 1.8; margin: 0 0 15px 0; padding: 0 15px;}
.footer-disclaimer strong { color: var(--red-text); }
.copyright { color: var(--text-muted); font-size: 14px; font-weight: bold; }

/* MEDIA QUERIES */
@media (max-width: 768px) {
    /* =========================================
       🚀 ĐỒNG BỘ GRID HEADER CHO CẢ 3 TRANG (CHUẨN INDEX)
    ========================================= */
    .header-container > div:first-child {
        display: grid !important;
        grid-template-columns: 1fr auto auto !important; /* 🚀 Chia làm 3 cột: Logo, Theme, User */
        gap: 10px !important;
        align-items: center !important;
    }
    
    /* Lột vỏ thẻ div bọc ngoài cụm Menu + User */
    .header-container > div:first-child > div:nth-child(2) {
        display: contents !important; 
    }
    
    /* Hàng 1: Logo (Cột 1) */
    .header-container h1 { grid-column: 1; grid-row: 1; font-size: 20px !important; }
    .header-container h1 img { width: 28px !important; height: 28px !important; }
    
    /* Hàng 1: Theme (Cột 2) */
    .header-container .btn-theme-toggle {
        grid-column: 2; grid-row: 1; justify-self: end; 
        margin: 0 !important; padding: 6px 12px !important; font-size: 14px !important;
    }
    
    /* Hàng 1: User / Đăng nhập (Cột 3) */
    .header-container > div:first-child > div:nth-child(2) > div:last-child {
        grid-column: 3; grid-row: 1; justify-self: end;
    }

    /* Hàng 2: Trọn vẹn 100% chiều ngang cho Menu lướt */
    .header-container .main-nav-group {
        grid-column: 1 / span 3 !important; /* 🚀 Trải dài chiếm trọn 3 cột */
        grid-row: 2 !important;
        width: 100% !important;
        display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; 
        scrollbar-width: none; -webkit-overflow-scrolling: touch !important; 
        gap: 5px !important; padding-right: 15px !important; padding-bottom: 5px !important;
    }
    .header-container .main-nav-group::-webkit-scrollbar { display: none !important; }
    .main-nav-btn { font-size: 13px !important; padding: 6px 8px !important; white-space: nowrap !important; flex-shrink: 0 !important; }
    
    /* Bóp nhỏ User Info và nút Login cho gọn */
    #user-info { 
        padding: 4px 10px 4px 4px !important; 
        gap: 5px !important; 
    }
    #user-avatar { width: 26px !important; height: 26px !important; } 
    #user-name { font-size: 13px !important; } 
    .btn-logout { font-size: 15px !important; } 
    #btn-login-top { font-size: 12px !important; padding: 6px 12px !important; }
    
    /* Gắn lại các CSS cũ cho Mobile */
    .calculator-section { margin-left: 10px; margin-right: 10px; padding: 20px; }
    .tables-wrapper { padding: 0 10px; }
    .domestic-section { padding: 15px 8px; margin-bottom: 10px; border-radius: 12px; } 
    
    .gold-table th { padding: 10px 4px; font-size: 11px; white-space: normal; } 
    .gold-table td { padding: 10px 4px; font-size: 13px; white-space: normal; }
    
    .brand-icon { width: 20px; height: 20px; }
    .brand-name { font-size: 12px; }
    
    .diff-box { flex-direction: column !important; gap: 4px !important; font-size: 13px !important; align-items: flex-end; }
    .diff-label { font-size: 11px; margin-right: 2px; }

    .container { gap: 8px; padding: 0 10px; }
    .price-card { padding: 10px 5px; border-radius: 8px; }
    .card-icon { font-size: 24px; margin-bottom: 5px; }
    .card-title { font-size: 11px; margin-bottom: 4px; }
    .price { font-size: 16px; }
    .price-vnd { font-size: 11px; padding-top: 4px; border-top: none; }
    
    .conversion-grid { flex-direction: row; gap: 10px; }
    .conversion-card { padding: 12px; }
    .conversion-title { font-size: 12px !important; }
    .conversion-value { font-size: 16px !important; }

    .fab-add { bottom: 20px; right: 20px; width: 55px; height: 55px; font-size: 24px; }
    .floating-bell-container { bottom: 20px; left: 20px; }
    .floating-bell { width: 55px; height: 55px; font-size: 24px; }
    .bell-tooltip { display: none; }
    
    .kpi-grid { gap: 10px; }
    .kpi-box { padding: 15px; border-radius: 12px;}
    .kpi-title { font-size: 12px; margin-bottom: 5px; align-items: flex-start;}
    .kpi-icon { top: 12px; right: 12px; width: 24px; height: 24px; font-size: 12px;}
    .kpi-value { font-size: 20px; }
    .pl-val-text { font-size: 20px; }
    
    .history-card { padding: 15px; }
    .hc-row { font-size: 14px; margin-bottom: 8px;}
    .hc-val.highlight { font-size: 15px; }
}

/* NÚT CHIA SẺ MỚI (Xanh lá cực cháy) */
.btn-share {
    color: #00ff88 !important;
    background: rgba(0, 255, 136, 0.1) !important;
    border: 1px solid #00ff88 !important;
    margin-right: 5px;
    transition: 0.3s;
}
.btn-share:hover {
    background: #00ff88 !important;
    color: #000 !important;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
    transform: translateY(-2px);
}
/* =========================================
   MENU ĐIỀU HƯỚNG NHANH (HAMBURGER)
========================================= */
#nav-menu-btn {
    position: fixed;
    top: 5px; /* 👈 Kéo thẳng lên trên cùng, lọt thỏm vào thanh vàng */
    left: 10px;
    z-index: 995;
    background: var(--bg-card); /* Giữ màu nền tối cho nổi bật trên nền vàng */
    color: var(--zalo-yellow);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 36px; /* 👈 Thu nhỏ lại một chút để vừa vặn với chiều cao thanh vàng */
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s;
}

#nav-menu-btn:hover {
    background: var(--zalo-yellow);
    color: #000;
}

#nav-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    backdrop-filter: blur(3px);
}

#nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nav-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 10001;
    transition: left 0.3s ease-in-out;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.nav-sidebar.active {
    left: 0;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 15px;
    border-bottom: 1px dashed var(--border-color);
}

.nav-header h3 {
    margin: 0; 
    color: var(--zalo-yellow); 
    font-size: 18px;
}

.nav-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.nav-close-btn:hover { 
    color: var(--red-text); 
}

.nav-links {
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow-y: auto;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    padding: 15px 10px;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: 0.2s;
}

.nav-links a i {
    width: 25px;
    color: var(--text-muted);
    transition: 0.2s;
}

.nav-links a:hover {
    color: var(--zalo-yellow);
    background: rgba(240, 185, 11, 0.05);
    border-radius: 8px;
}

.nav-links a:hover i {
    color: var(--zalo-yellow);
}
/* =========================================
   🚀 FIX LỖI MODAL TRÀN NGANG TRÊN ĐIỆN THOẠI 
========================================= */
@media (max-width: 480px) {
    /* 1. Trảm tận gốc mọi hành vi trượt ngang của toàn website */
    body {
        overflow-x: hidden !important; 
    }
    
    /* 2. Bóp khung Form nhường 5% lề mỗi bên, bo góc đẹp mắt */
    #entry-modal .modal-content {
        width: 90% !important;      
        max-width: 360px !important; 
        margin: auto !important;
        padding: 20px 15px !important; 
        box-sizing: border-box !important;
        border-radius: 20px !important;
    }
    
    /* 4. Khóa chặt các ô Nhập Liệu (Input), cấm phóng to khi bấm vào (Lỗi của iPhone) */
    #entry-modal input, 
    #entry-modal select, 
    #entry-modal textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important; 
    }
}
/* 🚀 TRẢ LẠI GIAO DIỆN CŨ - THU NHỎ NÚT CHỐNG TRÀN NGANG */
@media (max-width: 768px) {
    #entry-modal .modal-content {
        width: 90% !important;
        max-width: 380px !important;
        margin: auto !important;
        padding: 20px 15px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* 3. Khóa kích thước các ô nhập liệu (Xếp dọc lại như cũ cho rộng rãi) */
    #entry-modal input, #entry-modal select {
        width: 100% !important;
        font-size: 14px !important;
        padding: 10px 8px !important;
        height: 42px !important;
        box-sizing: border-box !important;
    }
}
/* 🚀 STYLE CHO BĂNG CHUYỀN TIN TỨC */
.carousel-item {
    min-width: 100%;
    height: 100%;
    display: flex;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.carousel-img { width: 40%; height: 100%; object-fit: cover; }
.carousel-info { width: 60%; padding: 20px; display: flex; flex-direction: column; justify-content: center; text-align: left; background: linear-gradient(90deg, rgba(30,35,41,1) 0%, rgba(30,35,41,0.8) 100%); }
.carousel-title { color: #fff; font-size: 18px; font-weight: bold; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.carousel-sapo { color: var(--text-muted); font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.carousel-dot { width: 8px; height: 8px; background: rgba(255,255,255,0.3); border-radius: 50%; transition: 0.3s; }
.carousel-dot.active { background: #f0b90b; width: 20px; border-radius: 10px; }

@media (max-width: 600px) {
    .carousel-wrapper { height: 150px !important; }
    .carousel-title { font-size: 14px !important; }
    .carousel-sapo { display: none; }
}

/* 🚀 ĐỒNG BỘ LIGHT MODE CHO BĂNG CHUYỀN TIN TỨC */
[data-theme="light"] .carousel-info {
    background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(249,250,251,0.9) 100%) !important;
}
[data-theme="light"] .carousel-title {
    color: var(--text-main) !important;
}
[data-theme="light"] .carousel-dot {
    background: rgba(0,0,0,0.15) !important;
}
[data-theme="light"] .carousel-dot.active {
    background: var(--zalo-yellow) !important;
}
/* =========================================
   🛡️ KHIÊN BẢO VỆ ĐỘNG CHO BÀI BÁO (tin-tuc.html)
========================================= */
.detail-text, .detail-text * {
    color: var(--text-main) !important; /* 🚀 Tự động đổi màu Đen/Trắng theo Theme */
    background-color: transparent !important; /* Xóa mọi nền trắng đi kèm khi copy bài */
}

/* Giữ cho link (liên kết) có màu Vàng Zalo để khách dễ nhận biết */
.detail-text a {
    color: #f0b90b !important; 
    text-decoration: underline;
}
/* =========================================
   🛡️ ÉP CHỮ CĂN ĐỀU VÀ CHUẨN FORM BÁO CHÍ
========================================= */
.detail-text p, .detail-text div, .detail-text span {
    text-align: justify !important; /* Ép chữ phải căn đều 2 bên lề cực đẹp */
    line-height: 1.6 !important;
}

/* Riêng phần Hình Ảnh và Chú thích thì bắt buộc căn giữa màn hình */
.detail-text figure, .detail-text img, .detail-text figcaption {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
/* =========================================
   THANH DANH MỤC CỘNG ĐỒNG (MOBILE SCROLL NGANG)
========================================= */
#cat-tab-wrapper {
    display: flex !important; /* 🚀 ID mạnh nhất, đè bẹp Grid của Header */
    flex-direction: row !important;
    flex-wrap: nowrap !important; 
    justify-content: flex-start !important; 
    gap: 8px !important;
    padding: 10px 15px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    border-top: 1px solid var(--border-color) !important;
    scrollbar-width: none !important; 
    max-width: 1200px !important;
    margin: 0 auto !important;
    -webkit-overflow-scrolling: touch !important;
}
#cat-tab-wrapper::-webkit-scrollbar {
    display: none !important; 
}
.cat-tab { 
    padding: 8px 16px; 
    color: var(--text-muted); 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 14px; 
    border-radius: 20px; 
    transition: all 0.2s ease; 
    border: 1px solid transparent;
    background: transparent;
    user-select: none;
    display: flex !important; /* 🚀 Sửa lại từ inline-flex thành flex */
    align-items: center;
    gap: 6px;
    white-space: nowrap !important;
    flex-shrink: 0 !important; /* 🚀 Ép chết kích thước, không cho co bóp */
}
.cat-tab:hover { color: var(--text-main); background: var(--hover-bg); }
.cat-tab:active { transform: scale(0.92); }
.cat-tab.active { color: var(--zalo-yellow); background: rgba(240, 185, 11, 0.15); border: 1px solid var(--zalo-yellow); }

/* 🚀 Bóp nhỏ kích thước nút riêng cho màn hình Điện thoại */
@media (max-width: 768px) {
    .cat-tab {
        padding: 6px 12px !important;
        font-size: 13px !important;
        gap: 4px !important;
    }
}
