/* ============================================
   Students Management System - Clean Design
   ============================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --electric: #f59e0b;
    --electronic: #06b6d4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', 'Cairo', 'Tahoma', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* LOGIN */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    padding: 20px;
}
.login-card {
    background: white;
    border-radius: 20px;
    padding: 36px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.logo-icon { font-size: 4rem; text-align: center; }
.logo-title { text-align: center; color: var(--primary); font-size: 1.7rem; margin-bottom: 4px; }
.logo-subtitle { text-align: center; color: var(--text-light); margin-bottom: 24px; font-size: 0.9rem; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    font-family: inherit;
}
.btn-login:hover { background: var(--primary-dark); }

.error-msg { color: var(--danger); text-align: center; margin-top: 12px; font-size: 0.9rem; min-height: 20px; }

.demo-users { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.demo-title { text-align: center; color: var(--text-light); font-size: 0.85rem; margin-bottom: 12px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.demo-btn {
    padding: 14px 8px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.2s;
}
.demo-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }
.demo-btn span { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.demo-btn strong { display: block; font-size: 0.85rem; }
.demo-btn small { color: var(--text-light); font-size: 0.75rem; }
.demo-btn.principal { border-color: #6366f1; color: #6366f1; }
.demo-btn.tech { border-color: #f59e0b; color: #f59e0b; }
.demo-btn.admin-office { border-color: #06b6d4; color: #06b6d4; }
.demo-btn.student-affairs { border-color: #ec4899; color: #ec4899; }

/* APP LAYOUT */
.app-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: white;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
}
.sidebar-brand { font-size: 1.2rem; font-weight: 800; color: #c7d2fe; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.15); }
.user-card { background: rgba(255,255,255,0.08); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.user-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-size: 1.1rem; }
.user-name { font-weight: 700; font-size: 0.95rem; }
.user-role { font-size: 0.78rem; color: #c7d2fe; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-icon { font-size: 1.1rem; min-width: 22px; text-align: center; }
.btn-logout {
    width: 100%;
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: auto;
    font-family: inherit;
}
.btn-logout:hover { background: var(--danger); color: white; }

.main-content { padding: 28px; overflow-y: auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 1.7rem; color: #1e1b4b; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: white; padding: 18px; border-radius: 12px; display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border-right: 4px solid; }
.kpi-icon { font-size: 1.8rem; width: 50px; text-align: center; }
.kpi-value { font-size: 1.6rem; font-weight: 800; }
.kpi-label { color: var(--text-light); font-size: 0.85rem; }

/* CARDS */
.card { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px; overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); background: #f8fafc; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.card-header h2 { font-size: 1.05rem; color: #1e1b4b; }
.card-body { padding: 18px; }

/* DEPARTMENTS */
.dept-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.dept-tab {
    padding: 10px 18px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
}
.dept-tab.active-electric { background: var(--electric); color: white; border-color: var(--electric); }
.dept-tab.active-electronic { background: var(--electronic); color: white; border-color: var(--electronic); }
.dept-tab:hover:not(.active-electric):not(.active-electronic) { border-color: var(--primary); }

.dept-card { padding: 16px; border-radius: 10px; margin-bottom: 10px; border-right: 4px solid; }
.dept-card.electric { background: #fef3c7; border-color: var(--electric); }
.dept-card.electronic { background: #cffafe; border-color: var(--electronic); }
.dept-card h3 { margin-bottom: 8px; }
.dept-card p { color: var(--text-light); font-size: 0.9rem; }

/* TABLES */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafc; padding: 10px 12px; text-align: right; font-weight: 700; font-size: 0.85rem; color: #1e1b4b; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table tr:hover { background: #f8fafc; }
.data-table tr.dropout { background: rgba(239,68,68,0.05); }
.data-table tr.graduate { background: rgba(16,185,129,0.05); }
.data-table tr.failed { background: rgba(245,158,11,0.05); }

/* BUTTONS */
.btn-primary { background: var(--primary); color: white; border: none; padding: 10px 18px; border-radius: 8px; cursor: pointer; font-weight: 600; font-family: inherit; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; font-family: inherit; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; font-family: inherit; }
.btn-warning { background: var(--warning); color: white; border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; font-family: inherit; }
.btn-info { background: var(--info); color: white; border: none; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; font-family: inherit; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; border-radius: 5px; border: none; cursor: pointer; font-weight: 600; font-family: inherit; margin: 0 2px; }

/* BADGES */
.badge { padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-graduate { background: #d1fae5; color: #065f46; }
.badge-dropout { background: #fee2e2; color: #991b1b; }
.badge-failed { background: #fef3c7; color: #92400e; }
.badge-separated { background: #e0e7ff; color: #3730a3; }
.badge-electric { background: #fef3c7; color: #92400e; }
.badge-electronic { background: #cffafe; color: #155e75; }

/* BARCODE PAGE */
.barcode-card {
    background: white;
    padding: 16px;
    border-radius: 10px;
    border: 2px solid #000;
    text-align: center;
    width: 280px;
    display: inline-block;
    margin: 8px;
    page-break-inside: avoid;
}
.barcode-card h4 { margin-bottom: 6px; font-size: 0.95rem; }
.barcode-card svg { max-width: 100%; height: 60px; }
.barcode-card .info { font-size: 0.75rem; color: var(--text-light); margin-top: 4px; }

.print-btn { background: var(--success); color: white; padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 700; font-family: inherit; font-size: 1rem; }
.print-btn:hover { background: #059669; }

@media print {
    .sidebar, .page-header button, .no-print, .dept-tabs, #navList, .btn-logout { display: none !important; }
    .main-content { padding: 0 !important; }
    body { background: white !important; }
    .app-layout { grid-template-columns: 1fr !important; }
    .page-header h1 { color: #000 !important; }
    .data-table { font-size: 0.85rem; }
    .kpi-card { border: 1px solid #ccc !important; page-break-inside: avoid; }
}

/* MOBILE */
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { padding: 12px; }
    .sidebar-brand { display: none; }
    .nav-item { font-size: 0.85rem; padding: 8px 10px; }
    .nav-item span:not(.nav-icon) { display: none; }
    .main-content { padding: 16px; }
    .demo-grid { grid-template-columns: 1fr; }
}
