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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary-color: #475569;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --dark-color: #0f172a;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

* {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
}

body {
    background-color: var(--body-bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar-custom {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.18);
    padding: 0.9rem 0;
    margin-top: 0 !important;
    top: 0 !important;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.navbar-brand .school-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(8px);
}

/* Hero Header */
.hero-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #60a5fa 100%);
    border-radius: var(--radius-lg);
    padding: 2.2rem 2.5rem;
    color: white;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}
.hero-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Modern Cards */
.card-modern {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease-in-out;
}
.card-modern:hover {
    box-shadow: var(--shadow-md);
}

/* Stat Cards */
.stat-card-modern {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    height: 100%;
}
.stat-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(37, 99, 235, 0.3);
}
.stat-card-modern .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.stat-card-modern .stat-num {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0.4rem 0 0.1rem 0;
    color: var(--dark-color);
}
.stat-card-modern .stat-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Gradient Icon Backgrounds */
.icon-blue { background: #dbeafe; color: #1d4ed8; }
.icon-emerald { background: #d1fae5; color: #047857; }
.icon-rose { background: #ffe4e6; color: #e11d48; }
.icon-amber { background: #fef3c7; color: #b45309; }
.icon-purple { background: #f3e8ff; color: #7e22ce; }

/* Filter Box */
.filter-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem;
    margin-bottom: 1.8rem;
}
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Grade Stats Grid */
.grade-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    text-align: center;
    transition: all 0.2s;
}
.grade-box:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.grade-box .grade-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--secondary-color);
}
.grade-box .grade-count {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* Room Pill Badges */
.room-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    transition: all 0.2s;
}
.room-badge:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}
.room-badge .count {
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
}

/* Compact Room Grid (10 rooms per row) */
.room-grid-10 {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}
@media (max-width: 1199px) {
    .room-grid-10 {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}
@media (max-width: 991px) {
    .room-grid-10 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
@media (max-width: 575px) {
    .room-grid-10 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.room-badge-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.25rem 0.3rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    width: 100%;
}
.room-badge-compact:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.15);
}
.room-badge-compact .count-badge {
    background: var(--primary-color);
    color: #ffffff;
    border-radius: 6px;
    padding: 0.05rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
}
.room-badge-compact:hover .count-badge {
    background: #1d4ed8;
}

/* Grade Room Row & Label */
.grade-room-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.55rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: all 0.2s ease;
}
.grade-room-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.grade-label-pill {
    min-width: 68px;
    text-align: center;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
    letter-spacing: 0.5px;
    display: inline-block;
    flex-shrink: 0;
}

/* Modern Table */
.custom-table {
    border-collapse: separate;
    border-spacing: 0 4px;
    width: 100%;
}
.custom-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--border-color);
    padding: 0.75rem 0.8rem;
}
.custom-table tbody tr {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
}
.custom-table tbody tr:hover {
    background-color: #ffffff !important;
    transform: translateY(-3px) scale(1.004);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12), 0 3px 8px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 5;
}
.custom-table tbody td {
    padding: 0.65rem 0.8rem;
    vertical-align: middle;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    background: transparent;
}
.custom-table tbody tr td:first-child {
    border-left: 1px solid #f1f5f9;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.custom-table tbody tr td:last-child {
    border-right: 1px solid #f1f5f9;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}
.custom-table tbody tr:hover td:first-child {
    border-left-color: rgba(37, 99, 235, 0.3);
}
.custom-table tbody tr:hover td:last-child {
    border-right-color: rgba(37, 99, 235, 0.3);
}

/* Gender Pills */
.gender-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 400;
}
.gender-pill.male {
    background: #e0f2fe;
    color: #0369a1;
}
.gender-pill.female {
    background: #fce7f3;
    color: #be185d;
}

/* Student Photo 3:4 Rectangle with Rounded Corners */
.student-photo-34 {
    width: 48px;
    height: 64px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    display: inline-block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.student-photo-34:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Compact Table Styling */
.custom-table.table-compact th {
    padding: 0.5rem 0.4rem;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
}
.custom-table.table-compact td {
    padding: 0.4rem 0.4rem;
    font-size: 0.9rem;
    font-weight: 400;
    white-space: nowrap;
}

/* Buttons */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    transition: all 0.2s;
}
.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Admin Styling */
.admin-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.8rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

/* Footer */
footer {
    margin-top: auto;
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 1.2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}
