/* ============================================
   PHANTRADE - Professional Trading Platform
   Modern Dark Futuristic Theme
   ============================================ */

/* CSS Variables - Design System */
:root {
    /* Primary Colors */
    --primary-cyan: #00f5ff;
    --primary-purple: #7b2dff;
    --primary-magenta: #ff006e;
    --primary-blue: #0066ff;

    /* Accent Colors */
    --accent-green: #00ff88;
    --accent-red: #ff3366;
    --accent-orange: #ff9500;
    --accent-yellow: #ffd700;

    /* Background Colors */
    --bg-primary: #0a0a1a;
    --bg-secondary: #0d0d24;
    --bg-tertiary: #12122e;
    --bg-card: rgba(15, 15, 40, 0.7);
    --bg-card-hover: rgba(20, 20, 50, 0.8);
    --bg-glass: rgba(15, 15, 40, 0.5);

    /* Surface Colors */
    --surface-dark: #080818;
    --surface-light: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.05);

    /* Border Colors */
    --border-primary: rgba(0, 245, 255, 0.15);
    --border-secondary: rgba(123, 45, 255, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 245, 255, 0.3);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --text-muted: rgba(255, 255, 255, 0.35);

    /* Gradient Definitions */
    --gradient-primary: linear-gradient(135deg, #00f5ff 0%, #7b2dff 50%, #ff006e 100%);
    --gradient-accent: linear-gradient(135deg, #7b2dff 0%, #ff006e 100%);
    --gradient-success: linear-gradient(135deg, #00ff88 0%, #00d4aa 100%);
    --gradient-danger: linear-gradient(135deg, #ff3366 0%, #ff006e 100%);
    --gradient-card: linear-gradient(145deg, rgba(20, 20, 50, 0.6) 0%, rgba(10, 10, 30, 0.8) 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-cyan: 0 0 20px rgba(0, 245, 255, 0.3);
    --shadow-glow-purple: 0 0 20px rgba(123, 45, 255, 0.3);
    --shadow-glow-green: 0 0 20px rgba(0, 255, 136, 0.3);
    --shadow-glow-red: 0 0 20px rgba(255, 51, 102, 0.3);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Orbitron', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 300;
    --z-toast: 400;
    --z-tooltip: 500;
}

/* Reset & Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Selection Style */
::selection {
    background: var(--primary-cyan);
    color: var(--bg-primary);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

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

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--primary-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-purple);
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.link-accent {
    color: var(--primary-cyan);
    font-weight: 500;
}

.link-accent:hover {
    text-decoration: underline;
}

/* ============================================
   Layout Utilities
   ============================================ */

.hidden {
    display: none !important;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
}

.cyber-loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
}

.loader-ring:nth-child(1) {
    border-top-color: var(--primary-cyan);
    animation: spin 1.5s linear infinite;
}

.loader-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-right-color: var(--primary-purple);
    animation: spin 1.2s linear reverse infinite;
}

.loader-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-bottom-color: var(--primary-magenta);
    animation: spin 1s linear infinite;
}

.loader-core {
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--gradient-primary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.loader-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loader-text .text-gradient {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 4px;
}

.loader-status {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    animation: blink 1.5s ease-in-out infinite;
}

/* ============================================
   Authentication Pages
   ============================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.auth-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

.floating-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 48px;
    border-radius: var(--border-radius-xl);
    animation: fadeInUp 0.6s ease;
}

.verification-card {
    text-align: center;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    margin-bottom: 24px;
    transition: color var(--transition-fast);
}

.back-button:hover {
    color: var(--primary-cyan);
}

.back-button svg {
    width: 18px;
    height: 18px;
}

/* Auth Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 36px;
}

.auth-logo.small {
    margin-bottom: 28px;
}

.auth-logo.small h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-logo.small p {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.logo-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.logo-svg {
    width: 100%;
    height: 100%;
    animation: logoRotate 20s linear infinite;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 6px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.logo-tagline {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    letter-spacing: 2px;
}

/* Auth Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.input-wrapper .form-input {
    padding-left: 48px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(0, 245, 255, 0.1);
}

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

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: color var(--transition-fast);
}

.password-toggle:hover {
    color: var(--primary-cyan);
}

.eye-icon {
    width: 20px;
    height: 20px;
}

/* Password Strength */
.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.strength-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--accent-red);
    transition: all var(--transition-normal);
}

.password-strength.weak .strength-bar::after {
    width: 33%;
    background: var(--accent-red);
}

.password-strength.medium .strength-bar::after {
    width: 66%;
    background: var(--accent-orange);
}

.password-strength.strong .strength-bar::after {
    width: 100%;
    background: var(--accent-green);
}

.strength-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Checkbox Styling */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-subtle);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-wrapper input:checked + .checkmark {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
}

.checkbox-wrapper input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper.terms {
    font-size: 0.8rem;
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.auth-divider span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Verification Code Input */
.verify-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.verify-icon svg {
    width: 40px;
    height: 40px;
    color: var(--bg-primary);
}

.code-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 32px 0;
}

.code-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: var(--font-mono);
    background: var(--surface-dark);
    border: 2px solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(0, 245, 255, 0.1);
}

.code-separator {
    color: var(--text-muted);
    font-size: 1.5rem;
}

.verify-timer {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-bottom: 24px;
}

.countdown {
    font-family: var(--font-mono);
    color: var(--primary-cyan);
    font-weight: 600;
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--border-radius-md);
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-cyan);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

.btn-arrow {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

.btn-primary:hover .btn-arrow {
    transform: translateX(4px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-md);
    color: var(--primary-cyan);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(0, 245, 255, 0.1);
    border-color: var(--primary-cyan);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-outline:hover {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    background: rgba(0, 245, 255, 0.05);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 8px;
    transition: color var(--transition-fast);
}

.btn-text:hover {
    color: var(--primary-cyan);
}

/* ============================================
   Glass Card Component
   ============================================ */

.glass-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

/* ============================================
   Dashboard Layout
   ============================================ */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: width var(--transition-normal);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

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

.logo-small {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-svg-small {
    width: 36px;
    height: 36px;
}

.logo-text-small {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar.collapsed .logo-text-small {
    display: none;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    background: var(--surface-light);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--surface-hover);
    color: var(--primary-cyan);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
    display: block;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 245, 255, 0.1);
    color: var(--primary-cyan);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary-cyan);
    border-radius: 0 3px 3px 0;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item span:not(.nav-badge),
.sidebar.collapsed .nav-badge {
    display: none;
}

/* Exchange Icons in Nav */
.exchange-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.exchange-icon.bitvavo {
    background: linear-gradient(135deg, #0052ff, #0066ff);
    color: white;
}

.exchange-icon.kraken {
    background: linear-gradient(135deg, #5741d9, #7b2dff);
    color: white;
}

/* Nav Badges */
.nav-badge {
    margin-left: auto;
    padding: 3px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--surface-light);
    color: var(--text-tertiary);
}

.nav-badge.hot {
    background: var(--gradient-danger);
    color: white;
}

/* Live Indicator */
.live-indicator {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    margin-left: auto;
    animation: pulse 2s ease-in-out infinite;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-subtle);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-profile:hover {
    background: var(--surface-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--bg-primary);
    flex-shrink: 0;
}

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

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

.user-plan {
    display: block;
    font-size: 0.75rem;
    color: var(--primary-cyan);
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.sidebar.collapsed .user-info,
.sidebar.collapsed .dropdown-arrow {
    display: none;
}

/* User Profile Wrapper & Menu */
.user-profile-wrapper {
    position: relative;
}

.user-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    padding: 8px 0;
    margin-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.user-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.user-menu-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.user-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-menu-item.logout {
    color: var(--accent-red);
}

.user-menu-item.logout:hover {
    background: rgba(255, 59, 48, 0.1);
    color: var(--accent-red);
}

.user-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 0;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--surface-light);
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Market Ticker */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.market-ticker {
    display: flex;
    gap: 32px;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ticker-symbol {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-tertiary);
}

.ticker-price {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ticker-change {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.ticker-change.positive {
    color: var(--accent-green);
    background: rgba(0, 255, 136, 0.1);
}

.ticker-change.negative {
    color: var(--accent-red);
    background: rgba(255, 51, 102, 0.1);
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 40px;
    height: 40px;
    background: var(--surface-light);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-fast);
}

.header-btn:hover {
    background: var(--surface-hover);
    color: var(--primary-cyan);
    border-color: var(--primary-cyan);
}

.header-btn svg {
    width: 20px;
    height: 20px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--accent-red);
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.ai-btn {
    width: auto;
    padding: 0 16px;
    gap: 8px;
    background: var(--gradient-primary);
    border: none;
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.8rem;
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-cyan);
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface-light);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.disconnected {
    background: var(--accent-red);
}

/* ============================================
   Page Content
   ============================================ */

.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
    min-height: calc(100vh - 150px);
}

.page.active {
    display: block;
}

/* Page header styling */
.page > .page-header {
    margin-bottom: 24px;
}

.page > .page-header h1,
.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.page > .page-header p,
.page-header p {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin: 0;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.1) 0%, rgba(123, 45, 255, 0.1) 100%);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    animation: welcomeFadeIn 0.5s ease-out;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 0% 50%, rgba(0, 245, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.welcome-banner.hidden {
    display: none;
}

.welcome-content {
    position: relative;
    z-index: 1;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.welcome-title span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.welcome-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.welcome-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

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

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

@media (max-width: 768px) {
    .welcome-banner {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .welcome-close {
        position: absolute;
        top: 12px;
        right: 12px;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 20px;
    display: flex;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.green {
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent-green);
}

.stat-icon.blue {
    background: rgba(0, 102, 255, 0.15);
    color: var(--primary-blue);
}

.stat-icon.purple {
    background: rgba(123, 45, 255, 0.15);
    color: var(--primary-purple);
}

.stat-icon.orange {
    background: rgba(255, 149, 0, 0.15);
    color: var(--accent-orange);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.stat-change {
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--accent-green);
}

.stat-change.negative {
    color: var(--accent-red);
}

.stat-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Exchange Cards Grid */
.exchanges-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.exchange-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.exchange-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.exchange-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.exchange-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.exchange-logo.bitvavo {
    background: linear-gradient(135deg, #0052ff, #0066ff);
}

.exchange-logo.kraken {
    background: linear-gradient(135deg, #5741d9, #7b2dff);
}

.exchange-info h3 {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.exchange-type {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.exchange-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.connected {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-indicator.connected.pulse {
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 8px var(--accent-green);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 16px var(--accent-green), 0 0 24px rgba(0, 255, 136, 0.4);
        transform: scale(1.1);
    }
}

.status-indicator.disconnected {
    background: var(--text-muted);
}

/* Live Status Badge */
.status-live {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-green);
    background: rgba(0, 255, 136, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    animation: liveGlow 2s infinite;
}

@keyframes liveGlow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(0, 255, 136, 0.3);
    }
    50% {
        box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
    }
}

/* API Connected Badge */
.api-connected-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-green);
}

.api-connected-badge svg {
    width: 14px;
    height: 14px;
}

.api-connected-badge .check-icon {
    color: var(--accent-green);
}

/* Exchange card connected state enhancements */
.exchange-card.api-connected {
    border-color: rgba(0, 255, 136, 0.25);
}

.exchange-card.api-connected .exchange-actions {
    justify-content: center;
}

.exchange-card.api-connected .btn-connect {
    display: none !important;
}

/* API Status indicator in exchange header */
.api-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: var(--border-radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-status-indicator .status-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.api-status-indicator.disconnected {
    background: rgba(255, 51, 102, 0.1);
    color: var(--accent-red);
}

.api-status-indicator.disconnected .status-dot {
    background: var(--accent-red);
    animation: none;
}

/* Exchange Card Live State */
.exchange-card.connected {
    border-color: rgba(0, 255, 136, 0.3);
}

.exchange-card.connected.live {
    border-color: var(--accent-green);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.15);
}

.exchange-card.connected.live::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-green), var(--primary-cyan));
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

/* P/L Colors */
.exchange-stat .value.positive {
    color: var(--accent-green);
}

.exchange-stat .value.negative {
    color: var(--accent-red);
}

.exchange-balance {
    margin-bottom: 20px;
}

.balance-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 4px;
}

.balance-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.exchange-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
}

.exchange-stat {
    text-align: center;
}

.exchange-stat .label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exchange-stat .value {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.mode-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem !important;
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent-green) !important;
}

.exchange-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.exchange-actions button {
    flex: 1;
    min-width: 130px;
    max-width: 160px;
    padding: 12px 20px;
    font-size: 0.875rem;
}

.exchange-actions .btn-outline {
    border-radius: var(--border-radius-md);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* Chart Card */
.chart-card {
    padding: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chart-period-selector {
    display: flex;
    gap: 4px;
    background: var(--surface-dark);
    padding: 4px;
    border-radius: var(--border-radius-sm);
}

.period-btn {
    padding: 6px 12px;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.period-btn:hover {
    color: var(--text-primary);
}

.period-btn.active {
    background: var(--primary-cyan);
    color: var(--bg-primary);
}

.chart-container {
    height: 300px;
    position: relative;
}

.view-all {
    font-size: 0.8rem;
    color: var(--primary-cyan);
}

/* Activity Card */
.activity-card {
    padding: 24px;
}

.trades-list {
    max-height: 300px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state span {
    font-size: 0.8rem;
}

/* AI Section */
.ai-section {
    padding: 24px;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-icon-wrapper {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-icon-wrapper svg {
    width: 24px;
    height: 24px;
    color: var(--bg-primary);
}

.ai-header-left h3 {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.ai-status {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.ai-accuracy {
    text-align: right;
}

.accuracy-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 4px;
}

.accuracy-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-green);
}

.ai-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.ai-metric {
    text-align: center;
}

.metric-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    position: relative;
}

.metric-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 3;
}

.circle-fill {
    fill: none;
    stroke: var(--primary-cyan);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray var(--transition-slow);
}

.circle-fill.green {
    stroke: var(--accent-green);
}

.circle-fill.purple {
    stroke: var(--primary-purple);
}

.circle-fill.orange {
    stroke: var(--accent-orange);
}

.metric-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .market-ticker {
        display: none;
    }

    .exchanges-grid {
        grid-template-columns: 1fr;
    }

    /* Sidebar overlay for mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
    }

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

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .auth-card {
        padding: 28px 20px;
        max-width: 100%;
        margin: 0 12px;
    }

    .logo-text {
        font-size: 1.5rem;
        letter-spacing: 4px;
    }

    .logo-icon {
        width: 60px;
        height: 60px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .page-content {
        padding: 12px;
    }

    .top-header {
        padding: 0 12px;
        height: 56px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .header-btn {
        width: 36px;
        height: 36px;
    }

    .header-btn svg {
        width: 18px;
        height: 18px;
    }

    .ai-btn {
        padding: 0 12px;
        font-size: 0.75rem;
    }

    .connection-status {
        padding: 6px 10px;
    }

    .connection-status span {
        display: none;
    }

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

    /* Exchange cards mobile improvements */
    .exchange-card {
        padding: 16px;
    }

    .exchange-header {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 16px;
    }

    .exchange-status {
        align-self: flex-start;
    }

    .exchange-logo {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .balance-value {
        font-size: 1.5rem;
    }

    .exchange-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 12px 0;
    }

    .exchange-stat .label {
        font-size: 0.65rem;
    }

    .exchange-stat .value {
        font-size: 0.85rem;
    }

    .exchange-actions {
        flex-direction: column;
        gap: 8px;
    }

    .exchange-actions button {
        max-width: 100%;
        width: 100%;
    }

    /* Dashboard grid */
    .dashboard-grid {
        gap: 12px;
    }

    .chart-card,
    .activity-card {
        padding: 16px;
    }

    .chart-container {
        height: 220px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .chart-period-selector {
        width: 100%;
        justify-content: space-between;
    }

    .period-btn {
        flex: 1;
        text-align: center;
    }

    /* AI Section mobile */
    .ai-section {
        padding: 16px;
    }

    .ai-section .card-header {
        flex-direction: column;
        gap: 16px;
    }

    .ai-accuracy {
        text-align: left;
    }

    .metric-circle {
        width: 60px;
        height: 60px;
    }

    .metric-value {
        font-size: 1rem;
    }

    .metric-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .auth-card {
        padding: 24px 16px;
        border-radius: var(--border-radius-lg);
    }

    .logo-text {
        font-size: 1.3rem;
        letter-spacing: 3px;
    }

    .logo-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 12px;
    }

    .logo-tagline {
        font-size: 0.75rem;
    }

    .auth-form {
        gap: 16px;
    }

    .form-input {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .input-wrapper .form-input {
        padding-left: 42px;
    }

    .input-icon {
        width: 16px;
        height: 16px;
        left: 12px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px 20px;
        font-size: 0.85rem;
    }

    .code-input {
        width: 36px;
        height: 44px;
        font-size: 1.1rem;
    }

    .code-input-container {
        gap: 6px;
    }

    .stat-card {
        padding: 14px;
        gap: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-icon svg {
        width: 20px;
        height: 20px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .balance-value {
        font-size: 1.3rem;
    }

    .exchange-stats {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: left;
    }

    .exchange-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .exchange-stat:last-child {
        border-bottom: none;
    }

    .page-title {
        font-size: 1rem;
    }

    .header-left {
        gap: 10px;
    }

    .mobile-menu-btn {
        width: 36px;
        height: 36px;
    }

    .mobile-menu-btn svg {
        width: 18px;
        height: 18px;
    }

    /* AI metrics for very small screens */
    .ai-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .metric-circle {
        width: 50px;
        height: 50px;
    }

    .metric-value {
        font-size: 0.9rem;
    }

    .ai-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .ai-icon-wrapper svg {
        width: 20px;
        height: 20px;
    }

    .ai-header-left h3 {
        font-size: 1rem;
    }

    .accuracy-value {
        font-size: 1.2rem;
    }

    /* Notification panel mobile */
    #notification-panel {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        max-height: 70vh;
        border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    }

    /* AI Widget mobile */
    #ai-widget {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
        max-height: 70vh;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .nav-item {
        padding: 14px 16px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline {
        min-height: 48px;
    }

    .form-input {
        min-height: 48px;
    }

    .period-btn {
        padding: 10px 14px;
    }

    .header-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .exchange-actions button {
        min-height: 48px;
    }
}

/* Safe area for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    .top-header {
        padding-top: env(safe-area-inset-top);
    }

    .sidebar {
        padding-top: env(safe-area-inset-top);
    }

    .page-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   Footer
   ============================================ */

.app-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    padding: 12px 24px;
    z-index: 90;
    transition: left 0.3s ease;
}

.sidebar.collapsed ~ .main-content .app-footer {
    left: var(--sidebar-collapsed);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-text a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.footer-text a:hover {
    color: var(--accent-purple);
    text-shadow: 0 0 10px rgba(123, 45, 255, 0.5);
}

.footer-version {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
}

/* Adjust page content padding for footer */
.page-content {
    padding-bottom: 70px;
}

@media (max-width: 992px) {
    .app-footer {
        left: 0;
    }
}

@media (max-width: 480px) {
    .app-footer {
        padding: 10px 16px;
    }

    .footer-text {
        font-size: 0.7rem;
    }

    .footer-version {
        font-size: 0.65rem;
    }
}
