/* ============================================
   COHORT LMS — Design System v2
   Navy + Orange · Instrument Serif headings
   Vyrobek-style wordmark · EdPlus layout
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --navy: #0C1E3C;
    --navy-2: #132347;
    --navy-3: #1A2D5A;
    --navy-text: #1a2942;

    --orange: #E8612D;
    --orange-hover: #d4551f;
    --orange-bg: #FEF4F0;
    --orange-pale: #FFF0EB;

    --bg: #FFFFFF;
    --bg-2: #F7F8FA;
    --bg-3: #EEF1F5;
    --bg-card: #FFFFFF;
    --bg-sidebar: var(--navy);
    --bg-sidebar-hover: var(--navy-2);
    --bg-sidebar-active: var(--navy-3);

    --text: #1E293B;
    --text-2: #4B5563;
    --text-3: #9CA3AF;
    --text-inverse: #FFFFFF;
    --text-sidebar: rgba(255,255,255,.5);
    --text-sidebar-active: #FFFFFF;

    --blue: #3B82F6;
    --blue-light: #EFF6FF;
    --green: #10B981;
    --green-light: #ECFDF5;
    --red: #EF4444;
    --red-light: #FEF2F2;
    --purple: #8B5CF6;
    --purple-light: #F5F3FF;
    --yellow: #F59E0B;
    --teal: #14B8A6;
    --teal-light: #F0FDFA;

    --border: #E5E7EB;

    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --sidebar-width: 256px;
    --header-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg: 0 12px 36px rgba(0,0,0,.08);

    --transition: 0.2s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--orange); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--orange-hover); }
img { max-width: 100%; height: auto; }

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

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    position: fixed; top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}
.sidebar-brand {
    padding: 22px 24px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand .logo-text {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 400;
    color: var(--text-sidebar-active);
    letter-spacing: -0.02em;
}
.sidebar-brand .logo-dot { color: var(--orange); font-size: 30px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.sidebar-section { margin-bottom: 24px; }
.sidebar-section-title {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-3);
    padding: 0 12px; margin-bottom: 6px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: var(--text-sidebar); font-size: 14px; font-weight: 500;
    transition: all var(--transition);
}
.sidebar-link:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); }
.sidebar-link.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); font-weight: 600; }
.sidebar-link svg { width: 18px; height: 18px; opacity: 0.5; flex-shrink: 0; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-course-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.sidebar-user {
    padding: 16px; border-top: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-sidebar-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

/* ---- Main Content ---- */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; }

.top-bar {
    height: var(--header-height); background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; position: sticky; top: 0; z-index: 50;
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.breadcrumb a { color: var(--text-2); }
.breadcrumb .sep { color: var(--text-3); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

.top-bar-right { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 32px; max-width: 1200px; }
.page-content.wide { max-width: 1400px; }

.page-title {
    font-family: var(--font-display); font-size: 28px; font-weight: 400;
    color: var(--navy-text); margin-bottom: 8px; letter-spacing: -0.01em;
}
.page-subtitle { font-size: 15px; color: var(--text-2); margin-bottom: 28px; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 18px 24px; border-bottom: 1px solid var(--bg-3);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 400; color: var(--navy-text); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--bg-3); background: var(--bg-2); }

/* Course cards */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }

.course-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: all var(--transition); cursor: pointer; text-decoration: none; color: inherit; display: block;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; }

.course-card-banner {
    height: 120px; position: relative;
    display: flex; align-items: flex-end; padding: 16px 20px;
}
.course-card-banner::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
}
.course-card-code {
    position: relative; z-index: 1; font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px); padding: 3px 10px; border-radius: 99px;
}
.course-card-body { padding: 20px; }
.course-card-title { font-family: var(--font-display); font-size: 18px; font-weight: 400; margin-bottom: 6px; line-height: 1.3; color: var(--navy-text); }
.course-card-meta { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 12px; }
.course-card-meta span { display: flex; align-items: center; gap: 4px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; font-family: var(--font-body);
    font-size: 14px; font-weight: 600; border-radius: 8px;
    border: none; cursor: pointer; transition: all var(--transition);
    text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-hover); color: white; }
.btn-secondary { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #DC2626; color: white; }
.btn-meet { background: #1A73E8; color: white; }
.btn-meet:hover { background: #1557B0; color: white; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-group { display: flex; gap: 8px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; font-family: var(--font-body); font-size: 14px;
    color: var(--text); background: var(--bg-card);
    border: 1.5px solid var(--border); border-radius: 8px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-pale);
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-help { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
table th {
    text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3);
    background: var(--bg-2); border-bottom: 1px solid var(--border);
}
table td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--bg-3); }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg-2); }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    font-size: 11px; font-weight: 700; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-amber { background: var(--orange-bg); color: var(--orange); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--bg-3); margin-bottom: 24px; }
.tab {
    padding: 10px 20px; font-size: 14px; font-weight: 500;
    color: var(--text-2); border-bottom: 2px solid transparent;
    margin-bottom: -2px; cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ---- Alerts ---- */
.alert { padding: 14px 18px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-error { background: var(--red-light); color: var(--red); }
.alert-info { background: var(--blue-light); color: var(--blue); }
.alert-warning { background: var(--orange-bg); color: var(--orange); }

/* ---- Avatar ---- */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 48px; height: 48px; }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 400; color: var(--navy-text); margin-top: 4px; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 8px; color: var(--navy-text); }

/* ---- Discussion ---- */
.discussion-post { display: flex; gap: 16px; padding: 20px; border-bottom: 1px solid var(--bg-3); }
.discussion-post:last-child { border-bottom: none; }
.discussion-post-content { flex: 1; }
.discussion-post-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.discussion-post-author { font-weight: 700; font-size: 14px; }
.discussion-post-time { font-size: 12px; color: var(--text-3); }

/* ---- Meet Bar ---- */
.meet-bar {
    background: linear-gradient(135deg, #1A73E8, #174EA6);
    color: white; padding: 14px 24px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;
}
.meet-bar-info { display: flex; align-items: center; gap: 12px; }
.meet-bar .live-dot { width: 10px; height: 10px; background: #34D399; border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ---- Grade Bar ---- */
.grade-bar { height: 8px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.grade-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }

/* ---- Notification dot ---- */
.notif-dot { width: 8px; height: 8px; background: var(--red); border-radius: 50%; position: absolute; top: -2px; right: -2px; }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--bg-3); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 400; color: var(--navy-text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--bg-3); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 20px; }

/* ---- Calendar ---- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar-day-header { padding: 8px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); background: var(--bg-2); }
.calendar-day { min-height: 100px; padding: 8px; background: var(--bg-card); font-size: 13px; }
.calendar-day.other-month { opacity: 0.4; }
.calendar-day.today { background: var(--orange-bg); }
.calendar-day-num { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.calendar-event { font-size: 11px; padding: 2px 6px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* ---- Hamburger ---- */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; color: var(--text); }
.menu-toggle svg { width: 24px; height: 24px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .page-content { padding: 20px 16px; }
    .course-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .top-bar { padding: 0 16px; }
}

/* ---- Utilities ---- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.text-muted { color: var(--text-2); } .text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
