/* ==============================================================================
   ACADEMIC E-LEARNING PLATFORM DESIGN SYSTEM
   Includes Dark Glassmorphism, Centered Login, Dynamic Learner Gauges, and Floating AI Tutor Chat.
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(18, 25, 41, 0.85);
    --card-hover: rgba(26, 36, 59, 0.95);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --secondary: #64748b;
    --accent: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.12);
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-dark); color: var(--text-primary); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }

/* NAVBAR */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; background: rgba(11, 15, 25, 0.9); backdrop-filter: blur(12px); border-bottom: var(--glass-border); position: sticky; top: 0; z-index: 100; }
.nav-container { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 1200px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 0.75rem; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); cursor: pointer; }
.brand-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.nav-user-badge { display: flex; align-items: center; gap: 1rem; }
.btn-logout { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); padding: 0.4rem 0.85rem; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-logout:hover { background: rgba(239, 68, 68, 0.3); }

/* LANGUAGE SWITCHER */
.lang-switcher { display: flex; align-items: center; gap: 0.5rem; background: rgba(0,0,0,0.3); padding: 0.25rem 0.6rem; border-radius: 8px; border: var(--glass-border); }
.lang-btn { background: transparent; border: none; color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 0.2rem 0.5rem; border-radius: 6px; transition: all 0.2s; }
.lang-btn.active { background: var(--primary); color: white; box-shadow: 0 0 8px var(--primary-glow); }
.lang-btn:hover:not(.active) { color: var(--text-primary); }

/* MAIN CONTENT CONTAINER */
.main-content { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* AUTHENTICATION SECTION - PERFECTLY CENTERED CARD */
.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: calc(100vh - 120px);
    width: 100%;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    transition: all 0.3s ease;
}

.role-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: var(--glass-border);
}

.role-tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.role-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.demo-credentials-box {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    border: var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.demo-badge { font-weight: 600; color: #60a5fa; margin-bottom: 0.4rem; }
.demo-row { margin-top: 0.2rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; }

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
}
.form-control:focus { outline: none; border-color: var(--primary); }

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover { box-shadow: 0 0 16px var(--primary-glow); transform: translateY(-1px); }
.btn-full { width: 100%; padding: 0.8rem; font-size: 1rem; margin-top: 0.5rem; }

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border: var(--glass-border);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); }

.alert-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    text-align: center;
}
.alert-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

/* DASHBOARD LAYOUT & CARDS */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1.5rem; }
.card-widget { background: var(--card-bg); border: var(--glass-border); border-radius: var(--radius); padding: 1.5rem; backdrop-filter: blur(8px); transition: all 0.2s ease; }
.card-widget:hover { border-color: rgba(59, 130, 246, 0.3); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 0.5rem; flex-wrap: nowrap !important; }
.card-header h3 { white-space: nowrap !important; font-size: 0.95rem; margin: 0; }

/* BADGES & PROGRESS BARS */
.role-pill { font-size: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 12px; font-weight: 700; text-transform: uppercase; }
.role-pill.STUDENT { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.role-pill.TEACHER { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.role-pill.ADMIN { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }

.progress-bar-bg { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; margin-top: 0.4rem; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.4s ease; }

/* USER TABLES */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 0.75rem; border-radius: 8px; border: var(--glass-border); }
.user-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.user-table th, .user-table td { padding: 0.85rem 1.1rem; text-align: left; border-bottom: var(--glass-border); white-space: nowrap !important; vertical-align: middle; }
.user-table th { background: rgba(0,0,0,0.35); color: var(--text-secondary); font-weight: 600; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.05em; }

/* MODALS */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-card { background: #0f172a; border: var(--glass-border); border-radius: 16px; padding: 1.75rem; width: 100%; max-width: 550px; box-shadow: 0 20px 40px rgba(0,0,0,0.6); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }

/* FLOATING AI TUTOR CHAT WIDGET (E-Learning Redesign) */
.ai-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.25);
    font-size: 1.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(6, 182, 212, 0.45), 0 0 0 0 rgba(6, 182, 212, 0.4);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: aiFabPulse 3s infinite;
}
.ai-fab:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 14px 36px rgba(6, 182, 212, 0.65), 0 0 20px rgba(59, 130, 246, 0.5);
}

@keyframes aiFabPulse {
    0% { box-shadow: 0 10px 28px rgba(6, 182, 212, 0.45), 0 0 0 0 rgba(6, 182, 212, 0.5); }
    70% { box-shadow: 0 10px 28px rgba(6, 182, 212, 0.45), 0 0 0 14px rgba(6, 182, 212, 0); }
    100% { box-shadow: 0 10px 28px rgba(6, 182, 212, 0.45), 0 0 0 0 rgba(6, 182, 212, 0); }
}

.ai-chat-modal {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    width: 460px;
    max-width: calc(100vw - 2rem);
    height: 620px;
    max-height: calc(100vh - 7rem);
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(6, 182, 212, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: tutorSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tutorSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
    padding: 0.9rem 1.25rem;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tutor-avatar-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(56, 189, 248, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.tutor-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    display: inline-block;
    margin-right: 4px;
}

/* Hide native scrollbars on scrollable mode bars while preserving smooth scrolling */
.chat-mode-bar::-webkit-scrollbar,
.quick-prompts-bar::-webkit-scrollbar {
    display: none;
}
.chat-mode-bar,
.quick-prompts-bar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-mode-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mode-pill {
    padding: 0.38rem 0.5rem;
    border-radius: 12px;
    font-size: 0.76rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    text-align: center;
}
.mode-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.mode-pill.active {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}

.chat-body {
    flex: 1;
    padding: 1.1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

/* Custom sleek scrollbar for chat body */
.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 10px;
}
.chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.6);
}

.chat-bubble {
    max-width: 88%;
    padding: 0.85rem 1.1rem;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
}
.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.chat-bubble.ai {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.ai-bubble-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #38bdf8;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.3rem;
}

.quick-prompts-bar {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.quick-prompt-btn {
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.25);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.quick-prompt-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.chat-footer {
    padding: 0.85rem 1rem;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.chat-footer input {
    flex: 1;
    padding: 0.7rem 1.1rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    color: white;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}
.chat-footer input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25);
    background: rgba(0, 0, 0, 0.5);
}

.chat-send-btn {
    border-radius: 24px;
    padding: 0.65rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.chat-send-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.5);
}

/* Typing Indicator Dots */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0;
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    animation: typingBlink 1.4s infinite both;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* TOAST NOTIFICATION & CONFIRMATION MODAL */
.toast-container { position: fixed; top: 1.5rem; right: 1.5rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.75rem; max-width: 420px; width: 90%; pointer-events: none; }
.toast-card { pointer-events: auto; background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(16px); border-radius: 12px; padding: 1rem 1.25rem; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 0.5rem; position: relative; overflow: hidden; animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid rgba(255, 255, 255, 0.1); }
.toast-card.success { border-color: rgba(16, 185, 129, 0.5); background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(15, 23, 42, 0.95) 100%); }
.toast-card.error { border-color: rgba(239, 68, 68, 0.5); background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(15, 23, 42, 0.95) 100%); }
.toast-card.warning { border-color: rgba(245, 158, 11, 0.5); background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(15, 23, 42, 0.95) 100%); }
.toast-card.info { border-color: rgba(59, 130, 246, 0.5); background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(15, 23, 42, 0.95) 100%); }

.toast-header { display: flex; justify-content: space-between; align-items: center; }
.toast-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.95rem; }
.toast-timer-badge { background: rgba(255, 255, 255, 0.15); border-radius: 12px; padding: 0.15rem 0.5rem; font-size: 0.75rem; font-weight: 700; }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 4px; width: 100%; transition: width 0.1s linear; }
.toast-card.success .toast-progress { background: #10b981; }
.toast-card.error .toast-progress { background: #ef4444; }
.toast-card.warning .toast-progress { background: #f59e0b; }
.toast-card.info .toast-progress { background: #3b82f6; }

@keyframes toastSlideIn { from { transform: translateX(100%) scale(0.9); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }
@keyframes toastFadeOut { from { transform: translateX(0) scale(1); opacity: 1; } to { transform: translateX(50px) scale(0.9); opacity: 0; } }

.custom-confirm-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 10001; padding: 1rem; }
.custom-confirm-card { background: #0f172a; border: 1px solid rgba(239, 68, 68, 0.5); border-radius: 16px; padding: 2rem; width: 100%; max-width: 450px; box-shadow: 0 24px 48px rgba(0, 0, 0, 0.85); text-align: center; margin: auto; }

/* ACTION DROPDOWN STYLES */
.dropdown-item-btn:hover { background: rgba(255, 255, 255, 0.08) !important; }

