/*
 * Flat Grayscale Professional Theme
 * LMS MVP - Minimalist Dark Theme with Complex Grid Animation
 */

:root {
    /* Pure grayscale palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #222222;
    --bg-hover: #2a2a2a;
    --bg-active: #333333;

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --text-subtle: #505050;
    --text-inverse: #0a0a0a;

    /* Accent colors - grayscale */
    --accent-primary: #ffffff;
    --accent-secondary: #909090;
    --accent-light: #d0d0d0;
    --accent-dark: #404040;

    /* Borders and shadows */
    --border-color: #2a2a2a;
    --border-subtle: #1f1f1f;
    --border-strong: #404040;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing scale */
    --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;

    /* Grid system */
    --grid-gap: 1.5rem;
    --grid-gap-sm: 1rem;
    --grid-gap-lg: 2rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Breakpoints reference */
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
}

/* ============================================
   RESET & BASE
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

/* ============================================
   COMPLEX GRID BACKGROUND ANIMATION
   ============================================ */

.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Main grid pattern */
.grid-base {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* Secondary smaller grid overlay */
.grid-secondary {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Animated grid that moves */
.grid-moving {
    position: absolute;
    top: -60px;
    left: -60px;
    right: -60px;
    bottom: -60px;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 2px, transparent 2px);
    background-size: 60px 60px;
    animation: gridSlide 20s linear infinite;
}

/* Grid intersection highlights */
.grid-nodes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: nodePulse 4s ease-in-out infinite;
}

/* Horizontal scan line */
.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 20%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 80%,
        transparent 100%
    );
    animation: scanVertical 8s ease-in-out infinite;
}

.scan-line-2 {
    animation: scanVertical 12s ease-in-out infinite reverse;
    animation-delay: 4s;
}

/* Vertical scan line */
.scan-line-v {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 20%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.08) 80%,
        transparent 100%
    );
    animation: scanHorizontal 10s ease-in-out infinite;
}

.scan-line-v-2 {
    animation: scanHorizontal 14s ease-in-out infinite reverse;
    animation-delay: 5s;
}

/* Grid cell highlights - rectangular */
.grid-highlight {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
    animation: cellPulse 6s ease-in-out infinite;
}

.grid-highlight-1 {
    width: 120px;
    height: 120px;
    top: 15%;
    left: 10%;
    animation-delay: 0s;
}

.grid-highlight-2 {
    width: 180px;
    height: 60px;
    top: 40%;
    right: 15%;
    animation-delay: 2s;
}

.grid-highlight-3 {
    width: 60px;
    height: 180px;
    bottom: 20%;
    left: 25%;
    animation-delay: 4s;
}

.grid-highlight-4 {
    width: 240px;
    height: 120px;
    top: 60%;
    right: 25%;
    animation-delay: 1s;
}

.grid-highlight-5 {
    width: 120px;
    height: 60px;
    top: 25%;
    right: 35%;
    animation-delay: 3s;
}

/* Corner accents */
.corner-accent {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: rgba(255, 255, 255, 0.1);
    border-style: solid;
    animation: cornerFade 5s ease-in-out infinite;
}

.corner-tl {
    top: 10%;
    left: 5%;
    border-width: 2px 0 0 2px;
}

.corner-tr {
    top: 20%;
    right: 8%;
    border-width: 2px 2px 0 0;
    animation-delay: 1.5s;
}

.corner-bl {
    bottom: 25%;
    left: 12%;
    border-width: 0 0 2px 2px;
    animation-delay: 3s;
}

.corner-br {
    bottom: 15%;
    right: 10%;
    border-width: 0 2px 2px 0;
    animation-delay: 4.5s;
}

/* Data flow lines - horizontal */
.data-line {
    position: absolute;
    height: 1px;
    background: transparent;
    overflow: hidden;
}

.data-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100px;
    width: 100px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: dataFlow 4s linear infinite;
}

.data-line-1 {
    top: 30%;
    left: 0;
    right: 0;
}

.data-line-2 {
    top: 55%;
    left: 0;
    right: 0;
    animation-delay: 1.5s;
}

.data-line-2::after {
    animation-delay: 1.5s;
}

.data-line-3 {
    top: 75%;
    left: 0;
    right: 0;
    animation-delay: 3s;
}

.data-line-3::after {
    animation-delay: 3s;
}

/* Crosshair elements */
.crosshair {
    position: absolute;
    width: 40px;
    height: 40px;
    opacity: 0.1;
    animation: crosshairPulse 3s ease-in-out infinite;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
}

.crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}

.crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
}

.crosshair-1 {
    top: 20%;
    left: 20%;
}

.crosshair-2 {
    top: 50%;
    right: 15%;
    animation-delay: 1s;
}

.crosshair-3 {
    bottom: 30%;
    left: 40%;
    animation-delay: 2s;
}

/* Keyframe Animations */
@keyframes gridSlide {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

@keyframes nodePulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes scanVertical {
    0% { top: -10%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 110%; opacity: 0; }
}

@keyframes scanHorizontal {
    0% { left: -10%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 110%; opacity: 0; }
}

@keyframes cellPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
        border-color: rgba(255, 255, 255, 0.15);
        background: rgba(255, 255, 255, 0.03);
    }
}

@keyframes cornerFade {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes dataFlow {
    0% { left: -100px; }
    100% { left: 100%; }
}

@keyframes crosshairPulse {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.2); }
}

/* Static grid fallback */
.bg-grid {
    position: relative;
}

.bg-grid::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

@media (max-width: 768px) {
    h1 { font-size: 1.875rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

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

a:hover {
    opacity: 0.7;
}

/* ============================================
   CONTAINER - Responsive
   ============================================ */

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

@media (min-width: 576px) {
    .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
    .container { padding: 0 var(--space-8); }
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }
.container-fluid { max-width: 100%; }

/* ============================================
   RESPONSIVE GRID SYSTEM
   ============================================ */

.grid {
    display: grid;
    gap: var(--grid-gap);
}

/* Auto-fit responsive grids */
.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-sm {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-auto-lg {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* Fixed column grids - Mobile first */
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
.grid-5 { grid-template-columns: 1fr; }
.grid-6 { grid-template-columns: 1fr; }

/* Small screens (576px+) */
@media (min-width: 576px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .grid-6 { grid-template-columns: repeat(2, 1fr); }
}

/* Medium screens (768px+) */
@media (min-width: 768px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .grid-6 { grid-template-columns: repeat(3, 1fr); }

    .grid { gap: var(--grid-gap); }
}

/* Large screens (1024px+) */
@media (min-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .grid-5 { grid-template-columns: repeat(5, 1fr); }
    .grid-6 { grid-template-columns: repeat(6, 1fr); }

    .grid { gap: var(--grid-gap-lg); }
}

/* Grid gap variations */
.gap-0 { gap: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid span utilities */
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-full { grid-column: 1 / -1; }

@media (max-width: 768px) {
    .col-span-2,
    .col-span-3,
    .col-span-full {
        grid-column: span 1;
    }
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-base);
}

@media (min-width: 768px) {
    .card { padding: var(--space-6); }
}

.card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-strong);
}

.card-elevated {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-2px);
}

.card-compact {
    padding: var(--space-3);
}

@media (min-width: 768px) {
    .card-compact { padding: var(--space-4); }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .btn { padding: var(--space-3) var(--space-6); }
}

.btn-primary {
    background: var(--text-primary);
    color: var(--text-inverse);
    border-color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--text-secondary);
    border-color: var(--text-secondary);
    color: var(--text-inverse);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-outline:hover {
    background: var(--text-primary);
    color: var(--text-inverse);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1rem;
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: var(--space-3);
    width: 40px;
    height: 40px;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: var(--space-4);
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--text-muted);
    background: var(--bg-elevated);
}

.input::placeholder {
    color: var(--text-muted);
}

textarea.input {
    resize: vertical;
    min-height: 100px;
}

.input-group {
    display: flex;
    gap: var(--space-2);
}

.input-group .input {
    flex: 1;
}

@media (max-width: 576px) {
    .input-group {
        flex-direction: column;
    }

    .input-group .btn {
        width: 100%;
    }
}

/* ============================================
   NAVIGATION
   ============================================ */

.navbar {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-3) var(--space-4);
    position: sticky;
    top: 0;
    z-index: 100;
}

@media (min-width: 768px) {
    .navbar { padding: var(--space-4) var(--space-6); }
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

@media (min-width: 768px) {
    .navbar-brand { font-size: 1.5rem; }
}

.navbar-brand span {
    color: var(--text-primary);
}

.nav-links {
    display: none;
    gap: var(--space-2);
}

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

.nav-link {
    color: var(--text-muted);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Mobile menu */
.nav-mobile-toggle {
    display: flex;
    padding: var(--space-2);
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

@media (min-width: 768px) {
    .nav-mobile-toggle { display: none; }
}

.nav-mobile {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-4);
}

.nav-mobile.open {
    display: block;
}

.nav-mobile .nav-link {
    display: block;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding-top: 60px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    z-index: 90;
}

.sidebar.open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
        padding-top: 70px;
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    margin: var(--space-1) var(--space-2);
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.sidebar-link:hover, .sidebar-link.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.main-with-sidebar {
    min-height: 100vh;
    padding: var(--space-4);
}

@media (min-width: 768px) {
    .main-with-sidebar { padding: var(--space-6); }
}

@media (min-width: 1024px) {
    .main-with-sidebar {
        margin-left: 280px;
        padding: var(--space-8);
    }
}

/* ============================================
   CHAT WIDGET
   ============================================ */

.chat-widget {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1000;
}

@media (min-width: 768px) {
    .chat-widget {
        bottom: var(--space-6);
        right: var(--space-6);
    }
}

.chat-button {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--text-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

@media (min-width: 768px) {
    .chat-button {
        width: 56px;
        height: 56px;
    }
}

.chat-button:hover {
    transform: scale(1.05);
    background: var(--text-secondary);
}

.chat-button svg {
    width: 22px;
    height: 22px;
    color: var(--text-inverse);
}

.chat-container {
    position: fixed;
    bottom: calc(var(--space-4) + 60px);
    right: var(--space-4);
    left: var(--space-4);
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 576px) {
    .chat-container {
        left: auto;
        width: 380px;
        right: var(--space-6);
        bottom: calc(var(--space-6) + 70px);
        max-height: 600px;
    }
}

@media (min-width: 768px) {
    .chat-container {
        width: 400px;
    }
}

.chat-container.open {
    display: flex;
}

.chat-header {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-height: 350px;
}

@media (min-width: 576px) {
    .chat-messages { max-height: 400px; }
}

.message {
    max-width: 85%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    animation: messageSlide 0.3s ease;
    font-size: 0.875rem;
    line-height: 1.5;
}

.message-user {
    align-self: flex-end;
    background: var(--text-primary);
    color: var(--text-inverse);
    border-bottom-right-radius: var(--radius-sm);
}

.message-assistant {
    align-self: flex-start;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-input-container {
    padding: var(--space-3);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-2);
}

@media (min-width: 576px) {
    .chat-input-container { padding: var(--space-4); }
}

.chat-input {
    flex: 1;
    padding: var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    resize: none;
    font-family: inherit;
    font-size: 0.875rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--text-muted);
}

.chat-send-btn {
    padding: var(--space-3);
    background: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-inverse);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-send-btn:hover {
    background: var(--text-secondary);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-3);
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

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

/* ============================================
   PROGRESS
   ============================================ */

.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: width 0.4s ease;
}

.progress-bar-lg {
    height: 8px;
}

/* ============================================
   STATS
   ============================================ */

.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

@media (min-width: 768px) {
    .stat-value { font-size: 2.5rem; }
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    .stat-label { font-size: 0.875rem; }
}

/* ============================================
   COURSE CARDS
   ============================================ */

.course-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.course-card-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--bg-tertiary);
    filter: grayscale(100%);
    transition: filter var(--transition-base);
}

@media (min-width: 768px) {
    .course-card-image { height: 160px; }
}

.course-card:hover .course-card-image {
    filter: grayscale(50%);
}

.course-card-body {
    padding: var(--space-4);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.course-card-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.course-card-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-primary {
    background: var(--text-primary);
    color: var(--text-inverse);
    border-color: transparent;
}

.badge-outline {
    background: transparent;
    border-color: var(--text-muted);
}

.badge-sm {
    padding: 2px var(--space-2);
    font-size: 0.625rem;
}

/* ============================================
   AVATAR
   ============================================ */

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 2px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

.avatar:hover {
    border-color: var(--text-primary);
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

@media (min-width: 768px) {
    .avatar-lg {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
    filter: grayscale(100%);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    padding: var(--space-10) 0;
    text-align: center;
}

@media (min-width: 768px) {
    .hero { padding: var(--space-16) 0; }
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

@media (min-width: 576px) {
    .hero h1 { font-size: 2.5rem; }
}

@media (min-width: 768px) {
    .hero h1 {
        font-size: 3rem;
        margin-bottom: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .hero h1 { font-size: 3.5rem; }
}

.hero h1 span {
    color: var(--text-secondary);
}

.hero p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto var(--space-6);
}

@media (min-width: 768px) {
    .hero p {
        font-size: 1.25rem;
        margin-bottom: var(--space-8);
    }
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    justify-content: center;
}

@media (min-width: 576px) {
    .hero-buttons {
        flex-direction: row;
        gap: var(--space-4);
    }
}

/* ============================================
   FEATURE CARDS
   ============================================ */

.feature-card {
    text-align: center;
    padding: var(--space-6);
}

@media (min-width: 768px) {
    .feature-card { padding: var(--space-8); }
}

.feature-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

@media (min-width: 768px) {
    .feature-icon {
        width: 64px;
        height: 64px;
    }
}

.feature-card:hover .feature-icon {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

@media (min-width: 768px) {
    .feature-icon svg {
        width: 28px;
        height: 28px;
    }
}

.feature-card:hover .feature-icon svg {
    color: var(--text-inverse);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-6) 0;
    margin-top: var(--space-8);
}

@media (min-width: 768px) {
    .footer {
        padding: var(--space-8) 0;
        margin-top: var(--space-12);
    }
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
}

.footer-links {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .footer-links {
        gap: var(--space-6);
        justify-content: flex-end;
    }
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

/* Flex */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* Text */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Width/Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Border */
.border { border: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.border-b { border-bottom: 1px solid var(--border-color); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Responsive visibility */
.sm-hidden { display: block; }
.md-hidden { display: block; }
.lg-hidden { display: block; }

@media (min-width: 576px) {
    .sm-hidden { display: none; }
    .sm-block { display: block; }
    .sm-flex { display: flex; }
}

@media (min-width: 768px) {
    .md-hidden { display: none; }
    .md-block { display: block; }
    .md-flex { display: flex; }
}

@media (min-width: 1024px) {
    .lg-hidden { display: none; }
    .lg-block { display: block; }
    .lg-flex { display: flex; }
}

/* ============================================
   CODE BLOCKS
   ============================================ */

.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    overflow-x: auto;
}

code {
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.875em;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SELECTION & FOCUS
   ============================================ */

::selection {
    background: var(--text-primary);
    color: var(--text-inverse);
}

*:focus-visible {
    outline: 2px solid var(--text-muted);
    outline-offset: 2px;
}

/* ============================================
   DIVIDER
   ============================================ */

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--space-6) 0;
}

/* ============================================
   LOADING & SKELETON
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-elevated) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--bg-tertiary);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-4);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto var(--space-6);
}

/* ============================================
   LESSON CONTENT
   ============================================ */

.lesson-content {
    max-width: 800px;
    margin: 0 auto;
}

.lesson-content h1,
.lesson-content h2,
.lesson-content h3 {
    margin-top: var(--space-8);
    margin-bottom: var(--space-4);
}

.lesson-content h1:first-child,
.lesson-content h2:first-child,
.lesson-content h3:first-child {
    margin-top: 0;
}

.lesson-content p {
    margin-bottom: var(--space-4);
    line-height: 1.8;
}

.lesson-content ul,
.lesson-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
    color: var(--text-secondary);
}

.lesson-content li {
    margin-bottom: var(--space-2);
}

.lesson-content blockquote {
    border-left: 3px solid var(--border-strong);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--text-muted);
    font-style: italic;
}

.lesson-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    margin: var(--space-6) 0;
    filter: grayscale(100%);
}

.lesson-content pre {
    margin: var(--space-6) 0;
}
