/* Global styles for Telegram Mini App */
/* ===================================
   NUTTY Design System v2.0
   🐿️ Squirrel & Acorn Theme
   =================================== */

:root {
    /* Primary Brand Colors - Warm Amber/Orange (Squirrel fur) */
    --primary: #D97706;
    --primary-light: #F59E0B;
    --primary-dark: #B45309;
    
    /* Secondary - Forest Green */
    --secondary: #059669;
    --secondary-light: #10B981;
    --secondary-dark: #047857;
    
    /* Background Colors - Deep Warm Forest */
    --bg: #0C0A09;
    --bg-secondary: #1C1917;
    --bg-tertiary: #292524;
    --bg-elevated: #1C1917;
    
    /* Surface Colors */
    --surface: #1C1917;
    --surface-hover: #292524;
    
    /* Text Colors */
    --text: #FAFAF9;
    --text-secondary: #A8A29E;
    --muted: #78716C;
    
    /* Border - Warm tones */
    --border: #292524;
    --border-light: #44403C;
    
    /* Semantic Colors */
    --success: #22C55E;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --error: #EF4444;
    --error-bg: rgba(239, 68, 68, 0.12);
    
    /* Accent - Acorn Gold/Brown for NUT Token */
    --gold: #F59E0B;
    --gold-light: #FBBF24;
    --gold-bg: rgba(245, 158, 11, 0.15);
    
    /* Acorn Brown - for special accents */
    --acorn: #92400E;
    
    /* Accent - Purple for special CTAs */
    --accent: #8B5CF6;
    --accent-light: #A78BFA;
    --acorn-light: #B45309;
    --acorn-bg: rgba(146, 64, 14, 0.15);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* Typography */
    --font-xs: 11px;
    --font-sm: 12px;
    --font-base: 14px;
    --font-md: 16px;
    --font-lg: 18px;
    --font-xl: 20px;
    --font-2xl: 24px;
    
    /* Transitions */
    --transition-fast: 120ms ease;
    --transition-normal: 200ms ease;
}

/* Light Theme - Manual override via data-theme="light" */
html[data-theme="light"] {
    --bg: #FEFBF6;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F5F0E8;
    --bg-elevated: #FFFFFF;
    --surface: #FFFFFF;
    --surface-hover: #F5F0E8;
    --text: #1C1917;
    --text-secondary: #57534E;
    --muted: #78716C;
    --border: #E7E5E4;
    --border-light: #D6D3D1;
    --shadow-sm: 0 2px 8px rgba(28, 25, 23, 0.08);
    --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.12);
    --shadow-lg: 0 8px 32px rgba(28, 25, 23, 0.16);
}

/* Dark is default - no need for media query when using data-theme */
html {
    color-scheme: dark light;
}

html[data-theme="light"] {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--font-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: calc(100vh - 64px - 56px);
    padding: 72px 12px 80px;
    box-sizing: border-box;
}

#app > h1 { display: none !important; }

/* ===================================
   Bottom Navigation
   =================================== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    z-index: 900;
    background: var(--bg-secondary);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-btn::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
    transition: background var(--transition-fast);
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn.active::after {
    background: var(--primary);
}

.nav-icon {
    width: 28px;
    height: 28px;
    opacity: 0.7;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.nav-btn:hover .nav-icon {
    opacity: 0.85;
}

.nav-btn.active .nav-icon {
    opacity: 1;
    transform: scale(1.1);
}

/* ===================================
   Top Bar / Header
   =================================== */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    box-sizing: border-box;
    background: var(--bg-secondary);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

#top-bar .left { 
    display: flex; 
    align-items: center; 
    gap: var(--space-sm); 
    min-width: 0; 
}

#top-bar .right { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* Header Stats - Modern unified style */
#top-bar .header-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

#top-bar .header-stat:hover {
    background: rgba(255, 255, 255, 0.08);
}

#top-bar .header-stat .stat-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

#top-bar .header-stat .stat-value {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}

#top-bar .header-stat .stat-sep {
    color: var(--muted);
    opacity: 0.6;
    margin: 0 1px;
}

/* Specific stat colors */
#top-bar .header-stat.streak {
    border-color: rgba(168, 85, 247, 0.3);
}

#top-bar .header-stat.streak .stat-value {
    color: #A855F7;
}

#top-bar .header-stat.ads {
    border-color: rgba(239, 68, 68, 0.3);
}

#top-bar .header-stat.ads .stat-value {
    color: #EF4444;
}

#top-bar .header-stat.energy {
    border-color: rgba(249, 115, 22, 0.3);
}

#top-bar .header-stat.energy .stat-value {
    color: #F97316;
}

#top-bar .header-stat.nut {
    border-color: rgba(245, 158, 11, 0.3);
}

#top-bar .header-stat.nut .stat-value {
    color: var(--gold);
}

#top-bar .avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    object-fit: cover;
    border: 2px solid var(--border);
}

#top-bar .identity { 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
}

#top-bar .name { 
    font-size: var(--font-base); 
    font-weight: 600; 
    color: var(--text); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 36vw; 
}

#top-bar .level { 
    font-size: var(--font-xs); 
    color: var(--muted); 
    margin-top: 1px; 
}

/* ===================================
   Utility Classes
   =================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Standard Card */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

/* Standard Button */
.btn {
    height: 44px;
    padding: 0 var(--space-lg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text);
}

/* Input */
.input {
    height: 44px;
    padding: 0 var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: var(--font-base);
    transition: border-color var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
}

.input::placeholder {
    color: var(--muted);
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 600;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
}
