/* Modern 2025 Design System - Discussion Generator */

:root {
    /* Light theme colors - matches the rest of the tool pages */
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f0fb;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: rgba(255, 255, 255, 1);

    /* Accent colors - site purple gradient */
    --accent-primary: #6740cb;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6740cb 0%, #8b5cf6 100%);
    --accent-glow: rgba(103, 64, 203, 0.3);

    /* Text colors */
    --text-primary: #222933;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    /* Border colors */
    --border-primary: rgba(15, 23, 42, 0.08);
    --border-accent: rgba(103, 64, 203, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 40px var(--accent-glow);
    
    /* Animations */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Touch-friendly buttons */
button, .btn, a {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

body {
    position: relative;
    overflow-x: hidden;
    color: var(--text-primary);
    min-height: 100vh;
}

/* Pure black base background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: -3;
    pointer-events: none;
}

/* Soft floating hair-like streaks - dark navy blue */
.container::before {
    content: '';
    position: fixed;
    top: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: 
        radial-gradient(
            ellipse 800px 200px at 20% 15%,
            rgba(103, 64, 203, 0.05) 0%,
            rgba(103, 64, 203, 0.03) 30%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 700px 180px at 15% 25%,
            rgba(139, 92, 246, 0.05) 0%,
            rgba(139, 92, 246, 0.03) 30%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 600px 150px at 25% 20%,
            rgba(103, 64, 203, 0.04) 0%,
            rgba(103, 64, 203, 0.02) 30%,
            transparent 60%
        );
    animation: hairFloat 12s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
    filter: blur(40px);
    transform-origin: 20% 20%;
}

@keyframes hairFloat {
    0% { 
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.9;
    }
    25% { 
        transform: translate(-150px, 100px) rotate(-12deg) scale(1.2);
        opacity: 1;
    }
    50% { 
        transform: translate(-250px, -125px) rotate(10deg) scale(0.9);
        opacity: 0.85;
    }
    75% { 
        transform: translate(100px, -150px) rotate(-10deg) scale(1.18);
        opacity: 0.95;
    }
    100% { 
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.9;
    }
}

/* Bottom-right mirrored gradient - opposite movement */
.bottom-right-gradient {
    content: '';
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: 
        radial-gradient(
            ellipse 800px 200px at 80% 85%,
            rgba(103, 64, 203, 0.05) 0%,
            rgba(103, 64, 203, 0.03) 30%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 700px 180px at 85% 75%,
            rgba(139, 92, 246, 0.05) 0%,
            rgba(139, 92, 246, 0.03) 30%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 600px 150px at 75% 80%,
            rgba(103, 64, 203, 0.04) 0%,
            rgba(103, 64, 203, 0.02) 30%,
            transparent 60%
        );
    animation: hairFloatMirror 12s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
    filter: blur(40px);
    transform-origin: 80% 80%;
}

@keyframes hairFloatMirror {
    0% { 
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.9;
    }
    25% { 
        transform: translate(150px, -100px) rotate(12deg) scale(1.2);
        opacity: 1;
    }
    50% { 
        transform: translate(250px, 125px) rotate(-10deg) scale(0.9);
        opacity: 0.85;
    }
    75% { 
        transform: translate(-100px, 150px) rotate(10deg) scale(1.18);
        opacity: 0.95;
    }
    100% { 
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.9;
    }
}

/* Glowing orbs in top-left corner - dark navy */
body::after {
    content: '';
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: 
        radial-gradient(ellipse 600px 500px at 10% 15%, rgba(10, 25, 60, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse 500px 400px at 5% 25%, rgba(15, 35, 80, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse 400px 350px at 15% 20%, rgba(20, 40, 90, 0.15) 0%, transparent 60%);
    animation: glowPulse 15s ease-in-out infinite;
    pointer-events: none;
    z-index: -2;
    filter: blur(60px);
}

@keyframes glowPulse {
    0% { 
        opacity: 0.8;
        transform: translate(0, 0) scale(1);
    }
    33% { 
        opacity: 0.9;
        transform: translate(-50px, 25px) scale(1.12);
    }
    66% { 
        opacity: 1;
        transform: translate(25px, -40px) scale(1.18);
    }
    100% { 
        opacity: 0.8;
        transform: translate(0, 0) scale(1);
    }
}

@keyframes meshFloat {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    33% { 
        transform: translate(80px, -80px) rotate(10deg) scale(1.2);
        opacity: 0.9;
    }
    66% { 
        transform: translate(-60px, 60px) rotate(-10deg) scale(0.9);
        opacity: 0.95;
    }
}

@keyframes orbFloat1 {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    25% { 
        transform: translate(-150px, 80px) scale(1.3);
        opacity: 0.9;
    }
    50% { 
        transform: translate(-100px, 150px) scale(1.1);
        opacity: 0.85;
    }
    75% { 
        transform: translate(80px, 50px) scale(1.25);
        opacity: 0.9;
    }
}

@keyframes orbFloat2 {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    25% { 
        transform: translate(120px, -100px) scale(1.25);
        opacity: 0.9;
    }
    50% { 
        transform: translate(80px, -150px) scale(1.15);
        opacity: 0.85;
    }
    75% { 
        transform: translate(-80px, -80px) scale(1.2);
        opacity: 0.9;
    }
}

@keyframes orbFloat3 {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    25% { 
        transform: translate(-50%, -50%) translate(150px, -100px) scale(1.3);
        opacity: 0.9;
    }
    50% { 
        transform: translate(-50%, -50%) translate(-120px, 120px) scale(1.2);
        opacity: 0.85;
    }
    75% { 
        transform: translate(-50%, -50%) translate(100px, 80px) scale(1.25);
        opacity: 0.9;
    }
}

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

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, rgba(168, 85, 247, 1) 0%, transparent 70%);
    border-radius: 50%;
    left: var(--x);
    top: var(--y);
    animation: particleFloat var(--duration) cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: var(--delay);
    box-shadow: 
        0 0 15px rgba(168, 85, 247, 1),
        0 0 30px rgba(236, 72, 153, 0.8),
        0 0 45px rgba(244, 114, 182, 0.6);
    will-change: transform, opacity;
}

.particle:nth-child(even) {
    background: radial-gradient(circle, rgba(236, 72, 153, 1) 0%, transparent 70%);
    box-shadow: 
        0 0 10px rgba(236, 72, 153, 0.8),
        0 0 20px rgba(244, 114, 182, 0.6),
        0 0 30px rgba(168, 85, 247, 0.4);
}

.particle:nth-child(3n) {
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, rgba(244, 114, 182, 1) 0%, transparent 70%);
}

.particle:nth-child(5n) {
    width: 4px;
    height: 4px;
    animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes particleFloat {
    0% {
        transform: translate(0, 0) scale(0.5) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    15% {
        transform: translate(-80px, -120px) scale(1.2) rotate(45deg);
        opacity: 1;
    }
    30% {
        transform: translate(150px, -80px) scale(1.5) rotate(120deg);
        opacity: 1;
    }
    45% {
        transform: translate(-100px, 100px) scale(1.8) rotate(200deg);
        opacity: 1;
    }
    60% {
        transform: translate(180px, -150px) scale(1.3) rotate(280deg);
        opacity: 1;
    }
    75% {
        transform: translate(-120px, -60px) scale(1.6) rotate(340deg);
        opacity: 0.9;
    }
    90% {
        transform: translate(90px, 120px) scale(1.1) rotate(400deg);
        opacity: 0.7;
    }
    95% {
        opacity: 0.3;
    }
    100% {
        transform: translate(-50px, -200px) scale(0.4) rotate(450deg);
        opacity: 0;
    }
}

/* Floating Gradient Orbs */
.gradient-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.7;
    mix-blend-mode: screen;
}

.orb-1 {
    width: 500px;
    height: 500px;
    top: 10%;
    right: 15%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.8) 0%, transparent 70%);
    animation: orbFloat1 25s ease-in-out infinite;
}

.orb-2 {
    width: 450px;
    height: 450px;
    bottom: 20%;
    left: 10%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.7) 0%, transparent 70%);
    animation: orbFloat2 30s ease-in-out infinite;
}

.orb-3 {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.6) 0%, transparent 70%);
    animation: orbFloat3 20s ease-in-out infinite;
}

.orb-4 {
    width: 550px;
    height: 550px;
    bottom: 10%;
    right: 20%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.7) 0%, transparent 70%);
    animation: orbFloat4 28s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-80px, 60px) scale(1.2); }
    66% { transform: translate(60px, -80px) scale(0.9); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, -70px) scale(1.1); }
    66% { transform: translate(-70px, 90px) scale(0.95); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) translate(120px, -100px) scale(1.15); }
}

@keyframes orbFloat4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-90px, -80px) scale(1.1); }
    50% { transform: translate(70px, 100px) scale(0.9); }
    75% { transform: translate(90px, -60px) scale(1.05); }
}

/* Noise Texture Overlay */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
    animation: noiseMove 8s steps(10) infinite;
}

@keyframes noiseMove {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -5%); }
    20% { transform: translate(-10%, 5%); }
    30% { transform: translate(5%, -10%); }
    40% { transform: translate(-5%, 10%); }
    50% { transform: translate(10%, 5%); }
    60% { transform: translate(5%, -5%); }
    70% { transform: translate(-10%, -10%); }
    80% { transform: translate(10%, 10%); }
    90% { transform: translate(-5%, 5%); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
}

/* App Content - Remove white background */
.app-content {
    background: transparent !important;
    padding: 0 !important;
}

/* Header - Enhanced glassmorphism */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    padding: 1rem 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.logo:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

/* Study Buddy Container - Modern Grid Layout */
.study-buddy-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0;
    max-height: 100vh;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
    background: transparent !important;
}

/* Center the toggle buttons container */
.generator-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.generation-box {
    width: 100%;
    max-width: 100%;
}

/* Sidebar - Premium Glassmorphism with 3D depth */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    border-radius: 0;
    border-right: 1px solid rgba(168, 85, 247, 0.2);
    padding: 0;
    overflow-y: auto;
    box-shadow: 
        2px 0 16px rgba(0, 0, 0, 0.3),
        inset -1px 0 0 0 rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar:hover {
    border-color: var(--border-accent);
    box-shadow: 
        var(--shadow-lg), 
        var(--shadow-glow),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.sidebar:hover::before {
    opacity: 1;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* Modern Button - Liquid morphing effect with glow */
.btn-new-chat {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 4px 12px var(--accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.btn-new-chat::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-new-chat:hover::before {
    width: 300px;
    height: 300px;
}

.btn-new-chat:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 12px 32px var(--accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-radius: 14px;
}

.btn-new-chat:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s;
}

/* Chat Session Items - Glassmorphic cards with magnetic hover */
.chat-session-item {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(103, 64, 203, 0.12);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.chat-session-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(103, 64, 203, 0.12), transparent);
    transition: left 0.5s;
}

.chat-session-item:hover::before {
    left: 100%;
}

.chat-session-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateX(8px) scale(1.02);
    box-shadow: 
        -4px 0 16px rgba(103, 64, 203, 0.12),
        inset 0 0 0 1px rgba(103, 64, 203, 0.08);
}

.chat-session-item.active {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    box-shadow: 
        var(--shadow-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
    animation: activeCardPulse 2s ease-in-out infinite;
}

.chat-session-item.active .session-title,
.chat-session-item.active .session-preview,
.chat-session-item.active .session-time {
    color: rgba(255, 255, 255, 1) !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    font-weight: 600;
}

@keyframes activeCardPulse {
    0%, 100% { box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
    50% { box-shadow: 0 0 60px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
}

.session-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.session-preview {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.session-time {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

/* Main Chat Area - Ultra-premium glassmorphism */
.main-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 3rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    border-radius: 0;
    border: none;
    overflow-y: auto;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1),
        inset 0 0 60px rgba(168, 85, 247, 0.03);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.chat-header p {
    color: var(--text-secondary) !important;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#generation-type:hover {
    border-color: var(--border-accent);
    background-color: var(--bg-card-hover);
}

#generation-type:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Generation Box - Glassmorphic container */
.generation-box {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 16px;
    padding: 2rem;
    max-height: 600px;
    overflow-y: auto;
    transition: var(--transition-smooth);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.generation-box:hover {
    border-color: var(--border-accent);
}

.generation-box label {
    color: var(--text-primary) !important;
}

.type-selector label {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

/* Glassmorphic Textarea */
#user-input {
    width: 100%;
    min-height: 250px;
    padding: 1.25rem;
    background: rgba(249, 250, 251, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(103, 64, 203, 0.12);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition-smooth);
}

#user-input:hover {
    border-color: var(--border-accent);
}

#user-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-card);
}

#user-input::placeholder {
    color: var(--text-tertiary);
}

/* Primary Button - Advanced shimmer with 3D depth */
.btn-primary {
    width: 100%;
    padding: 1.25rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 4px 16px var(--accent-glow),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

/* Animated shimmer effect */
.btn-primary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Ripple effect on click */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 
        0 12px 32px var(--accent-glow),
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-radius: 14px;
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.99);
    transition: all 0.1s;
}

/* Generated Output - Glassmorphic card */
#generated-output {
    background: rgba(249, 250, 251, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(103, 64, 203, 0.12);
    padding: 1.5rem;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 0.95rem;
    color: var(--text-primary);
    animation: fadeIn 0.5s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

/* Copy Button - Modern outline style */
button[onclick="copyToClipboard()"] {
    padding: 0.65rem 1.25rem;
    background: transparent;
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 0.9rem;
}

button[onclick="copyToClipboard()"]:hover {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-2px);
}

/* Generate Another Button */
button[onclick="generateAgain()"] {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 1.05rem;
    transition: var(--transition-smooth);
}

button[onclick="generateAgain()"]:hover {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-2px);
}

/* Loading Animation - Modern spinner */
#loading-section {
    text-align: center;
    padding: 4rem 2rem;
}

#loading-section > div:first-child {
    font-size: 4rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Control Buttons - Modern icon buttons */
.btn-export,
.btn-delete {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 0.65rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 1.1rem;
}

.btn-export:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Refresh Button */
.btn-refresh {
    width: 100%;
    padding: 0.65rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-refresh:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-secondary) !important;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

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

/* Labels - Modern typography */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary) !important;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

#input-label {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Mobile-First Responsive Design */

/* Mobile devices (portrait) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    /* Header adjustments */
    .header-content {
        padding: 0.75rem 1rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .logo svg {
        width: 20px;
        height: 20px;
    }
    
    /* Main layout - stack vertically */
    .study-buddy-container {
        flex-direction: column;
        padding: 0.75rem;
        gap: 1rem;
        max-height: none;
        min-height: auto;
    }
    
    /* Sidebar becomes horizontal scrollable tabs */
    .sidebar {
        width: 100%;
        max-height: 200px;
        padding: 1rem;
        border-radius: 16px;
        order: 2;
    }
    
    .sidebar-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .btn-new-chat {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .chat-sessions {
        max-height: 120px;
        overflow-y: auto;
    }
    
    .chat-session-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .session-title {
        font-size: 0.85rem;
    }
    
    .session-preview {
        font-size: 0.75rem;
    }
    
    /* Main content area */
    .main-chat-area {
        padding: 1.25rem;
        border-radius: 16px;
        order: 1;
        overflow-y: visible;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .app-title {
        font-size: 1.25rem;
        line-height: 1.3;
    }
    
    /* Generation box mobile */
    .generation-box {
        padding: 1.25rem;
        max-height: none;
        border-radius: 12px;
    }
    
    #user-input {
        min-height: 180px;
        font-size: 0.9rem;
        padding: 1rem;
    }
    
    #generated-output {
        max-height: none;
        font-size: 0.9rem;
        padding: 1.25rem;
    }
    
    /* Buttons mobile */
    .btn-primary {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    /* Dropdown mobile */
    #generation-type {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Modal mobile */
    #history-modal > div {
        width: 95%;
        max-height: 90vh;
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    #modal-title {
        font-size: 1.25rem;
    }
    
    /* Reduce orb sizes on mobile */
    body::after {
        width: 400px;
        height: 400px;
        top: -200px;
        right: -200px;
    }
    
    .container::before {
        width: 350px;
        height: 350px;
        bottom: -175px;
        left: -175px;
    }
    
    .container::after {
        width: 300px;
        height: 300px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .app-title {
        font-size: 1.1rem;
    }
    
    
    .main-chat-area {
        padding: 1rem;
    }
    
    .generation-box {
        padding: 1rem;
    }
    
    .sidebar {
        max-height: 180px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .study-buddy-container {
        flex-direction: row;
        max-height: calc(100vh - 80px);
    }
    
    .sidebar {
        width: 280px;
        max-height: none;
        order: 1;
    }
    
    .main-chat-area {
        order: 2;
        overflow-y: auto;
    }
}

/* Tablet devices */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .generation-box {
        padding: 1.75rem;
    }
}

/* Loading spinner animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Advanced entrance animations with stagger */
.sidebar {
    animation: slideInLeft 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.main-chat-area {
    animation: slideInRight 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s backwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px) scale(0.95);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

/* Staggered animation for chat session items */
.chat-session-item {
    animation: fadeInUp 0.5s ease backwards;
}

.chat-session-item:nth-child(1) { animation-delay: 0.1s; }
.chat-session-item:nth-child(2) { animation-delay: 0.15s; }
.chat-session-item:nth-child(3) { animation-delay: 0.2s; }
.chat-session-item:nth-child(4) { animation-delay: 0.25s; }
.chat-session-item:nth-child(5) { animation-delay: 0.3s; }

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

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

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


/* Loading State */
.btn-loader {
    animation: spin 1s linear infinite;
}

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

/* ========================================
   NEW SIDEBAR LAYOUT (Like Screenshot)
   ======================================== */

/* Sidebar User Profile at Top */
.sidebar-user-profile {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.nav-item {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s;
    margin-bottom: 0.25rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(103, 64, 203, 0.12);
    color: var(--accent-primary);
}

.nav-item svg {
    flex-shrink: 0;
}

/* Sidebar History Section */
.sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5rem 0.75rem;
}

.history-header h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.btn-new-chat-small {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-new-chat-small:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Update sidebar to use flexbox for layout */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ========================================
   SIMPLIFIED MAIN AREA
   ======================================== */

/* Simple Heading */
.simple-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

/* Type Toggle Buttons - Segmented Control Style */
.type-toggle-buttons {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.toggle-btn:hover:not(.active) {
    background: rgba(103, 64, 203, 0.08);
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 
        0 2px 8px rgba(168, 85, 247, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* Giant Text Area */
.giant-textarea {
    width: 100%;
    height: calc(100vh - 320px);
    min-height: 400px;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(168, 85, 247, 0.2);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s;
}

.giant-textarea:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(103, 64, 203, 0.08);
}

.giant-textarea::placeholder {
    color: var(--text-tertiary);
}

/* Mobile Hamburger (Hidden on Desktop) */
.hamburger-menu-mobile {
    display: none;
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: rgba(103, 64, 203, 0.12);
    backdrop-filter: blur(20px);
    border: 1.5px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(168, 85, 247, 0.2);
    transition: all 0.2s;
    padding: 0;
}

.hamburger-menu-mobile svg {
    width: 22px;
    height: 22px;
}

.hamburger-menu-mobile:active {
    transform: scale(0.92);
    background: rgba(103, 64, 203, 0.18);
}

/* Hamburger Menu (Mobile Only) */
.hamburger-menu {
    display: none;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Sidebar Overlay (Mobile Only) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Show hamburger on mobile */
    .hamburger-menu-mobile {
        display: flex;
    }
    
    /* App content needs relative positioning */
    #app-content {
        position: relative;
    }
    
    /* Sidebar slides in from left */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-user-profile {
        padding: 1rem;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
    }
    
    /* Main content adjustments */
    .study-buddy-container {
        grid-template-columns: 1fr;
        padding: 0;
    }
    
    .main-chat-area {
        padding: 1rem;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    /* Simple heading smaller on mobile */
    .simple-heading {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    /* Toggle buttons full width on mobile */
    .type-toggle-buttons {
        width: 100%;
        max-width: 100%;
    }
    
    .toggle-btn {
        min-width: 0;
        flex: 1;
    }
    
    /* Giant textarea fills available space on mobile */
    .giant-textarea {
        height: calc(100vh - 420px);
        min-height: 250px;
        font-size: 0.95rem;
    }
    
    /* Generator container */
    .generator-container {
        padding: 0;
    }
}
