/* ============================================
   ACADEMICHUB – Design System & Global Styles
   ============================================ */

/* CSS Variables */
:root {
    /* Colors */
    --bg-primary: #0a0e27;
    --bg-secondary: #111638;
    --bg-tertiary: #1a1f4a;
    --bg-card: rgba(26, 31, 74, 0.6);
    --bg-glass: rgba(26, 31, 74, 0.45);
    --bg-input: rgba(17, 22, 56, 0.8);

    --accent-primary: #7c3aed;
    --accent-primary-hover: #6d28d9;
    --accent-secondary: #06b6d4;
    --accent-tertiary: #f59e0b;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;

    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --gradient-hero: linear-gradient(135deg, #0a0e27 0%, #1a1050 40%, #0a0e27 100%);
    --gradient-card: linear-gradient(145deg, rgba(124, 58, 237, 0.08) 0%, rgba(6, 182, 212, 0.06) 100%);
    --gradient-accent: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #06b6d4 100%);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #a78bfa;

    --border-color: rgba(124, 58, 237, 0.2);
    --border-hover: rgba(124, 58, 237, 0.45);
    --border-glass: rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
    --shadow-glow-accent: 0 0 20px rgba(6, 182, 212, 0.15);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fs-xs: 0.75rem;
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 1.875rem;
    --fs-4xl: 2.25rem;
    --fs-5xl: 3rem;
    --fs-6xl: 3.75rem;
    --fw-light: 300;
    --fw-normal: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-extrabold: 800;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Borders & Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --nav-height: 70px;
    --max-width: 1280px;
    --sidebar-width: 280px;
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(124, 58, 237, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-primary);
}

img {
    max-width: 100%;
    display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--fw-bold);
    line-height: 1.25;
    color: var(--text-primary);
}

h1 {
    font-size: var(--fs-5xl);
}

h2 {
    font-size: var(--fs-3xl);
}

h3 {
    font-size: var(--fs-2xl);
}

h4 {
    font-size: var(--fs-xl);
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Selection */
::selection {
    background: rgba(124, 58, 237, 0.35);
    color: var(--text-primary);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.text-gradient {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-extrabold);
    margin-bottom: var(--space-2);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: var(--fs-lg);
    max-width: 600px;
}

/* Page fade-in animation */
.page-enter {
    animation: pageEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* Grid */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: var(--fs-3xl);
    }

    h2 {
        font-size: var(--fs-2xl);
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 1000;
    transition: background var(--transition-base);
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-8);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.6rem;
    animation: float 3s ease-in-out infinite;
}

.logo-text {
    font-size: var(--fs-xl);
    font-weight: var(--fw-extrabold);
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.logo-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav-link {
    padding: var(--space-2) var(--space-4);
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(124, 58, 237, 0.1);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    z-index: 1001;
}

.nav-hamburger span {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.nav-hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: calc(var(--nav-height) + var(--space-6)) var(--space-6) var(--space-6);
        gap: var(--space-2);
        transition: right var(--transition-slow);
        border-left: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        z-index: 999;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-link {
        width: 100%;
        padding: var(--space-3) var(--space-4);
    }

    .nav-actions .btn-sm {
        display: none;
    }
}

/* App main area */
.app-main {
    min-height: 100vh;
    padding-top: var(--nav-height);
    position: relative;
    z-index: 1;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: 10000;
}

.toast {
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    animation: slideUp 0.3s ease forwards;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.toast.success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.toast.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.toast.info {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
    border-color: rgba(6, 182, 212, 0.3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    animation: fadeIn 0.2s ease;
    padding: var(--space-6);
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: var(--space-8);
}

/* Navbar User Dropdown */
.nav-user-menu {
    position: relative;
}

.nav-avatar-btn {
    background: none;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 2px;
    border-radius: var(--radius-full);
    transition: border-color var(--transition-fast);
}

.nav-avatar-btn:hover {
    border-color: var(--accent-primary);
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: scaleIn 0.15s ease;
    z-index: 1100;
}

.nav-dropdown-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown-header strong {
    font-size: var(--fs-sm);
    color: var(--text-primary);
}

.nav-dropdown-email {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--border-glass);
}

.nav-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-dropdown-item:hover {
    background: rgba(124, 58, 237, 0.1);
    color: var(--text-primary);
}