/* =====================
   GLOBAL STYLES
   ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* =====================
   MOBILE RESPONSIVE
   ===================== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
}

/* =====================
   HEADER / NAV
   ===================== */
header {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
}

.user-name {
    font-size: 14px;
    opacity: 0.9;
}

/* Desktop: Hide menu button */
@media (min-width: 992px) {
    .menu-btn {
        display: none;
    }

    .app-title {
        font-size: 20px;
    }

    .user-name {
        font-size: 14px;
    }
}

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

.header-logo {
    height: 60px;
    width: auto;
    max-width: 160px;
    border-radius: 4px;
    object-fit: contain;
}

.header-logo:not([src]),
.header-logo[src=""] {
    content: "🎓";
    font-size: 24px;
}

/* Fallback if logo fails to load */
.header-logo.error::before {
    content: "🎓";
    font-size: 24px;
}

/* =====================
   SIDEBAR / DRAWER
   ===================== */
.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 200;
    overflow-y: auto;
    padding-bottom: 80px;
}

/* Desktop: Always visible sidebar */
@media (min-width: 992px) {
    .sidebar {
        position: static;
        left: 0;
        height: auto;
        box-shadow: none;
        border-right: 1px solid #e0e0e0;
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
    }

    .sidebar-nav {
        flex: 1;
    }
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    padding: 20px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-user-info {
    font-size: 12px;
    opacity: 0.9;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-nav:last-of-type {
    border-bottom: none;
}

.nav-section-title {
    padding: 12px 16px 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.5px;
    display: block;
}

.sidebar-nav li:not(.nav-section-title) {
    border: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.nav-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background: #f5f5f5;
    color: #1976D2;
}

.nav-link.active {
    background: #E3F2FD;
    color: #1976D2;
    border-left: 4px solid #1976D2;
    padding-left: 12px;
    font-weight: 600;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #f0f0f0;
    padding: 16px;
}

/* Desktop: Footer not absolute */
@media (min-width: 992px) {
    .sidebar-footer {
        position: static;
        margin-top: auto;
    }
}

.logout-btn {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 4px;
    color: #d32f2f;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #ffebee;
}

/* =====================
   OVERLAY
   ===================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    display: none;
}

.overlay.show {
    display: block;
}

/* Desktop: Hide overlay */
@media (min-width: 992px) {
    .overlay {
        display: none !important;
    }
}

/* =====================
   MAIN CONTENT
   ===================== */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-width: 100%;
}

/* Desktop layout: Header above, sidebar left, main right */
@media (min-width: 992px) {
    .app-container {
        flex-direction: row;
        flex-wrap: wrap;
    }

    header {
        width: 100%;
        padding: 16px 24px;
    }

    .sidebar {
        width: 260px;
        height: calc(100vh - 60px);
        overflow-y: auto;
        flex-shrink: 0;
    }

    main {
        flex: 1;
        padding: 24px;
        min-width: 0;
    }
}

/* =====================
   SCREENS
   ===================== */
.screen {
    display: none;
    animation: slideIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================
   LOGIN SCREEN
   ===================== */
.login-container {
    max-width: 400px;
    margin: 40px auto;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
}

/* Desktop: Larger login container */
@media (min-width: 992px) {
    .login-container {
        margin: 0 auto;
        max-width: 450px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }
}

.login-logo {
    text-align: center;
    font-size: 48px;
    margin-bottom: 20px;
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #1976D2;
    margin-bottom: 8px;
}

.login-subtitle {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 12px;
}

.login-links a {
    color: #1976D2;
    text-decoration: none;
}

/* =====================
   DASHBOARD
   ===================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* Tablet and up: 2 columns */
@media (min-width: 576px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Desktop: 3 columns for stats, or 2 for others */
@media (min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        margin-bottom: 30px;
    }
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #1976D2;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: #1976D2;
}

.stat-card.accent {
    border-left-color: #4CAF50;
}

.stat-card.accent .stat-value {
    color: #4CAF50;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    margin-top: 24px;
}

.profile-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-label {
    color: #666;
    font-weight: 500;
}

.profile-value {
    color: #333;
    font-weight: 600;
}

/* =====================
   CARDS & LISTS
   ===================== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 16px;
}

.list-item {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: #f9f9f9;
}

.list-item-main {
    flex: 1;
}

.list-item-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.list-item-subtitle {
    font-size: 12px;
    color: #999;
}

.list-item-value {
    text-align: right;
    font-weight: 600;
    color: #1976D2;
    font-size: 16px;
}

/* =====================
   BUTTONS
   ===================== */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: #1976D2;
    color: white;
}

.btn-primary:hover {
    background: #1565C0;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-outline {
    background: white;
    color: #1976D2;
    border: 2px solid #1976D2;
}

.btn-outline:hover {
    background: #E3F2FD;
}

.btn-block {
    display: block;
    width: 100%;
}

/* =====================
   CHARTS & PROGRESS
   ===================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: #1976D2;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* =====================
   UTILITIES
   ===================== */
.text-center {
    text-align: center;
}

.text-muted {
    color: #999;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.gap-16 {
    gap: 16px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-column {
    flex-direction: column;
}

/* Content wrapper for max-width on desktop */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    main {
        max-width: 1400px;
    }
}

/* =====================
   LOADING & EMPTY STATES
   ===================== */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    color: #999;
    font-size: 14px;
}
