:root {
    /* Bootstrap Theme Overrides for Red Tone */
    --bs-primary: #dc2626;
    --bs-primary-rgb: 220, 38, 38;
    --bs-secondary: #991b1b;
    --bs-secondary-rgb: 153, 27, 27;
    --bs-success: #b91c1c; /* Success as dark red */
    --bs-success-rgb: 185, 28, 28;
    --bs-info: #ef4444; /* Info as slightly lighter red */
    --bs-info-rgb: 239, 68, 68;
    --bs-warning: #ea580c; /* Warning as warm orange */
    --bs-warning-rgb: 234, 88, 12;
    --bs-danger: #7f1d1d; /* Danger as very dark red */
    --bs-danger-rgb: 127, 29, 29;

    /* Custom Variables */
    --primary: #dc2626;
    --primary-hover: #b91c1c;
    --secondary: #991b1b;
    --secondary-hover: #7f1d1d;
    --dark: #450a0a; /* Dark Maroon for Sidebar/Headers */
    --light: #ffffff; /* White Background */
    --danger: #7f1d1d;
    --warning: #ea580c;
    --border: #fca5a5; /* Red-400 for borders */
    --surface: #ffffff;
    --text-main: #450a0a;
    --text-muted: #991b1b;
    --header-height: 70px;
    --sidebar-width: 260px;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--light);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* ====================================
   Stat Cards
   ==================================== */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.stat-card-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card-body {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card-unit {
    font-size: 0.85rem;
    font-weight: 400;
    color: #94a3b8;
}

/* Rose — โรงเรียนทั้งหมด (ธีมหลัก แต่อ่อนลง) */
.stat-card-rose .stat-card-icon {
    background-color: #fff1f2;
    color: #e11d48;
}
.stat-card-rose .stat-card-value { color: #be123c; }
.stat-card-rose { border-left: 4px solid #fda4af; }

/* Teal — ประเมินแล้ว */
.stat-card-teal .stat-card-icon {
    background-color: #f0fdfa;
    color: #0d9488;
}
.stat-card-teal .stat-card-value { color: #0f766e; }
.stat-card-teal { border-left: 4px solid #5eead4; }

/* Amber — ค้างประเมิน */
.stat-card-amber .stat-card-icon {
    background-color: #fffbeb;
    color: #d97706;
}
.stat-card-amber .stat-card-value { color: #b45309; }
.stat-card-amber { border-left: 4px solid #fcd34d; }

/* Indigo — นักศึกษาทั้งหมด */
.stat-card-indigo .stat-card-icon {
    background-color: #eef2ff;
    color: #4f46e5;
}
.stat-card-indigo .stat-card-value { color: #4338ca; }
.stat-card-indigo { border-left: 4px solid #a5b4fc; }

/* Slate — ยังไม่ประเมิน */
.stat-card-slate .stat-card-icon {
    background-color: #f8fafc;
    color: #475569;
}
.stat-card-slate .stat-card-value { color: #334155; }
.stat-card-slate { border-left: 4px solid #94a3b8; }

/* Premium Card */

.premium-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    overflow: hidden;
}

.premium-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background-color: rgba(254, 242, 242, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1.5rem;
}

/* Base Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-premium:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary));
    box-shadow: 0 6px 12px -2px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-premium-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.5rem 1.15rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-premium-outline:hover {
    background: var(--primary);
    color: white;
}

/* Linear Scale Radio */
.linear-scale {
    display: flex;
    justify-content: space-between;
    background: var(--light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.scale-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.scale-item input[type="radio"] {
    width: 24px;
    height: 24px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Forms */
.form-control-premium {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--surface);
    background-clip: padding-box;
    border: 1px solid var(--border);
    appearance: none;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control-premium:focus {
    color: var(--text-main);
    background-color: var(--surface);
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

/* ====================================
   School Search Component (Redesigned)
   ==================================== */
.school-search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.school-search-inner {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #fca5a5;
    border-radius: 50px;
    padding: 0 0.5rem 0 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.07);
}
.school-search-inner:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15), 0 4px 16px rgba(220, 38, 38, 0.12);
}

.school-search-icon {
    color: #fca5a5;
    font-size: 0.95rem;
    flex-shrink: 0;
    margin-right: 0.5rem;
    transition: color 0.25s ease, transform 0.25s ease;
}
.school-search-inner:focus-within .school-search-icon {
    color: var(--primary);
    transform: scale(1.15);
}

.school-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Sarabun', 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-main);
    padding: 0.65rem 0;
}
.school-search-input::placeholder {
    color: #fca5a5;
    font-weight: 400;
}

.school-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #fca5a5;
    font-size: 0.85rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 0.25rem;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.7);
}
.school-search-clear.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}
.school-search-clear:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--primary);
}

.school-search-meta {
    font-size: 0.78rem;
    color: #991b1b;
    padding-left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.search-count-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    min-width: 22px;
    height: 22px;
    border-radius: 50px;
    padding: 0 6px;
    text-align: center;
    line-height: 22px;
    transition: transform 0.2s ease;
}

/* ====================================
   Criteria Badge Colors (Semantic)
   ==================================== */
.badge-criteria-excellent {
    /* ดีมาก — Amber */
    background-color: #f59e0b;
    color: #fff;
}
.badge-criteria-good {
    /* ดี — Emerald Green */
    background-color: #10b981;
    color: #fff;
}
.badge-criteria-medium {
    /* ปานกลาง — Sky Blue */
    background-color: #0ea5e9;
    color: #fff;
}
.badge-criteria-fair {
    /* พอใช้ — Violet */
    background-color: #8b5cf6;
    color: #fff;
}
.badge-criteria-poor {
    /* ปรับปรุง — Slate Gray */
    background-color: #64748b;
    color: #fff;
}
.badge-criteria-incomplete {
    /* ประเมินไม่ครบ */
    background: #f1f5f9;
    color: #64748b;
    border: 1.5px dashed #94a3b8;
}

/* Accordion School Styling */
.accordion-button:not(.collapsed) {
    background-color: rgba(220, 38, 38, 0.08) !important;
    color: var(--primary) !important;
    box-shadow: inset 0 -1px 0 var(--border);
}
.accordion-button:hover {
    background-color: var(--light) !important;
    color: var(--primary) !important;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    text-decoration: none;
}

.sidebar-nav {
    padding: 1.5rem 0;
    flex-grow: 1;
}

.nav-link {
    color: rgba(255,255,255,0.7);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.1);
    border-left: 4px solid var(--primary);
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.page-content {
    padding: 2rem;
    flex-grow: 1;
    overflow-y: auto;
}

/* User Flow Pages Layout */
.user-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    background-image: 
        radial-gradient(at 0% 0%, hsla(353,100%,76%,0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(190,100%,75%,0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(353,100%,76%,0.05) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(353,100%,76%,0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

.user-header {
    background: linear-gradient(135deg, var(--dark) 0%, #0f172a 100%);
    padding: 3.5rem 0;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.user-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(220, 38, 38, 0.15) 0%, transparent 50%);
    animation: header-rotate 20s linear infinite;
    pointer-events: none;
}

@keyframes header-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.user-content {
    flex-grow: 1;
    padding: 4rem 1rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 10;
}

.type-card {
    text-align: center;
    padding: 3rem 2rem;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.type-card .card-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.15) 0%, rgba(220, 38, 38, 0) 70%);
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: 50%;
    pointer-events: none;
}

.type-card:hover .card-glow {
    opacity: 1;
}

.type-card:hover {
    transform: translateY(-12px);
    border-color: rgba(220, 38, 38, 0.3);
    box-shadow: 0 20px 40px -10px rgba(220, 38, 38, 0.15), 0 0 20px rgba(255,255,255,0.8) inset;
}

.type-icon-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.type-icon-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 130px;
    height: 130px;
    background: currentColor;
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    transition: all 0.5s ease;
}

.type-card:hover .type-icon-wrapper::before {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.1;
}

.type-icon {
    font-size: 3rem;
    width: 90px;
    height: 90px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
}

.type-card-mentor .type-icon {
    color: var(--primary);
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.type-card-mentor:hover .type-icon {
    background: linear-gradient(135deg, var(--primary) 0%, #b91c1c 100%);
    color: white;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px -10px rgba(220, 38, 38, 0.5);
}

.type-card-mentor .type-icon-wrapper { color: var(--primary); }

.type-card-admin .type-icon {
    color: #4f46e5;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.type-card-admin:hover .type-icon {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 15px 30px -10px rgba(79, 70, 229, 0.5);
}

.type-card-admin .type-icon-wrapper { color: #4f46e5; }
.type-card-admin:hover {
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.15), 0 0 20px rgba(255,255,255,0.8) inset;
}
.type-card-admin .card-glow {
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(79, 70, 229, 0) 70%);
}

.card-action {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.type-card:hover .card-action {
    opacity: 1;
    transform: translateY(0);
}

.btn-text {
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    font-size: 1.05rem;
}

.type-card-mentor .btn-text { color: var(--primary); }
.type-card-admin .btn-text { color: #4f46e5; }

.transition-icon {
    transition: transform 0.3s ease;
}

.type-card:hover .transition-icon {
    transform: translateX(5px);
}

.table-responsive {
    overflow-x: auto;
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
}

.table-premium th {
    background-color: var(--light);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.table-premium td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table-premium tr:last-child td {
    border-bottom: none;
}

.table-premium tbody tr:hover {
    background-color: rgba(254, 242, 242, 0.5);
}

/* ====================================
   Premium Tabs
   ==================================== */
.nav-premium {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 50px;
    display: inline-flex;
    gap: 0.5rem;
    border: 1px solid var(--border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.nav-premium .nav-item {
    margin: 0;
}

.nav-premium .nav-link {
    color: #475569 !important;
    border: none;
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
    font-weight: 600 !important;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.nav-premium .nav-link:hover:not(.active) {
    color: var(--primary) !important;
    background: rgba(220, 38, 38, 0.05) !important;
}

.nav-premium .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover)) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

