/* =====================================================
   EduPlatform – Main Stylesheet
   ===================================================== */

/* ── Variables ── */
:root {
    --sidebar-w: 260px;
    --topbar-h: 64px;

    --primary:    #6366f1;
    --primary-dk: #4f46e5;
    --success:    #22c55e;
    --warning:    #f59e0b;
    --danger:     #ef4444;
    --info:       #3b82f6;
    --secondary:  #64748b;

    --bg:         #f1f5f9;
    --surface:    #ffffff;
    --border:     #e2e8f0;
    --text:       #1e293b;
    --text-muted: #94a3b8;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --sidebar-hover: rgba(99,102,241,0.18);
    --sidebar-active: #6366f1;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

    --transition: 0.22s ease;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dk); }
input, select, textarea, button { font-family: inherit; }
img { max-width: 100%; }

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 24px; color: var(--primary); }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: 11px; }
.logout-btn {
    color: var(--sidebar-text);
    font-size: 16px;
    padding: 6px;
    border-radius: 6px;
    transition: color var(--transition);
}
.logout-btn:hover { color: var(--danger); }

/* ── Main Wrapper ── */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin var(--transition);
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--secondary);
    padding: 6px;
    border-radius: 6px;
    transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); }
.page-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; color: var(--text-muted); font-size: 13px; }

/* ── Content ── */
.content { flex: 1; padding: 28px 24px; }

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #fafafa 0%, #f8f9ff 100%);
}
.card-header h2, .card-header h3 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.card-header h2 i, .card-header h3 i { color: var(--primary); }
.card-body { padding: 20px 24px; }
.card-body.p-0 { padding: 0; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.stat-body h3 { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-body p  { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

.stat-blue   .stat-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-green  .stat-icon { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-purple .stat-icon { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.stat-orange .stat-icon { background: linear-gradient(135deg, #f97316, #c2410c); }
.stat-teal   .stat-icon { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.stat-emerald .stat-icon { background: linear-gradient(135deg, #10b981, #047857); }
.stat-red    .stat-icon { background: linear-gradient(135deg, #ef4444, #b91c1c); }

/* ── Table ── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background var(--transition); }
.table tbody tr:hover { background: #f8faff; }
.table tbody td { padding: 13px 16px; vertical-align: middle; }
.table tbody tr:last-child { border-bottom: none; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success  { background: #dcfce7; color: #166534; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-secondary{ background: #f1f5f9; color: #475569; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--primary);   color: #fff; }
.btn-success   { background: var(--success);   color: #fff; }
.btn-warning   { background: var(--warning);   color: #fff; }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-info      { background: var(--info);      color: #fff; }
.btn-secondary { background: #e2e8f0;          color: var(--text); }
.btn-meet      { background: #34a853;          color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn-group { display: flex; gap: 8px; align-items: center; }

/* ── Forms ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-control {
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-control-sm { padding: 6px 10px; font-size: 13px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; align-items: center; }

.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 42px; }
.password-toggle {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 14px;
}
.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500 !important;
}
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

/* ── Alerts ── */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 20px;
    position: relative;
    animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity:0; transform: translateY(-10px); } to { opacity:1; transform: translateY(0); } }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* ── Modals ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn .18s ease;
    padding: 16px;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    animation: scaleIn .2s ease;
    overflow: hidden;
}
.modal-lg { max-width: 600px; }
@keyframes scaleIn { from { opacity:0; transform: scale(.95); } to { opacity:1; transform: scale(1); } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}
.modal-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-header > button { background: none; border: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--text-muted); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── User Cell ── */
.user-cell { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dk));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.avatar-sm {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dk));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

/* ── Actions ── */
.actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

/* ── Search / Filter Bar ── */
.search-bar { margin-bottom: 0; }
.filters-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
}
.filter-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Inline Form ── */
.inline-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-form select { flex: 1; min-width: 200px; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; opacity: .4; }
.empty-state p { font-size: 15px; }

/* ── Detail Grid ── */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.detail-item {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border);
}
.detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.detail-value { font-size: 15px; font-weight: 600; }

/* ── Comments ── */
.comment-box { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 13.5px; }
.comment-teacher { background: #f0fdf4; border-left: 4px solid var(--success); }
.comment-admin   { background: #eff6ff; border-left: 4px solid var(--info); }
.comment-box p   { margin-top: 6px; color: #374151; }

/* ── Stars ── */
.stars { color: #f59e0b; font-size: 16px; letter-spacing: 2px; }
.stars.small { font-size: 13px; }

/* ── Star Input ── */
.star-input { display: flex; flex-direction: row-reverse; gap: 4px; }
.star-input input[type=radio] { display: none; }
.star-input label { font-size: 26px; color: #d1d5db; cursor: pointer; transition: color .1s; }
.star-input input[type=radio]:checked ~ label,
.star-input label:hover, .star-input label:hover ~ label { color: #f59e0b; }

/* ── Quick Links ── */
.quick-links h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.quick-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow);
}
.quick-card:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.quick-card i { font-size: 24px; color: var(--primary); }

/* ── Utilities ── */
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-blue  { color: var(--info); }
.text-green { color: var(--success); }

/* ── Login Page ── */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 20px;
}
.login-wrapper { width: 100%; max-width: 440px; }
.login-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo i { font-size: 48px; color: var(--primary); display: block; margin-bottom: 12px; }
.login-logo h1 { font-size: 24px; font-weight: 800; }
.login-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-form    { display: flex; flex-direction: column; gap: 18px; }
.login-demo    { margin-top: 24px; text-align: center; font-size: 12.5px; color: var(--text-muted); }
.login-demo p  { margin-bottom: 10px; }
.demo-creds    { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.demo-creds span {
    padding: 5px 14px;
    background: #f1f5f9;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background var(--transition);
}
.demo-creds span:hover { background: #e0e7ff; color: var(--primary); }

/* ── Session Detail ── */
.session-detail .card { margin-bottom: 0; }

/* ── Reports ── */
.reports-page { display: flex; flex-direction: column; gap: 0; }

/* ── Sidebar Collapsed ── */
.sidebar-collapsed .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
.sidebar-collapsed .main-wrapper { margin-left: 0; }

/* ── Responsive ── */
@media (max-width: 1024px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-full { grid-column: 1; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 240px; }
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .content { padding: 20px 16px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .topbar { padding: 0 16px; }
    .filter-form { flex-direction: column; align-items: stretch; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: 1fr 1fr; }
    .table thead { display: none; }
    .table tbody tr { display: block; padding: 12px 16px; border-bottom: 2px solid var(--border); }
    .table tbody td { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border: none; }
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        color: var(--text-muted);
        text-transform: uppercase;
    }
}
