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

/**
 * TEACHER EXAM SYSTEM - DESIGN SYSTEM (SENIOR ARCHITECTURE)
 * ---------------------------------------------------------
 * Theme: Thai Government (Professional Blue & NFE Green)
 * Typography: Sarabun (Official) + Inter (UI Elements)
 */

:root {
    /* Primary Color Palette (Official & Trustworthy) */
    --primary: #1a4da1;        /* Royal Blue - Formal */
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    
    /* Secondary/Action Colors (NFE Green & Accents) */
    --secondary: #10b981;      /* Emerald Green - Success/Action */
    --accent: #f59e0b;         /* Amber - Warnings/Pending */
    --danger: #ef4444;         /* Red - Critical */
    
    /* Neutral Colors (Clean UI) */
    --bg-main: #f8fafc;        /* Soft Gray Background */
    --bg-sidebar: #ffffff;     /* White Sidebar */
    --bg-header: #ffffff;      /* White Header */
    --surface: #ffffff;        /* Pure White Surface */
    
    /* Text Colors */
    --text-main: #1e293b;      /* Slate 800 */
    --text-muted: #64748b;     /* Slate 500 */
    --text-on-primary: #ffffff;
    
    /* Borders & Glass */
    --border-light: #e2e8f0;   /* Slate 200 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    
    /* Spacing & Sizing */
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-lg: 0.75rem;
    --radius-md: 0.5rem;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Layout Architecture --- */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling - Clean & Professional */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: all 0.3s ease;
}

.sidebar-logo {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    line-height: 1.2;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.nav-item.active {
    background-color: #eff6ff;
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Header/Top Bar */
.top-bar {
    height: var(--header-height);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Components --- */

.container {
    padding: 2rem;
    max-width: 1400px;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Level Toggles (Provincial / District / Sub-district) */
.level-toggle {
    display: inline-flex;
    background: #e2e8f0;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.level-btn {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s;
}

.level-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Cards & Containers */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* --- Table Architecture (Senior Level) --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-light);
}

.data-table td {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-light);
    text-align: center;
}

.data-table tr:hover {
    background-color: #f1f5f9;
}

/* Nested Header Table Styles */
.data-table .sub-header {
    background-color: #f1f5f9;
    font-size: 0.8rem;
}

.text-left { text-align: left !important; }
.bg-total { background-color: #f0fdf4 !important; font-weight: 700; }

/* Forms & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.input, .select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: white;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input:focus, .select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { opacity: 0.9; }

/* Dashboard Widgets */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-widget {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    color: var(--primary);
    font-size: 1.5rem;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-info .label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Print Styles - เพื่อความสวยงามเวลาส่งออกเป็น PDF */
@media print {
    .sidebar, .top-bar, .btn, .level-toggle, .badge, .stat-widget {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #eee !important;
        margin-bottom: 2rem !important;
    }
}


