/* ========================================
   CSS Variables & Reset
   ======================================== */
:root {
    --color-primary: #B7E0FF;
    --color-secondary: #FFF5CD;
    --color-accent: #FFCFB3;
    --color-highlight: #E78F81;
    
    --color-text: #2D3748;
    --color-text-light: #4A5568;
    --color-text-muted: #718096;
    --color-white: #FFFFFF;
    --color-bg: #F7FAFC;
    --color-border: #E2E8F0;
    
    --color-happy: #68D391;
    --color-sad: #63B3ED;
    --color-hungry: #F6AD55;
    --color-sleepy: #B794F4;
    --color-anxious: #FC8181;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition: all 0.3s ease;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: 3rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; }

p {
    color: var(--color-text-light);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--color-highlight);
    color: var(--color-white);
}

.btn-primary:hover {
    background: #d67a6d;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-highlight);
    color: var(--color-highlight);
}

.btn-danger {
    background: #FED7D7;
    color: #C53030;
}

.btn-danger:hover {
    background: #FEB2B2;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.05rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   Navbar
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--color-highlight);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    font-weight: 500;
    color: var(--color-text-light);
}

.nav-links a:hover {
    color: var(--color-highlight);
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-text-muted);
}

.status-indicator.connected {
    background: var(--color-happy);
    animation: pulse 2s infinite;
}

.status-indicator.error {
    background: var(--color-anxious);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 24px 80px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 60px;
}

.hero-content {
    flex: 1;
}

.hero-badge {
    display: inline-block;
    padding: 8px 16px;
    background: var(--color-secondary);
    color: var(--color-text);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--color-text) 0%, var(--color-highlight) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.2rem;
    max-width: 540px;
    margin-bottom: 32px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 48px;
}

.hero-stats {
    display: flex;
    gap: 40px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-highlight);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brain-animation {
    position: relative;
    width: 350px;
    height: 350px;
}

.brain-circle {
    position: absolute;
    border-radius: 50%;
    border: 2px solid;
    animation: rotate 20s linear infinite;
}

.brain-circle-1 {
    width: 100%;
    height: 100%;
    border-color: var(--color-primary);
    opacity: 0.5;
}

.brain-circle-2 {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-color: var(--color-accent);
    opacity: 0.6;
    animation-direction: reverse;
    animation-duration: 15s;
}

.brain-circle-3 {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-color: var(--color-highlight);
    opacity: 0.7;
    animation-duration: 10s;
}

.brain-core {
    position: absolute;
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    color: var(--color-highlight);
}

.brain-core svg {
    width: 100%;
    height: 100%;
}

.pulse-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--color-highlight);
    animation: pulse-expand 3s ease-out infinite;
    opacity: 0;
}

.pulse-ring-1 {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
}

.pulse-ring-2 {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    animation-delay: 1s;
}

.pulse-ring-3 {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    animation-delay: 2s;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-expand {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ========================================
   Section Styles
   ======================================== */
.section-header {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 60px;
}

.section-header h2 {
    margin-bottom: 16px;
}

.section-header p {
    font-size: 1.1rem;
}

/* ========================================
   Features Section
   ======================================== */
.features {
    padding: 100px 24px;
    background: var(--color-white);
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
}

.feature-card {
    padding: 32px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.feature-icon svg {
    width: 28px;
    height: 28px;
    color: var(--color-text);
}

.feature-card h3 {
    margin-bottom: 12px;
}

.feature-card:nth-child(2) .feature-icon {
    background: var(--color-secondary);
}

.feature-card:nth-child(3) .feature-icon {
    background: var(--color-accent);
}

.feature-card:nth-child(4) .feature-icon {
    background: var(--color-highlight);
}

.feature-card:nth-child(4) .feature-icon svg {
    color: var(--color-white);
}

/* ========================================
   How It Works Section
   ======================================== */
.how-it-works {
    padding: 100px 24px;
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-primary) 100%);
}

.steps {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
}

.step {
    flex: 1;
    text-align: center;
    padding: 24px;
}

.step-number {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    color: var(--color-highlight);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50%;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-md);
}

.step-content h3 {
    margin-bottom: 12px;
}

.step-connector {
    width: 60px;
    height: 2px;
    background: var(--color-white);
    margin-top: 50px;
    opacity: 0.6;
}

/* ========================================
   About Section
   ======================================== */
.about {
    padding: 100px 24px;
    background: var(--color-white);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    margin-bottom: 32px;
}

.about-content blockquote {
    font-size: 1.4rem;
    font-style: italic;
    color: var(--color-highlight);
    padding: 24px;
    background: var(--color-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
}

.about-content p {
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.about-content .btn {
    margin-top: 20px;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--color-text);
    color: var(--color-white);
    padding: 60px 24px 24px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 40px;
}

.footer-brand .logo {
    color: var(--color-white);
    margin-bottom: 16px;
}

.footer-brand .logo-icon {
    color: var(--color-primary);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
    max-width: 300px;
}

.footer-links h4 {
    color: var(--color-white);
    margin-bottom: 20px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

/* ========================================
   Dashboard Styles
   ======================================== */
.dashboard-body {
    background: var(--color-bg);
}

.navbar-dashboard {
    background: var(--color-white);
}

.dashboard-main {
    display: flex;
    padding-top: 73px;
    min-height: 100vh;
}

.sidebar {
    width: 320px;
    background: var(--color-white);
    border-right: 1px solid var(--color-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 73px);
    position: sticky;
    top: 73px;
}

.sidebar-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.emotion-display {
    text-align: center;
    padding: 24px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
}

.emotion-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    font-size: 2.5rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.emotion-icon.happy { 
    background: var(--color-happy); 
    box-shadow: 0 4px 20px rgba(104, 211, 145, 0.4);
}
.emotion-icon.sad { 
    background: var(--color-sad); 
    box-shadow: 0 4px 20px rgba(99, 179, 237, 0.4);
}
.emotion-icon.hungry { 
    background: var(--color-hungry); 
    box-shadow: 0 4px 20px rgba(246, 173, 85, 0.4);
}
.emotion-icon.sleepy { 
    background: var(--color-sleepy); 
    box-shadow: 0 4px 20px rgba(183, 148, 244, 0.4);
}
.emotion-icon.anxious { 
    background: var(--color-anxious); 
    box-shadow: 0 4px 20px rgba(252, 129, 129, 0.4);
}

.emotion-icon.emotion-pulse {
    animation: emotionBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes emotionBounce {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.emotion-display.emotion-changed {
    animation: glowPulse 0.6s ease-out;
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 143, 129, 0.4); }
    50% { box-shadow: 0 0 20px 10px rgba(231, 143, 129, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(231, 143, 129, 0); }
}

.emotion-label {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    transition: all 0.15s ease-out;
}

.emotion-confidence {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.confidence-bar {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-highlight), #F6AD55);
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.confidence-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5));
    animation: confidencePulse 1.5s ease-in-out infinite;
}

@keyframes confidencePulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.suggestion-box {
    padding: 16px;
    background: var(--color-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-highlight);
    transition: all 0.3s ease;
}

.suggestion-box.suggestion-update {
    animation: suggestionSlide 0.5s ease-out;
    border-left-color: var(--color-happy);
}

@keyframes suggestionSlide {
    0% { 
        opacity: 0.5; 
        transform: translateX(-10px);
        background: rgba(104, 211, 145, 0.2);
    }
    100% { 
        opacity: 1; 
        transform: translateX(0);
        background: var(--color-secondary);
    }
}

.suggestion-box p {
    font-size: 0.95rem;
    color: var(--color-text);
}

.band-powers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.band-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.band-name {
    width: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.band-bar {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.band-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.band-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: none;
}

.band-fill.band-high-activity::after {
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

#deltaBar { background: linear-gradient(90deg, #E53E3E, #FC8181); }
#thetaBar { background: linear-gradient(90deg, #DD6B20, #F6AD55); }
#alphaBar { background: linear-gradient(90deg, #38A169, #68D391); }
#betaBar { background: linear-gradient(90deg, #3182CE, #63B3ED); }
#gammaBar { background: linear-gradient(90deg, #805AD5, #B794F4); }

.band-value {
    width: 40px;
    font-size: 0.75rem;
    text-align: right;
    color: var(--color-text-muted);
}

.controls {
    display: flex;
    gap: 12px;
}

.controls .btn {
    flex: 1;
}

/* ========================================
   Dashboard Content
   ======================================== */
.dashboard-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-container {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h2 {
    font-size: 1.25rem;
}

.chart-controls select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--color-white);
    cursor: pointer;
}

.chart-wrapper {
    height: 300px;
    position: relative;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.secondary-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.panel {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.panel h3 {
    font-size: 1rem;
    margin-bottom: 16px;
}

.recent-emotions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.emotion-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    animation: tagFadeIn 0.3s ease-out backwards;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.emotion-tag:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.emotion-tag.emotion-tag-new {
    animation: tagPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tagFadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

@keyframes tagPopIn {
    0% { 
        opacity: 0; 
        transform: scale(0.5) translateY(10px);
    }
    50% {
        transform: scale(1.1) translateY(0);
    }
    100% { 
        opacity: 1; 
        transform: scale(1) translateY(0);
    }
}

.emotion-tag.happy { background: rgba(104, 211, 145, 0.2); color: #276749; }
.emotion-tag.sad { background: rgba(99, 179, 237, 0.2); color: #2C5282; }
.emotion-tag.hungry { background: rgba(246, 173, 85, 0.2); color: #C05621; }
.emotion-tag.sleepy { background: rgba(183, 148, 244, 0.2); color: #553C9A; }
.emotion-tag.anxious { background: rgba(252, 129, 129, 0.2); color: #C53030; }

.session-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.stat-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-item .stat-label {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.stat-item .stat-value {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text);
}

.empty-state {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ========================================
   History Page
   ======================================== */
.history-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 24px 60px;
}

.history-header {
    margin-bottom: 40px;
}

.history-header h1 {
    margin-bottom: 8px;
}

.history-header p {
    margin-bottom: 24px;
}

.history-actions {
    display: flex;
    gap: 12px;
}

.history-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.history-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.summary-card {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.summary-card h3 {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.summary-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-highlight);
}

.history-chart-container {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.history-chart-container h2 {
    margin-bottom: 20px;
}

.emotion-distribution {
    padding: 20px 0;
}

.distribution-bar {
    display: flex;
    height: 40px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-border);
}

.distribution-segment {
    transition: width 0.5s ease;
}

.distribution-segment.happy { background: var(--color-happy); }
.distribution-segment.sad { background: var(--color-sad); }
.distribution-segment.hungry { background: var(--color-hungry); }
.distribution-segment.sleepy { background: var(--color-sleepy); }
.distribution-segment.anxious { background: var(--color-anxious); }

.distribution-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-color.happy { background: var(--color-happy); }
.legend-color.sad { background: var(--color-sad); }
.legend-color.hungry { background: var(--color-hungry); }
.legend-color.sleepy { background: var(--color-sleepy); }
.legend-color.anxious { background: var(--color-anxious); }

.history-table-container {
    background: var(--color-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.history-table-container h2 {
    margin-bottom: 20px;
}

.table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.history-table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

.history-table td {
    font-size: 0.95rem;
}

.history-table tbody tr:hover {
    background: var(--color-bg);
}

/* ========================================
   Analysis Page Styles
   ======================================== */
.analysis-main {
    flex-direction: column;
    gap: 32px;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.analysis-header {
    text-align: center;
    padding: 20px 0;
}

.analysis-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--color-text);
}

.analysis-header p {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.analysis-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.analysis-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(to right, var(--color-bg), var(--color-white));
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    margin: 0;
}

.card-header h2 svg {
    color: var(--color-primary);
}

.card-content {
    padding: 24px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--color-bg);
    margin-bottom: 24px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--color-primary);
    background: rgba(231, 143, 129, 0.05);
    transform: scale(1.01);
}

.upload-zone.drag-over {
    animation: pulse-border 1s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--color-primary); }
    50% { border-color: var(--color-highlight); }
}

.upload-icon {
    margin-bottom: 16px;
    color: var(--color-primary);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.upload-subtext {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.upload-info {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.upload-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
}

.upload-info ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.upload-info li {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}

.upload-info li:last-child {
    border-bottom: none;
}

.channels-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.channel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.channel-tag {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
}

.channel-tag:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* File Preview */
.file-preview {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}

.file-info svg {
    color: var(--color-primary);
}

#fileName {
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}

#fileSize {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(231, 143, 129, 0.1);
    color: var(--color-primary);
}

.data-preview h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.preview-table-wrapper {
    overflow-x: auto;
    max-height: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.preview-table th,
.preview-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.preview-table th {
    background: var(--color-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.preview-table tr:hover {
    background: rgba(231, 143, 129, 0.05);
}

.preview-info {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 12px;
}

.analyze-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results Card */
.results-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

.placeholder-icon {
    margin-bottom: 20px;
    opacity: 0.3;
}

.placeholder-icon svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

/* Primary Result */
.primary-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: linear-gradient(135deg, var(--color-bg) 0%, rgba(231, 143, 129, 0.1) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    animation: resultReveal 0.5s ease;
}

@keyframes resultReveal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.result-emotion {
    display: flex;
    align-items: center;
    gap: 20px;
}

.emotion-icon-large {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 2.5rem;
    background: var(--color-happy);
    box-shadow: 0 8px 24px rgba(104, 211, 145, 0.3);
    animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.emotion-icon-large.happy { background: var(--color-happy); box-shadow: 0 8px 24px rgba(104, 211, 145, 0.3); }
.emotion-icon-large.sad { background: var(--color-sad); box-shadow: 0 8px 24px rgba(99, 179, 237, 0.3); }
.emotion-icon-large.hungry { background: var(--color-hungry); box-shadow: 0 8px 24px rgba(246, 173, 85, 0.3); }
.emotion-icon-large.sleepy { background: var(--color-sleepy); box-shadow: 0 8px 24px rgba(183, 148, 244, 0.3); }
.emotion-icon-large.anxious { background: var(--color-anxious); box-shadow: 0 8px 24px rgba(252, 129, 129, 0.3); }

.emotion-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.emotion-label-large {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
}

.emotion-need {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

/* Confidence Circle */
.result-confidence {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.confidence-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.confidence-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.confidence-bg {
    fill: none;
    stroke: var(--color-border);
    stroke-width: 8;
}

.confidence-progress {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confidence-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.confidence-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Result Sections */
.result-section {
    margin-bottom: 24px;
}

.result-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--color-text);
}

/* Band Powers Chart (Vertical) */
.band-powers-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 180px;
    padding: 20px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.band-bar-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    width: 50px;
}

.band-bar-vertical .bar-fill {
    width: 100%;
    height: 0%;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: height 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.band-bar-vertical[data-band="delta"] .bar-fill { background: linear-gradient(to top, #E53E3E, #FC8181); }
.band-bar-vertical[data-band="theta"] .bar-fill { background: linear-gradient(to top, #DD6B20, #F6AD55); }
.band-bar-vertical[data-band="alpha"] .bar-fill { background: linear-gradient(to top, #38A169, #68D391); }
.band-bar-vertical[data-band="beta"] .bar-fill { background: linear-gradient(to top, #3182CE, #63B3ED); }
.band-bar-vertical[data-band="gamma"] .bar-fill { background: linear-gradient(to top, #805AD5, #B794F4); }

.band-bar-vertical .bar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.band-bar-vertical .bar-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
}

/* Probabilities Grid */
.probabilities-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.probability-item {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    transition: all 0.3s ease;
    animation: probFadeIn 0.5s ease backwards;
}

.probability-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.probability-item .emoji {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

.probability-item .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 4px;
}

.probability-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
}

.probability-item.highlight {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-highlight) 100%);
    color: white;
}

.probability-item.highlight .label,
.probability-item.highlight .value {
    color: white;
}

@keyframes probFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Suggestion Box Large */
.suggestion-box.large {
    padding: 24px;
    background: linear-gradient(135deg, var(--color-secondary) 0%, rgba(255, 207, 179, 0.3) 100%);
    border-left-width: 6px;
}

.suggestion-box.large p {
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

.result-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Loading Animation */
.results-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.brain-scan {
    width: 120px;
    height: 120px;
    position: relative;
}

.brain-svg {
    width: 100%;
    height: 100%;
    color: var(--color-primary);
}

.scan-line {
    stroke: var(--color-highlight);
    stroke-width: 3;
    stroke-dasharray: 70;
    animation: scanMove 2s ease-in-out infinite;
}

@keyframes scanMove {
    0% { transform: translateY(-30px); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(30px); opacity: 0; }
}

.loading-steps {
    display: flex;
    gap: 24px;
}

.loading-steps .step {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--color-bg);
    transition: all 0.3s ease;
}

.loading-steps .step.active {
    background: var(--color-primary);
    color: white;
}

.loading-steps .step.done {
    background: var(--color-happy);
    color: white;
}

/* Sample Data Section */
.sample-data-section {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.sample-data-section h2 {
    margin-bottom: 8px;
}

.sample-data-section > p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.sample-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.btn-sample {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sample:hover {
    border-color: var(--color-primary);
    background: rgba(231, 143, 129, 0.1);
    transform: translateY(-2px);
}

.btn-sample:active {
    transform: translateY(0);
}

.sample-icon {
    font-size: 1.2rem;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .probabilities-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .hero {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .brain-animation {
        width: 280px;
        height: 280px;
    }
    
    .dashboard-main {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: none;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .sidebar-section {
        flex: 1;
        min-width: 200px;
    }
    
    .secondary-panels {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .steps {
        flex-direction: column;
    }
    
    .step-connector {
        width: 2px;
        height: 40px;
        margin: 0 auto;
    }
    
    .history-summary {
        grid-template-columns: 1fr;
    }
    
    .distribution-legend {
        flex-wrap: wrap;
    }
}
