/* ============================================
   OMNILYA AI - Main Learning App
   Neon Sci-Fi EdTech Interface
   ============================================ */

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

:root {
    /* Neon Cyber-Pastel Palette */
    --neon-cyan: #06b6d4;
    --neon-magenta: #ec4899;
    --neon-violet: #a855f7;
    --soft-blue: #3b82f6;
    --accent-pink: #f472b6;

    /* Dark Space Backgrounds */
    --bg-deep-space: #0a0e27;
    --bg-panel: rgba(17, 25, 40, 0.75);
    --bg-glass: rgba(17, 25, 40, 0.85);

    /* Text Colors */
    --text-primary: #e0e7ff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-base: 200ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Animated Particle Background */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-particles::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(6, 182, 212, 0.3), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(168, 85, 247, 0.3), transparent),
        radial-gradient(2px 2px at 50% 50%, rgba(236, 72, 153, 0.3), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(6, 182, 212, 0.3), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(168, 85, 247, 0.3), transparent);
    background-size: 200px 200px, 300px 300px, 250px 250px, 350px 350px, 280px 280px;
    animation: particleFloat 20s linear infinite;
}

@keyframes particleFloat {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-50%, -50%); }
}

/* Main Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Glass Panel */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 32px;
    border: 1px solid rgba(79, 70, 229, 0.3);
    padding: 40px;
    box-shadow:
        0 8px 32px rgba(31, 38, 135, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Header Section */
.header {
    text-align: center;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
    position: relative;
}

.back-button {
    position: absolute;
    left: 0;
    top: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--neon-violet);
    font-size: 1.2em;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: var(--neon-violet);
    transform: translateX(-4px);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.back-button:active {
    transform: translateX(-2px) scale(0.95);
}

.header h1 {
    font-size: 2.5em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-violet) 50%, var(--neon-magenta) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1.1em;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Metrics Display */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.metric {
    background: rgba(17, 25, 40, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 20px;
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.metric::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    animation: scanline 3s linear infinite;
}

@keyframes scanline {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.metric:hover {
    transform: translateY(-4px);
    border-color: var(--neon-cyan);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.4);
}

.metric-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--neon-cyan);
    margin-bottom: 5px;
    font-variant-numeric: tabular-nums;
}

.metric-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Main Content Area */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    flex: 1;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    background: rgba(17, 25, 40, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 25px;
    overflow-y: auto;
    height: calc(100vh - 480px);
    min-height: 350px;
    max-height: 600px;
}

.sidebar h3 {
    font-size: 1.2em;
    color: var(--neon-violet);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(6, 182, 212, 0.05);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-cyan), var(--neon-violet));
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Difficulty Selector */
.difficulty-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: thin;
}

.difficulty-level {
    flex: 1;
    min-width: 70px;
    background: linear-gradient(135deg, rgba(17, 25, 40, 0.9), rgba(30, 41, 59, 0.9));
    border: 2px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.difficulty-level::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.2), transparent);
    transition: left 0.5s;
}

.difficulty-level:hover::before {
    left: 100%;
}

.difficulty-level:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(6, 182, 212, 0.2));
    border-color: rgba(168, 85, 247, 0.6);
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.difficulty-level.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(6, 182, 212, 0.3));
    border-color: var(--neon-violet);
    box-shadow:
        0 0 30px rgba(168, 85, 247, 0.6),
        0 0 15px rgba(6, 182, 212, 0.4),
        inset 0 0 20px rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

.level-number {
    font-size: 1.5em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--neon-violet), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.5));
}

.difficulty-level.active .level-number {
    background: linear-gradient(135deg, var(--neon-cyan), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 12px rgba(6, 182, 212, 0.8));
}

.level-name {
    font-size: 0.7em;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.difficulty-level.active .level-name {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.level-cefr {
    font-size: 0.65em;
    color: rgba(168, 85, 247, 0.7);
    font-weight: 600;
    padding: 2px 6px;
    background: rgba(168, 85, 247, 0.1);
    border-radius: 4px;
    display: inline-block;
}

.difficulty-level.active .level-cefr {
    color: var(--neon-cyan);
    background: rgba(6, 182, 212, 0.2);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

/* Topics Container */
.topics-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Topic Chips */
.topic-chip {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 0;
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.9em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topic-chip:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--neon-violet);
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.topic-chip:active {
    transform: translateX(3px) scale(0.98);
}

/* Chat Container */
.chat-container {
    background: rgba(17, 25, 40, 0.4);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 25px;
    overflow-y: auto;
    height: calc(100vh - 480px);
    min-height: 350px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(6, 182, 212, 0.05);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--neon-cyan), var(--neon-magenta));
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Message Bubbles */
.message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: messageSlideIn var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

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

.message-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.message-content {
    background: rgba(17, 25, 40, 0.8);
    border-radius: 16px;
    padding: 16px 20px;
    line-height: 1.6;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.message.user .message-label {
    color: var(--neon-cyan);
    align-self: flex-end;
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.1));
    border-color: rgba(6, 182, 212, 0.4);
    align-self: flex-end;
    max-width: 70%;
}

.message.assistant .message-label {
    color: var(--neon-magenta);
}

.message.assistant .message-content {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(236, 72, 153, 0.1));
    border-color: rgba(236, 72, 153, 0.4);
    max-width: 85%;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 16px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--neon-violet);
    border-radius: 50%;
    animation: typingBounce 700ms infinite;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
}

.typing-dot:nth-child(2) {
    animation-delay: 150ms;
}

.typing-dot:nth-child(3) {
    animation-delay: 300ms;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Status Bar */
.status {
    text-align: center;
    padding: 12px;
    background: rgba(17, 25, 40, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

.status.listening {
    border-color: var(--neon-cyan);
    background: rgba(6, 182, 212, 0.1);
    color: var(--neon-cyan);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.voice-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet));
    border: 2px solid rgba(236, 72, 153, 0.5);
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(236, 72, 153, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.voice-toggle:hover {
    transform: scale(1.1);
    box-shadow:
        0 8px 30px rgba(236, 72, 153, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.voice-toggle:active {
    transform: scale(1.05);
}

.voice-toggle.active {
    background: linear-gradient(135deg, var(--neon-cyan), var(--soft-blue));
    border-color: rgba(6, 182, 212, 0.8);
    animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
    }
    50% {
        box-shadow: 0 4px 40px rgba(6, 182, 212, 0.8);
    }
}

.input-field {
    flex: 1;
    background: rgba(17, 25, 40, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    transition: all var(--transition-base);
    outline: none;
}

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

.input-field:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    background: rgba(17, 25, 40, 0.8);
}

.send-button {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--soft-blue));
    border: 1px solid rgba(6, 182, 212, 0.5);
    border-radius: 16px;
    color: white;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
    flex-shrink: 0;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.5);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: 250px;
        min-height: 200px;
        max-height: 300px;
    }

    .chat-container {
        height: calc(100vh - 600px);
        min-height: 300px;
    }

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

@media (max-width: 640px) {
    .container {
        padding: 15px 10px;
    }

    .glass-panel {
        padding: 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .header p {
        font-size: 0.95em;
    }

    .metrics {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .controls {
        flex-wrap: wrap;
    }

    .voice-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }

    .send-button {
        padding: 14px 24px;
        font-size: 0.9em;
    }

    .message.user .message-content {
        max-width: 85%;
    }

    .message.assistant .message-content {
        max-width: 95%;
    }
}

/* Accessibility */
.voice-toggle:focus,
.send-button:focus,
.input-field:focus {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
}

.topic-chip:focus {
    outline: 2px solid var(--neon-violet);
    outline-offset: 2px;
}

/* Smooth entrance animation */
.glass-panel {
    animation: panelEnter 800ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes panelEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
