/* 
 * web2569 Design System - Theme Variables & Utilities 
 * STRICT: All colors must be sourced from these variables.
 */

:root {
    /* Semantic Colors */
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --success-border: #10b981;

    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --danger-border: #ef4444;

    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --warning-border: #f59e0b;

    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --info-border: #3b82f6;

    --neutral-bg: #f8fafc;
    --neutral-text: #1e293b;
    --neutral-border: #e2e8f0;

    /* Dashboard Layout Specific */
    --nav-bg: #4469ef;
    --bg-color: #f8fafc;
    --card-bg: white;
    
    /* Modern Menu Gradients */
    --grad-purple: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    --grad-blue: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --grad-green: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --grad-red: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
    --grad-orange: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --grad-magenta: linear-gradient(135deg, #d946ef 0%, #f472b6 100%);
    --grad-slate: linear-gradient(135deg, #475569 0%, #94a3b8 100%);

    /* Grade Colors */
    --grade-a: #10b981;
    --grade-b: #3b82f6;
    --grade-c: #8b5cf6;
    --grade-d: #f59e0b;
    --grade-f: #ef4444;
}

/* Base Layout */
body {
    font-family: 'Sarabun', 'Inter', sans-serif !important;
    background-color: #f8fafc;
    margin: 0;
    padding: 50px 0 0 0; /* Add top padding to account for fixed navbar */
    color: #1e293b;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Ensure all elements inherit Sarabun */
h1, h2, h3, h4, h5, h6, p, span, div, table, th, td, select, button, a {
    font-family: 'Sarabun', sans-serif !important;
}

.main-navbar {
    background: linear-gradient(-45deg, #4469ef, #3ff45e, #2e5bff, #36fb9a);
    background-size: 400% 400%;
    animation: gradientBG 300s ease infinite;
    color: white;
    padding: 0 40px;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.navbar-brand { font-weight: 600; font-size: 1.1rem; letter-spacing: 0.5px; }
.navbar-brand a { color: white; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.navbar-brand i { font-size: 1.25rem; opacity: 0.9; }
.nav-links { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: white; text-decoration: none; display: flex; align-items: center; gap: 5px; transition: opacity 0.2s; font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover { opacity: 0.8; }

.container {
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
    border-top: none;
    padding: 0;
    flex-grow: 1;
    width: 100%;
    box-sizing: border-box;
}

/* Home Page Header & Controls */
.header-section { 
    text-align: center; 
    margin-bottom: 40px; 
    padding: 20px 0;
}
.logo-img { 
    width: 90px; 
    height: auto; 
    margin-bottom: 20px; 
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}
.header-section h2 { 
    font-size: 1.8rem; 
    margin: 0 0 8px 0; 
    color: #0f172a; 
    font-weight: 800;
    letter-spacing: -0.02em;
}
.header-section h3 { 
    font-size: 1.25rem; 
    margin: 0; 
    color: #64748b; 
    font-weight: 600; 
}

.province-select { 
    width: 100%; 
    padding: 12px 20px; 
    font-size: 1rem; 
    font-family: 'Kanit', sans-serif; 
    border: 1px solid #e2e8f0; 
    border-radius: 12px; 
    margin-bottom: 30px; 
    color: #1e293b;
    background-color: #f8fafc;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.province-select:focus {
    outline: none;
    border-color: #4469ef;
    box-shadow: 0 0 0 4px rgba(68, 105, 239, 0.1);
    background: white;
}

.province-label { 
    text-align: center; 
    font-size: 1.6rem; 
    font-weight: 800; 
    color: #0f172a; 
    margin-bottom: 25px;
    letter-spacing: -0.02em;
}

/* Home Page Grid & Menu Boxes */
.grid-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-bottom: 40px; 
}

.menu-box { 
    border-radius: 16px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    color: white; 
    text-decoration: none; 
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
}

.menu-box:hover { 
    transform: translateY(-8px) scale(1.02); 
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); 
}

.menu-content { 
    padding: 28px; 
    flex-grow: 1; 
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}

.menu-content h3 { 
    margin: 0 0 8px 0; 
    font-size: 1.4rem; 
    font-weight: 800; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    line-height: 1.2;
}

.menu-content p { 
    margin: 0; 
    font-size: 0.9rem; 
    opacity: 0.85; 
    font-weight: 500;
}

.menu-footer { 
    background: rgba(0, 0, 0, 0.15); 
    padding: 12px 20px; 
    font-size: 0.85rem; 
    text-align: left; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-weight: 600;
}

.menu-footer i { transition: transform 0.3s; }
.menu-box:hover .menu-footer i { transform: translateX(5px); }

.bg-purple { background: var(--grad-purple); }
.bg-blue { background: var(--grad-blue); }
.bg-green { background: var(--grad-green); }
.bg-red { background: var(--grad-red); }
.bg-orange { background: var(--grad-orange); }
.bg-magenta { background: var(--grad-magenta); }
.bg-slate { background: var(--grad-slate); }

.site-footer { margin-top: auto; padding: 20px 40px; border-top: 1px solid var(--neutral-border); color: #666; font-size: 0.85rem; display: flex; justify-content: space-between; background: white; }


/* Base reset for table display */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--neutral-border);
}

/* Status Utilities (Pre-Calculated in Data) */
.status-passed {
    background-color: var(--success-bg) !important;
    color: var(--success-text) !important;
}

.status-failed {
    background-color: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

.status-warning {
    background-color: var(--warning-bg) !important;
    color: var(--warning-text) !important;
}

/* Grade Badge System */
.grade-badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-weight: bold;
    font-size: 0.85rem;
    color: white;
    text-transform: uppercase;
}

.grade-a { background-color: var(--grade-a); }
.grade-b { background-color: var(--grade-b); }
.grade-c { background-color: var(--grade-c); }
.grade-d { background-color: var(--grade-d); }
.grade-f { background-color: var(--grade-f); }

/* Text Utility Classes */
.text-growth { color: var(--success-text); font-weight: bold; }
.text-decline { color: var(--danger-text); font-weight: bold; }
