/* 
   Premium Apple Aesthetics - Modern UX/UI Stylesheet for Lottery Web App
   Target Audience: 35-60 Years, High Contrast, High Legibility, 4G Optimized
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@700;800&display=swap');

:root {
    --apple-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --apple-font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --card-bg-light: #ffffff;
    --card-bg-dark: #1e1e1e;
    --border-light: #e2e8f0;
    --border-dark: #333333;
}

body {
    font-family: var(--apple-font-sans) !important;
    background-color: #f8fafc;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}

/* 1. Perfect Monospace Lottery Numbers & Readable Sizes */
.xs_number, 
.xs_prize, 
.giai-db, 
.giaidb, 
.giai-dac-biet, 
td.giaidb, 
.xs_prize_col, 
.xs_prize_row td, 
.box-result td,
table.bkqtinhmienbac td,
table.rightcl td {
    font-family: var(--apple-font-mono) !important;
    font-weight: 800 !important;
    font-size: 22px !important;
    letter-spacing: 0.5px !important;
    padding: 10px 5px !important;
    text-align: center !important;
}

/* Make Special Prize super bold, large and high-contrast red */
.xs_number_db, 
td.giaidb, 
.giaidb,
.giai-db,
.giai-dac-biet {
    font-size: 28px !important;
    color: #ef4444 !important;
    background-color: #fef2f2 !important;
    font-weight: 800 !important;
}

/* 2. Responsive Cards & Containers */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.content-left {
    flex: 1;
    min-width: 0; /* Prevents overflow */
}

/* Elegant Apple Card Shadows */
.widget, 
.box-result, 
.stats-card,
.pascal-card,
.dream-list-item,
.content-block {
    background: var(--card-bg-light);
    border: 1px solid var(--border-light) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05) !important;
    padding: 20px !important;
    margin-bottom: 24px !important;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget:hover, 
.box-result:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08) !important;
}

/* Title Styling */
.widget-title, 
.title-c, 
.widget_bg h3 {
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    margin-bottom: 15px !important;
}

/* 3. Mobile Layout Optimizations */
@media only screen and (max-width: 768px) {
    .main-content {
        flex-direction: column !important;
        padding: 10px !important;
    }
    
    .aside-160, 
    .aside-300 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Move Search / Dò vé widget to top on mobile */
    .mobile-top-search {
        order: -1 !important;
        margin-bottom: 15px !important;
    }

    /* Prevent horizontal scrolling in tables */
    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Bigger numbers on mobile */
    .xs_number, .xs_prize {
        font-size: 20px !important;
    }
    td.giaidb, .giaidb {
        font-size: 24px !important;
    }
}

/* 4. Skeleton Loading Effects */
.skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    width: 100%;
}
.skeleton-line {
    height: 35px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes loading-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 5. Elegant Day Bubble Navigation for Province/Region Pages */
.day-bubble-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0 25px 0;
    flex-wrap: wrap;
}
.day-bubble-item {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}
.day-bubble-item:hover, 
.day-bubble-item.active {
    background: var(--theme-color, #c80505) !important;
    color: #ffffff !important;
    border-color: var(--theme-color, #c80505) !important;
    box-shadow: 0 4px 10px rgba(200, 5, 5, 0.2);
}

/* 6. Clean Ads Containers (No Layout Shift) */
.ads-premium-container {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 8px;
    margin: 20px 0;
    text-align: center;
    position: relative;
    min-height: 100px;
}
.ads-premium-container::before {
    content: 'TÀI TRỢ / QUẢNG CÁO';
    display: block;
    font-size: 9px;
    color: #94a3b8;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    text-align: left;
    padding-left: 8px;
    font-weight: bold;
}

/* 7. Dark Mode Integration (Apple Pro Tones) */
body.dark-mode {
    background-color: #09090b !important;
    color: #f4f4f5 !important;
}

body.dark-mode .widget, 
body.dark-mode .box-result, 
body.dark-mode .stats-card,
body.dark-mode .pascal-card,
body.dark-mode .dream-list-item,
body.dark-mode .content-block,
body.dark-mode .pushbar {
    background: #18181b !important;
    border-color: #27272a !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode .xs_number, 
body.dark-mode .xs_prize,
body.dark-mode td,
body.dark-mode th,
body.dark-mode table,
body.dark-mode tr {
    background-color: #27272a !important;
    color: #f4f4f5 !important;
    border-color: #3f3f46 !important;
}

body.dark-mode .day-bubble-item {
    background: #27272a;
    color: #d4d4d8;
    border-color: #3f3f46;
}

body.dark-mode .day-bubble-item:hover,
body.dark-mode .day-bubble-item.active {
    background: var(--theme-color, #c80505) !important;
    color: #ffffff !important;
}

body.dark-mode td.giaidb, 
body.dark-mode .giaidb,
body.dark-mode .giai-db,
body.dark-mode .giai-dac-biet {
    background-color: #270f0f !important;
    color: #f87171 !important;
    border-color: #3f3f46 !important;
}

body.dark-mode .ads-premium-container {
    background: #1e1e24 !important;
    border-color: #2e2e38 !important;
}

/* Sound and countdown widgets */
.live-countdown-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: white;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.15);
}

body.dark-mode .live-countdown-banner {
    background: linear-gradient(135deg, #18181b, #09090b);
}

/* 8. Mobile Dò Vé Top Replacement Layout Control */
.mobile-only-dove {
    display: none;
}
@media only screen and (max-width: 768px) {
    .mobile-only-dove {
        display: block !important;
        margin-bottom: 24px !important;
    }
    .aside-300 > .widget:first-of-type {
        display: none !important;
    }
}

/* 9. Premium 2-Column Layout Overrides for Desktop */
@media only screen and (min-width: 961px) {
    .aside-300 {
        width: 300px !important;
        flex-shrink: 0 !important;
        float: none !important;
    }
    .aside-160 {
        display: none !important;
    }
    .content-left {
        flex: 1 !important;
        float: none !important;
        padding-right: 0 !important;
        width: auto !important;
    }
}

/* 10. Regional Color Branding & Monospace Typography Settings */
:root {
    --color-mn: #e11d48; /* Crimson red for Southern region */
    --color-mt: #2563eb; /* Cobalt blue for Central region */
    --color-mb: #16a34a; /* Forest green for Northern region */
}

.xs_prize1,
.xs_prize2,
.xs_prize3,
.prize1,
.prize2,
.prize3,
.prize4,
.prize5,
.prize6,
.prize7,
.prize8,
.xs_number_db,
td.giaidb,
.giaidb,
.giai-db,
.giai-dac-biet,
.color_red {
    font-family: var(--apple-font-mono) !important;
    font-weight: 700 !important;
}

/* Special Prize (GĐB) */
.xs_number_db, 
td.giaidb, 
.giaidb,
.giai-db,
.giai-dac-biet,
.color_red {
    font-size: clamp(24px, 4vw, 32px) !important;
    color: #ef4444 !important;
    background-color: #fef2f2 !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
}

/* First Prize (G1) */
.prize1, td.giai1, .giai1 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
}

/* Middle Prizes (G2, G3) */
.prize2, .prize3, td.giai2, td.giai3, .giai2, .giai3 {
    font-size: 18px !important;
    font-weight: 600 !important;
}

/* Small Prizes (G4 to G8) */
.prize4, .prize5, .prize6, .prize7, .prize8,
td.giai4, td.giai5, td.giai6, td.giai7, td.giai8,
.giai4, .giai5, .giai6, .giai7, .giai8,
.xs_prize1, .xs_prize2, .xs_prize3 {
    font-size: 15px !important;
    font-weight: 500 !important;
}

/* 11. Blink Animation for Drawing Cells */
@keyframes pending-blink {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}
.xs-pending, .xs_pending, .img-loading, .blink {
    animation: pending-blink 1s infinite ease-in-out !important;
}

/* 12. AdSense Layout Stability Slots (Zero-CLS) */
.ads-slot-header {
    min-height: 90px;
    width: 100%;
    margin: 15px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}
body.dark-mode .ads-slot-header {
    background: #18181b;
    border-color: #3f3f46;
}

.ads-slot-mid {
    min-height: 100px;
    width: 100%;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}
body.dark-mode .ads-slot-mid {
    background: #18181b;
    border-color: #3f3f46;
}

.ads-slot-sidebar {
    min-height: 250px;
    width: 100%;
    margin: 15px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}
body.dark-mode .ads-slot-sidebar {
    background: #18181b;
    border-color: #3f3f46;
}

.ads-slot-footer {
    min-height: 90px;
    width: 100%;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}
body.dark-mode .ads-slot-footer {
    background: #18181b;
    border-color: #3f3f46;
}

