/* ============================================= */
/* EIDO DESIGN SYSTEM v1.0 — by GRAVITAS         */
/* Inspired by Linear, Vercel, Stripe            */
/* ============================================= */

/* Default: Warm Premium (Cozy Dark) */
:root {
    --bg-color: #0c0b0a;
    --bg-color-rgb: 12, 11, 10;
    --bg-secondary: #161412;
    --card-bg: rgba(22, 20, 18, 0.4);
    --text-main: #fdfaf6;
    --text-light: #948b88;
    --primary: #ff7c5c;
    --primary-rgb: 255, 124, 92;
    --primary-hover: #ff6a45;
    --primary-glow: rgba(255, 124, 92, 0.12);
    --accent: #fcd34d;
    --accent-2: #fb7185;
    --border-color: rgba(255, 255, 255, 0.06);
    --error: #f43f5e;
    --success: #10b981;
    --sidebar-width: 280px;
    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    --sidebar-bg: #0c0b0a;
    --font-main: 'Outfit', 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --font-mono: 'JetBrains Mono', 'Roboto Mono', monospace;
    --glow-primary: 0 0 30px rgba(255, 124, 92, 0.15), 0 0 80px rgba(255, 124, 92, 0.05);
    --mesh-gradient: 
        radial-gradient(circle at 0% 0%, rgba(255, 124, 92, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(252, 211, 77, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(12, 11, 10, 1) 0%, transparent 100%);
}

/* Theme: Matcha Glass (Premium Light) */
body.theme-matcha {
    --bg-color: #f5f7f5;
    --bg-color-rgb: 245, 247, 245;
    --bg-secondary: #ebece9;
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-main: #2b332c;
    --text-light: #6e7a70;
    --primary: #5c8065;
    --primary-rgb: 92, 128, 101;
    --primary-hover: #4a6b53;
    --primary-glow: rgba(92, 128, 101, 0.12);
    --accent: #8b9e8e;
    --accent-2: #d1bfae;
    --border-color: rgba(0, 0, 0, 0.06);
    --sidebar-bg: #f5f7f5;
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    --glow-primary: 0 0 20px rgba(92, 128, 101, 0.2);
    --mesh-gradient: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(92, 128, 101, 0.08) 0%, transparent 100%),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(139, 158, 142, 0.05) 0%, transparent 100%);
}

/* Theme: Lavender Dream (Relaxing Dark) */
body.theme-lavender {
    --bg-color: #12101a;
    --bg-color-rgb: 18, 16, 26;
    --bg-secondary: #1a1826;
    --card-bg: rgba(26, 24, 38, 0.6);
    --text-main: #f5f3fa;
    --text-light: #9d95ba;
    --primary: #a78bfa;
    --primary-rgb: 167, 139, 250;
    --primary-hover: #8b5cf6;
    --primary-glow: rgba(167, 139, 250, 0.15);
    --accent: #f472b6;
    --accent-2: #60a5fa;
    --border-color: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #12101a;
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --glow-primary: 0 0 20px rgba(167, 139, 250, 0.25);
    --mesh-gradient: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(167, 139, 250, 0.12) 0%, transparent 100%),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(244, 114, 182, 0.08) 0%, transparent 100%);
}

/* Theme: Midnight Hacker (Deep Dark Cyber) */
body.theme-midnight {
    --bg-color: #030305;
    --bg-color-rgb: 3, 3, 5;
    --bg-secondary: #0a0a0f;
    --card-bg: rgba(10, 10, 15, 0.7);
    --text-main: #ffffff;
    --text-light: #71717a;
    --primary: #00e5ff;
    --primary-rgb: 0, 229, 255;
    --primary-hover: #00b8cc;
    --primary-glow: rgba(0, 229, 255, 0.15);
    --accent: #8a2be2;
    --accent-2: #ff007f;
    --border-color: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #030305;
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(0, 229, 255, 0.3), 0 0 60px rgba(0, 229, 255, 0.1);
    --mesh-gradient: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 229, 255, 0.1) 0%, transparent 100%),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(138, 43, 226, 0.08) 0%, transparent 100%);
}

/* Theme: Sakura Mist (Cozy Pink) */
body.theme-sakura {
    --bg-color: #fff5f7;
    --bg-color-rgb: 255, 245, 247;
    --bg-secondary: #fceef2;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #4a3136;
    --text-light: #8e6e73;
    --primary: #fb7185;
    --primary-rgb: 251, 113, 133;
    --primary-hover: #f43f5e;
    --primary-glow: rgba(251, 113, 133, 0.12);
    --accent: #fcd34d;
    --accent-2: #c084fc;
    --border-color: rgba(251, 113, 133, 0.15);
    --sidebar-bg: #fff5f7;
    --glass-shadow: 0 10px 40px rgba(251, 113, 133, 0.1);
    --glow-primary: 0 0 20px rgba(251, 113, 133, 0.2);
    --mesh-gradient: 
        radial-gradient(circle at 0% 0%, rgba(251, 113, 133, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(252, 211, 77, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #fff5f7 0%, transparent 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--font-main); }
::selection { background: var(--primary); color: white; }

body { 
    background-color: var(--bg-color); 
    background-image: var(--mesh-gradient);
    color: var(--text-main); 
    height: 100vh; 
    overflow: hidden;
    transition: background-color 0.5s ease, color 0.3s ease;
    scroll-behavior: smooth;
}

.layout-wrapper { display: flex; height: 100vh; }

.view { 
    display: none; 
    opacity: 0; 
    transform: translateY(10px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.view.active { 
    display: block; 
    opacity: 1;
    transform: translateY(0);
}

/* Sidebar */
.sidebar { 
    width: var(--sidebar-width); background: var(--sidebar-bg); 
    border-right: 1px solid var(--border-color); display: flex; flex-direction: column; 
    padding: 2rem 1.5rem; z-index: 10; transition: 0.3s ease;
}
.sidebar-header { 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    gap: 0.8rem; 
    color: var(--primary); 
    margin-bottom: 4rem; 
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}
.sidebar-header:hover { transform: scale(1.05); }
.sidebar-header .logo-icon {
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    fill: var(--primary);
}
.sidebar-header h2 {
    font-size: 1.8rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.nav-btn { 
    display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: 1px solid transparent; 
    background: transparent; border-radius: var(--radius-md); font-size: 1rem; 
    color: var(--text-light); cursor: pointer; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); text-align: left;
    position: relative;
    overflow: hidden;
}
.nav-btn:hover { 
    color: var(--text-main); 
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px) translate3d(0,0,0);
}
.nav-btn.active { 
    background: var(--primary-glow); 
    color: var(--primary); 
    font-weight: 600; 
    border-color: rgba(255, 124, 92, 0.2); 
    box-shadow: inset 0 0 20px rgba(255, 124, 92, 0.05);
}
.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary);
}
.sidebar-footer { font-size: 0.8rem; color: var(--text-light); text-align: center; }

/* Main */
.main-content { flex: 1; padding: 3rem 4rem; overflow-y: auto; position: relative; background: transparent; }
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.view { display: none; }
.view.active { 
    display: block; 
    animation: viewFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1); 
}

@keyframes viewFadeIn { 
    from { opacity: 0; transform: translateY(24px) scale(0.99); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

/* Staggered entrance */
.view.active .card, .view.active .subject-folder, .view.active .list-item {
    animation: itemPop 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.view.active .card:nth-child(1), .view.active .subject-folder:nth-child(1) { animation-delay: 0.05s; }
.view.active .card:nth-child(2), .view.active .subject-folder:nth-child(2) { animation-delay: 0.1s; }
.view.active .card:nth-child(3), .view.active .subject-folder:nth-child(3) { animation-delay: 0.15s; }
.view.active .card:nth-child(n+4), .view.active .subject-folder:nth-child(n+4) { animation-delay: 0.2s; }

@keyframes itemPop {
    from { opacity: 0; transform: translateY(8px) scale(0.99) translate3d(0,0,0); }
    to { opacity: 1; transform: translateY(0) scale(1) translate3d(0,0,0); }
}

/* SKELETON LOADERS */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite linear;
    border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton-folder { height: 200px; width: 100%; border-radius: var(--radius-lg); opacity: 0.3; }

/* Icon Stability */
i[data-lucide] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

.view-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end; 
    margin-bottom: 3rem; 
}
.view-header h1 { 
    font-family: var(--font-serif);
    font-size: 2.8rem; 
    font-weight: 700; 
    letter-spacing: -0.03em;
    background: linear-gradient(to right, var(--text-main), var(--text-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.quote { font-style: italic; background: var(--primary-glow); padding: 1rem 1.5rem; border-left: 3px solid var(--primary); border-radius: var(--radius-sm); margin-top: 1rem; font-size: 0.9rem; }

/* Cards & Layout */
.aura-bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(180px, auto);
    gap: 1.5rem;
}

.widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.widget-title { font-size: 1.1rem; font-weight: 600; color: var(--text-main); }
.widget-icon { color: var(--text-light); width: 18px; height: 18px; cursor: pointer; }
.widget-dropdown { font-size: 0.85rem; color: var(--text-light); display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }

/* Widgets Spanning */
.widget-focus { 
    grid-column: span 2; 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important; 
    border: none !important; 
    box-shadow: var(--glow-primary) !important;
}
.widget-focus .widget-title, .widget-focus .widget-icon, .widget-focus p { color: rgba(255,255,255,0.85) !important; }
.widget-focus h2 { 
    color: #fff !important; 
    font-family: var(--font-serif);
    font-size: 2.2rem !important;
    margin-top: 0.5rem;
}
.widget-focus .focus-btn { 
    background: rgba(255,255,255,0.15) !important; 
    color: #fff !important; 
    border: 1px solid rgba(255,255,255,0.2) !important; 
    backdrop-filter: blur(10px); 
    box-shadow: none; 
    font-weight: 600; 
    margin-top: 1rem;
}
.widget-focus .focus-btn:hover { 
    background: rgba(255,255,255,0.25) !important; 
    transform: translateY(-2px); 
}

.widget-activity { grid-column: span 2; }
.widget-deadlines { grid-column: span 2; }
.widget-courses { grid-column: span 2; }
.widget-recent { grid-column: span 2; }
.widget-streak { grid-column: span 1; display: flex; flex-direction: column; }
.widget-briefing { grid-column: span 1; display: flex; flex-direction: column; }

/* Neural Briefing Styles */
.briefing-content { margin-top: 1rem; }
.briefing-player { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.play-pulse-btn { 
    width: 50px; height: 50px; border-radius: 50%; background: var(--primary); 
    border: none; color: white; display: flex; justify-content: center; align-items: center; 
    cursor: pointer; position: relative; box-shadow: 0 0 20px var(--primary-glow);
}
.play-pulse-btn::after {
    content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50%;
    border: 2px solid var(--primary); animation: pulseBriefing 2s infinite;
}
@keyframes pulseBriefing {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}
.briefing-info h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.briefing-info p { font-size: 0.75rem; color: var(--text-light); }

.briefing-waves { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.briefing-waves span { 
    width: 3px; background: var(--primary); border-radius: 2px;
    animation: waveBounce 1s infinite alternate;
}
.briefing-waves span:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.briefing-waves span:nth-child(2) { height: 80%; animation-delay: 0.3s; }
.briefing-waves span:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.briefing-waves span:nth-child(4) { height: 90%; animation-delay: 0.4s; }
.briefing-waves span:nth-child(5) { height: 50%; animation-delay: 0.15s; }

@keyframes waveBounce { from { transform: scaleY(1); } to { transform: scaleY(1.5); } }

/* Knowledge Graph Canvas Overlay */
#knowledge-graph-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(12, 11, 10, 0.95); z-index: 1000;
    display: flex; flex-direction: column; animation: fadeIn 0.3s ease;
}
.kg-header { padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
#kg-canvas { flex: 1; cursor: grab; }
#kg-canvas:active { cursor: grabbing; }

/* Widget Specifics */
.timeline-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.5rem; }
.timeline-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.5rem; }
.timeline-block { background: var(--bg-secondary); border-radius: var(--radius-sm); min-height: 60px; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.3rem; }
.timeline-event { background: rgba(255, 138, 102, 0.15); border: 1px solid var(--primary); border-radius: var(--radius-sm); color: var(--text-main); font-size: 0.75rem; padding: 0.3rem 0.4rem; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--glow-primary); text-align: center; }

.courses-flex { 
    display: flex; 
    gap: 1.2rem; 
    overflow-x: auto; 
    padding: 1rem 0.5rem 1.5rem 0.5rem; 
    margin-top: -1rem; 
}
.courses-flex::-webkit-scrollbar { height: 4px; }
.courses-flex::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.course-mini-card {
    min-width: 180px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.course-mini-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary);
    transform: translateY(-3px);
}

.rank-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 0.3rem;
}

.rank-bronze { background: rgba(205, 127, 50, 0.15); color: #cd7f32; border: 1px solid rgba(205, 127, 50, 0.3); }
.rank-silver { background: rgba(192, 192, 192, 0.15); color: #c0c0c0; border: 1px solid rgba(192, 192, 192, 0.3); }
.rank-gold { background: rgba(255, 215, 0, 0.15); color: #ffd700; border: 1px solid rgba(255, 215, 0, 0.3); text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.rank-diamond { 
    background: rgba(185, 242, 255, 0.2); 
    color: #b9f2ff; 
    border: 1px solid rgba(185, 242, 255, 0.5); 
    text-shadow: 0 0 15px rgba(185, 242, 255, 0.5);
    animation: diamond-shimmer 2s infinite alternate;
}

@keyframes diamond-shimmer {
    from { box-shadow: 0 0 5px rgba(185, 242, 255, 0.2); }
    to { box-shadow: 0 0 20px rgba(185, 242, 255, 0.4); }
}

.course-progress-bar { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; margin-top: 0.2rem; }
.course-progress-fill { height: 100%; transition: width 0.5s ease; background: var(--primary); border-radius: 2px; }

.recent-list { display: flex; flex-direction: column; gap: 0.8rem; }
.recent-item { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; background: var(--bg-secondary); border-radius: var(--radius-md); transition: 0.2s; cursor: pointer; border: 1px solid transparent; }
.recent-item:hover { background: var(--primary-glow); border-color: var(--primary); }

.streak-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 1rem; }
.flame-icon-wrapper { width: 60px; height: 60px; border-radius: 50%; background: var(--primary-glow); display: flex; justify-content: center; align-items: center; box-shadow: var(--glow-primary); margin-bottom: 0.5rem; }
.streak-icon { color: var(--primary); width: 32px; height: 32px; fill: var(--primary); }
.outline-btn { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.outline-btn:hover { background: var(--primary-glow); }

.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }
.library-stack { 
    display: flex; 
    flex-direction: column; 
    gap: 1.5rem; 
    min-height: 400px; /* Previene il collasso totale durante il caricamento */
}

.card { 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-lg); 
    padding: 1.8rem; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(24px) saturate(180%);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    z-index: 1;
}
.card:hover { 
    border-color: rgba(255, 255, 255, 0.12); 
    transform: translateY(-4px) scale(1.01) translate3d(0,0,0); 
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 124, 92, 0.1);
    will-change: transform, box-shadow;
}
.card h3 { 
    font-size: 1.25rem; 
    font-weight: 600; 
    margin-bottom: 1.2rem; 
    color: var(--text-main); 
    letter-spacing: -0.01em; 
    font-family: var(--font-main);
}

.subject-folder { 
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); 
    padding: 1.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.05); position: relative; overflow: hidden; 
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); 
    min-height: 180px; display: flex; flex-direction: column; justify-content: flex-end;
    backdrop-filter: blur(12px);
    transform: translate3d(0,0,0);
}
.subject-folder:hover { transform: translateY(-6px) translate3d(0,0,0); box-shadow: var(--glow-primary); border-color: rgba(129, 140, 248, 0.2); }

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

.list-item { background: transparent; padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; transition: 0.2s; margin-bottom: 0.5rem; }
.list-item:hover { background: var(--primary-glow); border-color: var(--primary); }

/* Buttons */
.btn { 
    padding: 0.7rem 1.2rem; border-radius: var(--radius-md); border: none; font-weight: 500; 
    cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; 
    justify-content: center; gap: 0.5rem; font-size: 0.9rem; position: relative;
}
.primary-btn { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 8px 24px var(--primary-glow);
}
.primary-btn:hover { 
    background: var(--primary-hover); 
    box-shadow: 0 12px 32px var(--primary-glow), 0 0 0 4px rgba(255, 124, 92, 0.15);
    transform: translateY(-2px); 
}
.primary-btn:active { transform: translateY(0); }
.secondary-btn { 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
}
.secondary-btn:hover { 
    background: rgba(255, 255, 255, 0.06); 
    border-color: rgba(255, 255, 255, 0.2); 
    transform: translateY(-1px);
}
.icon-btn { 
    padding: 0.6rem; 
    background: rgba(255, 255, 255, 0.03); 
    color: var(--text-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.icon-btn:hover { 
    color: var(--primary); 
    background: var(--primary-glow);
    border-color: var(--primary);
}

/* Utils */
.mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; } .mb-1 { margin-bottom: 1rem; }
.input-field { 
    width: 100%; padding: 0.8rem; border-radius: var(--radius-md); 
    border: 1px solid var(--border-color); font-family: inherit; 
    background: var(--bg-secondary); color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.hidden { display: none !important; }
.hidden-input { display: none; }

/* Modals */
.modal { 
    border: none; border-radius: var(--radius-lg); padding: 2rem; max-width: 600px; width: 100%; 
    margin: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.4); 
    background: var(--bg-secondary); color: var(--text-main);
    backdrop-filter: blur(20px); border: 1px solid var(--border-color);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); }
.modal-content { position: relative; }
.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 1.5rem; 
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* TOPIC HUB & FLASHCARDS */
.hub-card { cursor: pointer; text-align: center; border: 2px solid transparent; transition: 0.3s; padding: 1.5rem; border-radius: var(--radius-md); }
.hub-card:hover { border-color: var(--primary); transform: translateY(-5px); background: rgba(123, 158, 113, 0.03); }

/* 3D Flashcard */
.flashcard-container { perspective: 1000px; width: 100%; height: 300px; cursor: pointer; margin: 2rem auto; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1); transform-style: preserve-3d; }
.flashcard-container.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; padding: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.flashcard-front { background: linear-gradient(135deg, var(--card-bg) 0%, rgba(129, 140, 248, 0.1) 100%); border: 1px solid var(--border-color); }
.flashcard-back { background: var(--card-bg); border: 2px solid var(--primary); transform: rotateY(180deg); }

.flashcard-container.flipped + #fc-actions { opacity: 1 !important; pointer-events: auto !important; }

/* Dashboard & Stats */
.mini-stat { 
    display: flex; flex-direction: column; justify-content: space-between; gap: 0.8rem; 
    padding: 1.2rem; background: var(--bg-secondary); border-radius: var(--radius-md); 
    border: 1px solid var(--border-color); flex: 1; transition: 0.3s ease;
}
.mini-stat:hover { border-color: var(--primary); background: var(--primary-glow); }
.mini-stat i { font-size: 1.5rem; padding: 0.5rem; background: var(--card-bg); border-radius: var(--radius-sm); width: max-content; }
.mini-stat h4 { font-size: 1.8rem; font-weight: 700; color: var(--text-main); font-family: var(--font-mono); }
.mini-stat p { font-size: 0.85rem; color: var(--text-light); }

/* AUTH OVERLAY */
.auth-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-color); background-image: var(--mesh-gradient); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.auth-card { background: var(--card-bg); backdrop-filter: blur(20px); border: 1px solid var(--border-color); padding: 3rem; border-radius: var(--radius-lg); box-shadow: var(--glow-primary); width: 100%; max-width: 450px; }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { background: linear-gradient(135deg, var(--text-main), var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* TOASTS */
.toast-container { position: fixed; top: 2rem; right: 2rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.8rem; }
.toast { background: var(--bg-secondary); backdrop-filter: blur(16px); border: 1px solid var(--border-color); padding: 1rem 1.5rem; border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 1rem; min-width: 280px; animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* PROFILE */
.user-profile-badge { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1rem; background: transparent; border-radius: var(--radius-md); cursor: pointer; transition: 0.2s; border: 1px solid transparent; width: 100%; }
.user-profile-badge:hover { background: var(--bg-secondary); border-color: var(--border-color); }
.avatar-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.avatar-large { width: 120px; height: 120px; border-radius: 50%; border: 3px solid var(--primary); margin-bottom: 1.5rem; display: block; object-fit: cover; box-shadow: var(--glow-primary); }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.avatar-option { width: 50px; height: 50px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.avatar-option:hover { transform: scale(1.15); }
.avatar-option.selected { border-color: var(--primary); transform: scale(1.15); box-shadow: var(--glow-primary); }

/* SIDEBAR STREAK BADGE */
.sidebar-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.2), rgba(255, 69, 0, 0.15));
    border: 1px solid rgba(255, 140, 0, 0.3);
    padding: 2px 7px 2px 4px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #ff8c00;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.sidebar-streak-flame {
    width: 14px;
    height: 14px;
    color: #ff8c00;
    filter: drop-shadow(0 0 3px rgba(255, 140, 0, 0.5));
}
.sidebar-streak-badge.has-streak {
    animation: streakPulse 2.5s ease-in-out infinite;
}
.sidebar-streak-badge.has-streak .sidebar-streak-flame {
    animation: flameFlicker 1.5s ease-in-out infinite alternate;
}
@keyframes streakPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255, 140, 0, 0.2); }
    50% { box-shadow: 0 0 12px rgba(255, 140, 0, 0.5), 0 0 4px rgba(255, 69, 0, 0.3); }
}
@keyframes flameFlicker {
    0% { transform: scale(1) rotate(-3deg); }
    50% { transform: scale(1.15) rotate(2deg); }
    100% { transform: scale(1.05) rotate(-1deg); }
}

/* VOLUME SLIDER */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 6px var(--primary-glow);
    transition: transform 0.2s;
}
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px var(--primary-glow);
}

/* TIMER V3 (Constellation) */
.timer-container { display: flex; flex-direction: column; align-items: center; width: 100%; padding: 2rem; }
.timer-circle-wrapper { 
    position: relative; 
    width: 320px; 
    height: 320px; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    border-radius: 50%;
}
.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0 10px rgba(255, 138, 102, 0.1)); }
.timer-bg-circle { fill: none; stroke: var(--bg-secondary); stroke-width: 3; }
.timer-progress-circle { 
    fill: none; 
    stroke: var(--primary); 
    stroke-width: 4; 
    stroke-linecap: round; 
    stroke-dasharray: 283; 
    stroke-dashoffset: 283; 
    transition: stroke-dashoffset 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.timer-content { position: absolute; text-align: center; }
#timer-display { font-size: 3.5rem; font-weight: 800; color: var(--text-main); font-family: var(--font-mono); line-height: 1; }
#timer-status { font-size: 0.9rem; color: var(--text-light); margin-top: 0.8rem; letter-spacing: 1.5px; text-transform: uppercase; }

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

/* FOOTER */
.app-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 2rem;
    margin-top: 5rem;
    width: 100%;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}
.footer-section h4 { color: var(--primary); margin-bottom: 1.2rem; font-size: 1.1rem; }
.footer-section p, .footer-section a { color: var(--text-light); font-size: 0.9rem; margin-bottom: 0.6rem; display: block; text-decoration: none; transition: 0.2s; }
.footer-section a:hover { color: var(--primary); transform: translateX(5px); }
.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-light);
}

/* MANUAL MODAL */
.manual-body h3 { color: var(--primary); margin-top: 1.5rem; margin-bottom: 0.5rem; font-size: 1.2rem; }
.manual-body p { line-height: 1.7; color: var(--text-main); margin-bottom: 1rem; }
.manual-body a { color: var(--primary); font-weight: 600; text-decoration: underline; }

/* ========================================================= */
/* LANDING PAGE STYLES — Aurora Dark Premium                 */
/* ========================================================= */

.landing-container {
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-color);
    background-image: var(--mesh-gradient);
    color: var(--text-main);
    scroll-behavior: smooth;
}
.landing-container::-webkit-scrollbar { width: 6px; }
.landing-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* PDF STUDIO - 3 COLUMN "SMART LAB" */
.studio-layout-controls {
    display: flex;
    justify-content: center;
    padding: 0.2rem 0 0.8rem; /* Ridotto il padding */
    margin-top: -1.5rem; /* Avvicinato alla topbar */
}

.segmented-control {
    display: inline-flex;
    background: var(--bg-secondary);
    padding: 0.3rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    gap: 0.3rem;
    box-shadow: var(--glass-shadow);
}

.segment-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.segment-btn i {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.segment-btn:hover {
    color: var(--text-main);
    background: var(--primary-glow);
}

.segment-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.segment-btn.active i {
    opacity: 1;
}

.studio-layout {
    display: flex;
    gap: 1rem;
    height: calc(100vh - 10rem);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    width: 100%;
}

.studio-pdf-panel {
    flex: 1 1 50%;
    min-width: 300px;
}

.studio-ai-panel {
    flex: 0 0 400px;
}

.studio-note-panel {
    flex: 0 0 350px;
}

.hidden-panel {
    display: none !important;
}

.studio-pdf-panel, .studio-ai-panel, .studio-note-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.studio-note-panel {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(252, 211, 77, 0.05);
}

.studio-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.note-editor {
    flex: 1;
    padding: 1.5rem;
    background: transparent;
    color: var(--text-main);
    border: none;
    resize: none;
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
    font-family: var(--font-main);
    overflow-y: auto;
}

.note-editor[contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: var(--text-light);
    pointer-events: none;
    display: block;
}

.loader-pulse {
    animation: pulseGlow 1.5s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.5; filter: drop-shadow(0 0 5px var(--primary)); }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px var(--primary)); }
    100% { transform: scale(1); opacity: 0.5; filter: drop-shadow(0 0 5px var(--primary)); }
}

.note-toolbar {
    padding: 0.8rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    background: rgba(0,0,0,0.1);
}

@media (max-width: 1400px) {
    .studio-ai-panel {
        flex: 1 1 40%;
    }
    .studio-note-panel {
        position: fixed;
        right: 2rem;
        bottom: 2rem;
        width: 350px;
        height: 500px;
        z-index: 100;
        box-shadow: var(--glass-shadow);
        transform: translateY(calc(100% + 1rem));
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .studio-note-panel.open {
        transform: translateY(0);
    }
}

.landing-navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem 4rem; max-width: 1200px; margin: 0 auto;
    animation: fadeDown 0.8s ease;
}
@keyframes fadeDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

.landing-logo { display: flex; align-items: center; gap: 0.5rem; }
.landing-nav-actions { display: flex; gap: 1rem; }

.landing-hero {
    text-align: center; padding: 10rem 2rem 6rem; max-width: 850px; margin: 0 auto;
    position: relative;
}

.landing-hero h1 {
    font-size: 4rem; line-height: 1.1; margin-bottom: 1.5rem;
    font-weight: 800; letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 50%, var(--accent) 100%);
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.landing-hero p { font-size: 1.25rem; color: var(--text-light); margin-bottom: 3rem; line-height: 1.7; }

.cta-btn {
    padding: 1rem 2.5rem; font-size: 1.1rem; border-radius: 50px;
    box-shadow: var(--glow-primary);
    animation: pulse 3s ease-in-out infinite;
    position: relative;
}
.cta-btn::after {
    content: ''; position: absolute; inset: -2px; border-radius: 50px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    z-index: -1; opacity: 0; transition: opacity 0.3s;
    filter: blur(12px);
}
.cta-btn:hover::after { opacity: 1; }
@keyframes pulse { 0%, 100% { box-shadow: var(--glow-primary); } 50% { box-shadow: 0 0 30px var(--primary-glow), 0 0 60px var(--primary-glow); } }

.hero-stats { margin-top: 2rem; font-size: 0.85rem; color: var(--text-light); }

/* Showcase */
.landing-showcase { max-width: 1000px; margin: 0 auto 6rem; padding: 0 2rem; position: relative; }
.showcase-images { position: relative; width: 100%; height: 600px; }

.css-mockup {
    border-radius: 12px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    position: absolute;
    background: var(--bg-color);
    overflow: hidden;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

.mockup-header-bar {
    height: 30px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 8px;
}

.mockup-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.mockup-sidebar {
    width: 200px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    font-size: 0.8rem;
}

.mockup-nav-item {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.mockup-nav-item.active {
    background: rgba(123, 158, 113, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.mockup-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    flex: 1;
}

.mockup-subject-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(129, 140, 248, 0.05) 100%);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.mockup-flashcard {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
}

.main-mockup {
    width: 80%;
    height: 500px;
    top: 0;
    left: 0;
    z-index: 1;
}

.floating-mockup {
    width: 50%;
    height: 350px;
    bottom: 0;
    right: 0;
    z-index: 2;
    transform: translateY(20px);
    transition: 0.5s ease;
    box-shadow: -20px 20px 50px rgba(0,0,0,0.4);
}

.landing-showcase:hover .floating-mockup {
    transform: translateY(0);
}

.landing-features {
    padding: 6rem 2rem;
    background: rgba(17, 17, 20, 0.6);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.landing-features h2 { text-align: center; font-size: 2.5rem; margin-bottom: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.landing-features h2 + p { text-align: center; color: var(--text-light); margin-bottom: 4rem; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; max-width: 1200px; margin: 0 auto; }

.feature-card {
    background: var(--card-bg); padding: 2.5rem; border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); position: relative; overflow: hidden;
    backdrop-filter: blur(12px);
}
.feature-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0; transition: opacity 0.4s;
}
.feature-card:hover { transform: translateY(-8px); border-color: rgba(129, 140, 248, 0.2); box-shadow: var(--glow-primary); }
.feature-card:hover::before { opacity: 1; }

.feature-icon {
    width: 48px; height: 48px; color: var(--primary); margin-bottom: 1.5rem;
    background: var(--primary-glow); padding: 10px; border-radius: var(--radius-md);
}
.feature-card h3 { font-size: 1.2rem; margin-bottom: 0.8rem; font-weight: 600; }
.feature-card p { color: var(--text-light); line-height: 1.7; font-size: 0.95rem; }

/* Pricing */
.landing-pricing { padding: 6rem 2rem; max-width: 1200px; margin: 0 auto; }
.landing-pricing h2 { text-align: center; font-size: 2.5rem; margin-bottom: 1rem; font-weight: 700; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 3rem; }

.pricing-card {
    background: var(--card-bg); padding: 3rem 2rem; border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); text-align: center; position: relative;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
}
.pricing-card:hover { transform: translateY(-8px); border-color: rgba(129, 140, 248, 0.15); }

.pricing-card.recommended {
    border: 2px solid var(--primary); transform: scale(1.05);
    background: linear-gradient(180deg, var(--card-bg) 0%, rgba(129, 140, 248, 0.05) 100%);
    box-shadow: var(--glow-primary);
}
.pricing-card.recommended:hover { transform: scale(1.05) translateY(-8px); }

.recommended-badge {
    position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--accent)); color: white;
    padding: 0.5rem 1.5rem; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}

.pricing-card h3 { font-size: 1.4rem; margin-bottom: 1rem; font-weight: 600; }
.price { font-size: 3rem; font-weight: 800; color: var(--text-main); margin-bottom: 2rem; }
.price span { font-size: 1rem; font-weight: 400; color: var(--text-light); }

.pricing-features { list-style: none; text-align: left; margin-bottom: 2rem; }
.pricing-features li { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; color: var(--text-light); font-size: 0.95rem; }
.pricing-features li i { color: var(--success); width: 18px; height: 18px; }

/* Testimonials */
.landing-testimonials {
    padding: 6rem 2rem;
    background: rgba(17, 17, 20, 0.6);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
}
.landing-testimonials h2 { text-align: center; font-size: 2.5rem; margin-bottom: 4rem; font-weight: 700; }
.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; max-width: 1200px; margin: 0 auto; }
.testimonial-card {
    background: var(--card-bg); padding: 2.5rem; border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}
.testimonial-card:hover { border-color: rgba(129, 140, 248, 0.15); transform: translateY(-4px); }
.stars { color: #FBBF24; font-size: 1.1rem; margin-bottom: 1rem; letter-spacing: 2px; }
.testimonial-card p { font-size: 1rem; line-height: 1.7; margin-bottom: 2rem; font-style: italic; color: var(--text-light); }
.testimonial-card .user-info { display: flex; align-items: center; gap: 1rem; }
.testimonial-card .user-info img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--primary); }
.testimonial-card .user-info strong { display: block; color: var(--text-main); font-size: 0.95rem; }
.testimonial-card .user-info span { font-size: 0.8rem; color: var(--text-light); }

/* FAQ */
.landing-faq { padding: 6rem 2rem; max-width: 800px; margin: 0 auto; }
.landing-faq h2 { text-align: center; font-size: 2.5rem; margin-bottom: 4rem; font-weight: 700; }
.faq-container { display: flex; flex-direction: column; gap: 0.8rem; }
.faq-item {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 1.2rem 1.5rem;
    backdrop-filter: blur(12px); transition: border-color 0.3s;
}
.faq-item:hover, .faq-item[open] { border-color: rgba(129, 140, 248, 0.2); }
.faq-item summary {
    font-size: 1.05rem; font-weight: 600; cursor: pointer; list-style: none;
    display: flex; justify-content: space-between; align-items: center; color: var(--text-main);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.4rem; color: var(--primary); transition: 0.3s; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin-top: 1rem; color: var(--text-light); line-height: 1.7; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.95rem; }

/* Landing Footer & Motto */
.landing-footer {
    background: var(--bg-secondary);
    padding: 6rem 2rem 2rem;
    border-top: 1px solid var(--border-color);
}

.motto-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.motto-section h2 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.motto-section p {
    font-size: 1.2rem;
    color: var(--text-light);
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-column h4 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.footer-column a {
    color: var(--text-light);
    text-decoration: none;
    transition: 0.2s;
    font-size: 0.9rem;
}

.footer-column a:hover {
    color: var(--primary);
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .main-content { padding: 2rem 1.5rem; }
    .sidebar { position: fixed; bottom: 0; left: 0; width: 100%; height: auto; flex-direction: row; padding: 0.5rem; border-top: 1px solid var(--border-color); z-index: 100; }
    .sidebar-header, .sidebar-footer, .user-profile-badge { display: none; }
    .sidebar-nav { flex-direction: row; justify-content: space-around; width: 100%; }
    .nav-btn { flex-direction: column; font-size: 0.7rem; gap: 0.2rem; padding: 0.5rem; }
}

/* ==========================================================
   FOCUS MODE
   ========================================================== */
body.focus-mode-active .sidebar,
body.focus-mode-active .view-header,
body.focus-mode-active .timer-stats-sidebar,
body.focus-mode-active .timer-stats,
body.focus-mode-active .stats-comparison-card,
body.focus-mode-active .main-footer {
    display: none !important;
}

body.focus-mode-active .main-content {
    margin-left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #050505 !important;
}

body.focus-mode-active #view-timer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.focus-mode-active .timer-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: none;
}

body.focus-mode-active .timer-main-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(1.4);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.focus-mode-active #focus-dynamic-quote {
    display: block !important;
    animation: fadeIn 1s ease-in-out;
}

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

body.focus-mode-active label[for="session-goal-input"],
body.focus-mode-active #session-goal-input,
body.focus-mode-active #ambient-sound-selector {
    display: none !important;
}

body.focus-mode-active #btn-enter-focus {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

/* ================================================ */
/* PDF STUDIO — Layout Side-by-Side                  */
/* ================================================ */

#view-pdf-studio.active {
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - 8rem);
    padding: 0;
}

.studio-layout {
    display: flex;
    gap: 0;
    height: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.resizer {
    flex: 0 0 10px;
    cursor: col-resize;
    background: transparent;
    transition: all 0.2s;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Affordance visiva: puntini o linea sempre visibile */
.resizer::before {
    content: '⋮';
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.resizer::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    background: var(--border-color);
    border-radius: 1px;
    transition: all 0.2s;
    opacity: 0.2;
}

.resizer:hover::before, .resizer.dragging::before {
    opacity: 1;
    color: var(--primary);
}

.resizer:hover::after, .resizer.dragging::after {
    background: var(--primary);
    width: 3px;
    opacity: 1;
    box-shadow: 0 0 10px var(--primary-glow);
}

.resizer:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Blocco pointer-events durante il drag per fluidità */
body.is-resizing iframe,
body.is-resizing .studio-panel-header,
body.is-resizing .studio-ai-panel {
    pointer-events: none !important;
    user-select: none !important;
}

/* ---- Pannelli comuni ---- */
.studio-pdf-panel {
    flex: 1 1 0;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.studio-ai-panel {
    flex: 0 0 450px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

.studio-note-panel {
    display: none; /* Old panel, we remove its flex rules just in case */
}

/* ---- Floating Smart Notes Window ---- */
.floating-notes-window {
    position: absolute;
    top: 5rem;
    right: 2rem;
    width: 400px;
    height: 550px;
    background: var(--bg-color);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 60px rgba(0,0,0,0.4), 0 0 20px rgba(252, 211, 77, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    animation: floatIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: grab;
}

.floating-window-header:active {
    cursor: grabbing;
}

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

.note-editor {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.studio-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

/* ---- PDF Viewer ---- */
.studio-pdf-viewer {
    flex: 1;
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #1a1a2e;
    min-height: 0;
}

#pdf-studio-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.pdf-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--card-bg);
}

/* ---- AI Panel pieces ---- */
.studio-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.studio-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 0.6rem;
}

.studio-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-height: 110px;
    overflow-y: auto;
}
.studio-chips-row::-webkit-scrollbar { width: 3px; }
.studio-chips-row::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.topic-chip {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}
.topic-chip:hover { border-color: var(--primary); color: var(--primary); }
.topic-chip.active {
    background: rgba(var(--primary-rgb, 129,140,248), 0.15);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.studio-topic-badge {
    font-size: 0.75rem;
    background: rgba(var(--primary-rgb, 129,140,248), 0.15);
    color: var(--primary);
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* ---- Tab bar ---- */
.studio-tab-bar {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.studio-tab-btn {
    flex: 1;
    padding: 0.55rem 0.4rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-light);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    backdrop-filter: blur(12px);
}
.studio-tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.studio-tab-btn.active {
    background: rgba(var(--primary-rgb, 129,140,248), 0.15);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ---- Content area ---- */
.studio-ai-content {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    overflow-y: auto;
    backdrop-filter: blur(12px);
    min-height: 0;
}
.studio-ai-content::-webkit-scrollbar { width: 5px; }
.studio-ai-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.studio-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1.5rem;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

/* ---- Hypnotic AI Loader ---- */
.hypnotic-loader {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 50%;
    filter: blur(25px);
    opacity: 0.3;
    animation: hypnotic-pulse 2.5s infinite alternate ease-in-out;
}

.loader-icon {
    position: relative;
    z-index: 2;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.5));
    animation: hypnotic-float 3s infinite ease-in-out;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: hypnotic-rotate 1.5s infinite linear;
}

@keyframes hypnotic-pulse {
    0% { transform: scale(0.8); opacity: 0.2; }
    100% { transform: scale(1.3); opacity: 0.5; }
}

@keyframes hypnotic-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}

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

/* ---- Riassunto ---- */
.studio-summary-body { font-size: 0.88rem; line-height: 1.75; }
.studio-summary-body h1, .studio-summary-body h2, .studio-summary-body h3 { color: var(--primary); margin: 1rem 0 0.4rem; }
.studio-summary-body ul, .studio-summary-body ol { margin-left: 1.4rem; margin-bottom: 0.7rem; }
.studio-summary-body li { margin-bottom: 0.3rem; }
.studio-summary-body strong { color: var(--text-main); }

/* ---- Quiz ---- */
.studio-quiz-q {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 1.1rem;
    color: var(--text-main);
}
.studio-quiz-options { display: flex; flex-direction: column; gap: 0.55rem; }
.studio-quiz-opt {
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: all 0.18s;
    font-size: 0.85rem;
    color: var(--text-main);
}
.studio-quiz-opt:hover { border-color: var(--primary); background: rgba(var(--primary-rgb,129,140,248),0.08); }
.studio-quiz-opt.correct { border-color: #66bb6a; background: rgba(102,187,106,0.15); color: #66bb6a; font-weight: 600; }
.studio-quiz-opt.wrong { border-color: #ef5350; background: rgba(239,83,80,0.12); color: #ef5350; }
.studio-quiz-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: 1rem; 
    font-size: 0.82rem; 
    color: var(--text-light);
    position: sticky;
    bottom: -1rem; /* Adjust for padding */
    background: var(--bg-secondary);
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    z-index: 5;
}

.feedback-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 500px;
    margin-top: 1.5rem;
    box-shadow: var(--glass-shadow);
}

.feedback-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.feedback-actions {
    padding: 1.2rem 1.5rem;
    background: rgba(var(--bg-color-rgb), 0.5);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.quiz-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

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

.studio-quiz-explanation strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.studio-quiz-header { margin-bottom: 1.2rem; }
.studio-progress-wrap { height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; margin-bottom: 0.5rem; }
.studio-progress-fill { height: 100%; background: var(--primary); transition: width 0.3s ease; }
.studio-progress-text { font-size: 0.72rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

/* ---- Library Evolution: Topic Pills & Mastery ---- */
.topic-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.topic-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.75rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}

.topic-pill:hover {
    background: rgba(var(--primary-rgb, 129, 140, 248), 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    color: var(--text-main);
}

.topic-pill .mastery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* Mastery Levels */
.topic-pill[data-mastery="0"] .mastery-dot { background: #64748b; } /* Vuoto */
.topic-pill[data-mastery="low"] .mastery-dot { background: #ef5350; box-shadow: 0 0 8px rgba(239,83,80,0.4); } /* < 30% */
.topic-pill[data-mastery="mid"] .mastery-dot { background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,0.4); } /* < 70% */
.topic-pill[data-mastery="high"] .mastery-dot { background: #34d399; box-shadow: 0 0 12px rgba(52,211,153,0.6); } /* 100% */

.topic-pill .perc-tag {
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.7;
}

.subject-header, .docs-list { position: relative; z-index: 2; }

.document-mini-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* ---- Flashcard 3D ---- */
.studio-fc-wrap { perspective: 1000px; width: 100%; height: 190px; cursor: pointer; margin-bottom: 0.8rem; }
.studio-fc-inner { position: relative; width: 100%; height: 100%; transition: transform 0.55s cubic-bezier(0.4,0.2,0.2,1); transform-style: preserve-3d; }
.studio-fc-wrap.flipped .studio-fc-inner { transform: rotateY(180deg); }
.studio-fc-face {
    position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
    border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
    padding: 1.5rem; text-align: center; font-size: 0.9rem;
}
.studio-fc-front { background: var(--bg-secondary); border: 1px solid var(--border-color); }
.studio-fc-back { background: rgba(var(--primary-rgb,129,140,248),0.12); border: 2px solid var(--primary); transform: rotateY(180deg); }
.studio-fc-hint { font-size: 0.72rem; color: var(--text-light); text-align: center; margin-bottom: 0.8rem; }
.studio-fc-nav { display: flex; justify-content: center; align-items: center; gap: 1rem; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .studio-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 45vh 1fr;
    }
    #view-pdf-studio.active { height: auto; }
}

        const themePrimary = getComputedStyle(document.body).getPropertyValue('--primary').trim() || '#FF7E67';
        const themePrimaryRGB = getComputedStyle(document.body).getPropertyValue('--primary-rgb').trim() || '255, 126, 103';
        const themeText = getComputedStyle(document.body).getPropertyValue('--text-light').trim() || '#71717a';

        const gradient = ctx.createLinearGradient(0, 0, 0, 200);
        gradient.addColorStop(0, `rgba(${themePrimaryRGB}, 0.4)`);
        gradient.addColorStop(1, `rgba(${themePrimaryRGB}, 0)`);


/* ========================================================== 
   KNOWLEDGE GRAPH — Competency Heatmap
   ========================================================== */ 
#knowledge-graph-container { 
    position: fixed; 
    inset: 0; 
    z-index: 2000; 
    background: rgba(var(--bg-color-rgb, 10, 10, 12), 0.94); 
    backdrop-filter: blur(25px); 
    display: flex; 
    flex-direction: column; 
} 
#knowledge-graph-container.hidden { 
    display: none !important; 
} 

/* Header */
.kg-header { 
    padding: 1rem 2rem; 
    border-bottom: 1px solid var(--border-color); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--bg-secondary);
    gap: 1.5rem;
}

.kg-weak-hint {
    font-size: 0.78rem;
    margin: 0.2rem 0 0;
    transition: color 0.3s;
    line-height: 1.3;
}

/* Canvas */
#kg-canvas { 
    flex: 1; 
    width: 100%; 
    height: 100%; 
    cursor: grab; 
} 
#kg-canvas:active { 
    cursor: grabbing; 
}

/* Footer / Legend */
.kg-footer {
    padding: 0.7rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    flex-wrap: wrap;
    gap: 0.8rem;
}

.kg-legend {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.kg-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.73rem;
    color: rgba(255,255,255,0.55);
    font-weight: 500;
}

.kg-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.kg-dot-pulse {
    animation: kgDotPulse 1.8s ease-in-out infinite;
}

@keyframes kgDotPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(239,83,80,0.3); transform: scale(1); }
    50% { box-shadow: 0 0 10px rgba(239,83,80,0.7); transform: scale(1.2); }
}

.kg-legend-shapes {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
}

/* ==========================================================
   GAMIFICATION TIERS (Bronze, Silver, Gold, Diamond)
   ========================================================== */
.lv-badge {
    font-size: 0.7rem; 
    padding: 2px 8px; 
    border-radius: 6px; 
    margin-left: 6px; 
    vertical-align: middle;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-bronze { 
    background: rgba(205, 127, 50, 0.15) !important; 
    color: #cd7f32 !important; 
    border: 1px solid rgba(205, 127, 50, 0.3) !important; 
}
.tier-silver { 
    background: rgba(192, 192, 192, 0.15) !important; 
    color: #e2e2e2 !important; 
    border: 1px solid rgba(192, 192, 192, 0.3) !important; 
}
.tier-gold { 
    background: rgba(255, 215, 0, 0.15) !important; 
    color: #ffd700 !important; 
    border: 1px solid rgba(255, 215, 0, 0.4) !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}
.tier-diamond { 
    background: rgba(185, 242, 255, 0.15) !important; 
    color: #b9f2ff !important; 
    border: 1px solid rgba(185, 242, 255, 0.5) !important;
    box-shadow: 0 0 15px rgba(185, 242, 255, 0.2);
    animation: diamondGlow 3s infinite alternate;
}

@keyframes diamondGlow {
    from { box-shadow: 0 0 10px rgba(185, 242, 255, 0.1); }
    to { box-shadow: 0 0 20px rgba(185, 242, 255, 0.4); }
}

/* Avatar Borders */
.avatar-img { transition: border 0.3s, box-shadow 0.3s; }
.avatar-img.tier-bronze { border: 2px solid #cd7f32 !important; }
.avatar-img.tier-silver { border: 2px solid #c0c0c0 !important; }
.avatar-img.tier-gold { border: 2px solid #ffd700 !important; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3) !important; }
.avatar-img.tier-diamond { border: 2px solid #b9f2ff !important; box-shadow: 0 0 15px rgba(185, 242, 255, 0.4) !important; }

.avatar-large { border: 2px solid transparent; transition: all 0.3s; }
.avatar-large.tier-bronze { border: 4px solid #cd7f32 !important; }
.avatar-large.tier-silver { border: 4px solid #c0c0c0 !important; }
.avatar-large.tier-gold { border: 4px solid #ffd700 !important; box-shadow: 0 0 20px rgba(255, 215, 0, 0.3) !important; }
.avatar-large.tier-diamond { border: 4px solid #b9f2ff !important; box-shadow: 0 0 30px rgba(185, 242, 255, 0.4) !important; }

/* ==========================================================
   STUDIO CHAT
   ========================================================== */
.studio-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.studio-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}
.studio-chat-messages::-webkit-scrollbar { width: 4px; }
.studio-chat-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.studio-chat-suggestions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    overflow-x: auto;
    margin-bottom: 0.5rem;
}
.studio-chat-suggestions::-webkit-scrollbar { display: none; }

.suggestion-chip {
    white-space: nowrap;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}
.suggestion-chip:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: slideInUp 0.3s ease-out;
}

.chat-msg > div {
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.5;
}

.user-msg { align-self: flex-end; }
.user-msg > div {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.ai-msg { align-self: flex-start; }
.ai-msg > div {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
    backdrop-filter: blur(8px);
}

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

.studio-chat-input-wrap {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#studio-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#studio-chat-input:focus { border-color: var(--primary); background: rgba(255, 255, 255, 0.05); }

