/* ============================================
   PREMIUM STOCK ANALYZER - DESIGN SYSTEM
   ============================================ */

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

:root {
    /* Premium Color Palette */
    --primary: #0F62FE;
    --primary-hover: #0050E6;
    --primary-light: #4589FF;
    --primary-dark: #002D9C;
    
    --accent: #10B981;
    --accent-light: #34D399;
    --accent-dark: #059669;
    
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Neutral Palette */
    --bg-primary: #FAFBFC;
    --bg-secondary: #F8FAFC;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;
    
    /* Text Colors */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;
    
    /* Borders & Dividers */
    --border-light: #E2E8F0;
    --border-medium: #CBD5E1;
    --border-strong: #94A3B8;
    
    /* Shadows - Premium Depth System */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -1px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Typography Scale */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    --text-5xl: 3rem;      /* 48px */
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Base Typography */
html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--text-base);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

/* Container System */
.container {
    max-width: 1440px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative;
    }
    
    * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .container {
        padding: 0 var(--space-lg);
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Prevent any element from causing horizontal scroll */
    img, video, iframe, embed, object {
        max-width: 100%;
        height: auto;
    }
}

/* ============================================
   NAVIGATION - Premium Header
   ============================================ */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.85);
    transition: var(--transition-base);
}

.navbar:hover {
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: var(--transition-base);
    position: relative;
    padding: var(--space-sm) 0;
    letter-spacing: -0.01em;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width var(--transition-base);
    border-radius: var(--radius-full);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-badge {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-inverse);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm);
}

/* ============================================
   BUTTONS - Premium System
   ============================================ */
.btn {
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    position: relative;
    overflow: hidden;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

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

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(15, 98, 254, 0.05);
    transform: translateY(-1px);
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-xs);
}

.btn-block {
    width: 100%;
}

.btn-google {
    background: #FFFFFF;
    color: #3c4043;
    border: 1px solid #dadce0;
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    font-weight: 500;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    transform: translateY(-1px);
}

.btn-google:active {
    background: #f1f3f4;
    transform: translateY(0);
}

.btn-google:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
    padding: var(--space-3xl) 0;
    min-height: calc(100vh - 200px);
}

/* Hero/Header Section */
.header-section {
    text-align: center;
    margin-bottom: var(--space-3xl);
    padding: var(--space-3xl) 0;
}

.header-section h2 {
    font-size: var(--text-5xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.subtitle {
    color: var(--text-secondary);
    font-size: var(--text-xl);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ============================================
   STATS CARDS - Premium Metrics
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-3xl);
}

.stat-card {
    background: var(--surface);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    text-align: center;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(15, 98, 254, 0.05), transparent);
    transition: left 0.5s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.stat-card:hover::before {
    left: 100%;
}

.stat-value {
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   FILTERS SECTION - Premium UI
   ============================================ */
.filters-section {
    background: var(--surface);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-3xl);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.filters-header h3 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.filter-group label {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.filter-group input,
.filter-group select {
    padding: var(--space-md);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    transition: var(--transition-base);
    background: var(--surface);
    color: var(--text-primary);
    font-family: inherit;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
    transform: translateY(-1px);
}

.filter-group input::placeholder {
    color: var(--text-tertiary);
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.range-inputs input {
    flex: 1;
}

.range-inputs span {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
}

/* ============================================
   PREMIUM BANNER
   ============================================ */
.premium-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-inverse);
    padding: var(--space-3xl);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-3xl);
    text-align: center;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.premium-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

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

.premium-content h3 {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.premium-content p {
    font-size: var(--text-lg);
    margin-bottom: var(--space-xl);
    opacity: 0.95;
    line-height: 1.6;
}

/* ============================================
   SECTION COMPONENTS
   ============================================ */
.section {
    background: var(--surface);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-3xl);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.section-header h3 {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.table-controls span {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
}

.table-controls select {
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-base);
}

.table-controls select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

/* ============================================
   TABLE - Premium Data Display
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.stocks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: var(--surface);
}

.stocks-table thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.stocks-table th {
    padding: var(--space-lg) var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-light);
    white-space: nowrap;
}

.stocks-table td {
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.stocks-table tbody tr {
    transition: var(--transition-fast);
}

.stocks-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.stocks-table tbody tr:hover {
    background: rgba(15, 98, 254, 0.04);
    transform: scale(1.001);
}

.stocks-table tbody tr:last-child td {
    border-bottom: none;
}

.premium-col {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.3) 0%, rgba(253, 230, 138, 0.3) 100%);
    color: var(--text-primary);
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-tertiary);
    font-size: var(--text-lg);
}

/* ============================================
   STOCKS GRID
   ============================================ */
.stocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-xl);
}

.stock-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stock-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.stock-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stock-card:hover::after {
    transform: scaleX(1);
}

.stock-card h4 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-lg);
    color: var(--primary);
    letter-spacing: -0.01em;
}

.stock-card h4 a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-base);
}

.stock-card h4 a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Table stock name links */
.stocks-table td a {
    color: #3b82f6; /* blue-500 */
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-base);
}

.stocks-table td a:hover {
    color: #2563eb; /* blue-600 */
    text-decoration: underline;
}

/* Dark theme stock card links */
.dark-theme .stock-card h4 a {
    color: #3b82f6; /* blue-500 */
}

.dark-theme .stock-card h4 a:hover {
    color: #60a5fa; /* blue-400 */
    text-decoration: underline;
}

/* Dark theme table links */
.dark-theme .stocks-table td a {
    color: #3b82f6; /* blue-500 */
}

.dark-theme .stocks-table td a:hover {
    color: #60a5fa; /* blue-400 */
    text-decoration: underline;
}

.stock-metric {
    display: flex;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.stock-metric:last-child {
    border-bottom: none;
}

.stock-metric-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
}

.stock-metric-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.category-tab {
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--border-medium);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
}

.category-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(15, 98, 254, 0.05);
}

.category-tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-inverse);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.stock-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.stock-rank {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-inverse);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: 700;
    min-width: 32px;
    text-align: center;
}

.stock-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Dark theme category tabs */
.dark-theme .category-tabs {
    border-bottom-color: #1e293b; /* slate-800 */
}

.dark-theme .category-tab {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    border-color: #334155; /* slate-700 */
    color: #cbd5e1; /* slate-300 */
}

.dark-theme .category-tab:hover {
    border-color: #3b82f6; /* blue-500 */
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.dark-theme .category-tab.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border-color: #3b82f6;
}

.dark-theme .stock-card {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    border-color: #1e293b; /* slate-800 */
}

.dark-theme .stock-card-header {
    border-bottom-color: #1e293b; /* slate-800 */
}

.dark-theme .stock-card h4 {
    color: #3b82f6; /* blue-500 */
}

.dark-theme .stock-metric {
    border-bottom-color: #1e293b; /* slate-800 */
}

.dark-theme .stock-metric-label {
    color: #94a3b8; /* slate-400 */
}

.dark-theme .stock-metric-value {
    color: #f1f5f9; /* slate-50 */
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-light);
}

.pagination button {
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--border-medium);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition-base);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface);
    margin: 5% auto;
    padding: var(--space-3xl);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-2xl);
    animation: slideUp 0.3s ease-out;
}

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

.modal-large {
    max-width: 900px;
}

.close {
    position: absolute;
    right: var(--space-xl);
    top: var(--space-xl);
    font-size: var(--text-2xl);
    font-weight: 300;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-base);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.modal-content h2 {
    margin-bottom: var(--space-2xl);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-xl);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
    letter-spacing: -0.01em;
}

.form-group input {
    width: 100%;
    padding: var(--space-md);
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius);
    font-size: var(--text-base);
    font-family: inherit;
    transition: var(--transition-base);
    background: var(--surface);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

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

#authError {
    padding: var(--space-md);
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-radius: var(--radius);
    margin-top: var(--space-lg);
    font-size: var(--text-sm);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--surface);
    padding: var(--space-3xl) 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-3xl);
}

.footer p {
    font-size: var(--text-sm);
}

/* ============================================
   LOADING & ANIMATIONS
   ============================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-spinner {
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-lg);
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   DARK THEME - INDEX PAGE
   ============================================ */
.dark-theme {
    background-color: #0f172a; /* slate-950 */
    color: #f1f5f9; /* slate-100 */
    min-height: 100vh;
}

/* Dark Theme Navbar */
.navbar-dark {
    background: rgba(15, 23, 42, 0.9); /* slate-950/90 */
    border-bottom: 1px solid #1e293b; /* slate-800 */
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(20px) saturate(180%);
    transition: var(--transition-base);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.navbar-dark .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.nav-brand-dark {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
    transition: opacity var(--transition-base);
}

.nav-brand-dark:hover {
    opacity: 0.8;
}

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: transform var(--transition-base);
}

.nav-brand-dark:hover .brand-logo {
    transform: scale(1.05);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: var(--text-lg);
    box-shadow: var(--shadow-sm);
}

.brand-text {
    font-size: var(--text-xl);
    font-weight: 700;
    color: #f1f5f9; /* slate-50 */
    letter-spacing: -0.02em;
}

.nav-search-dark {
    flex: 1;
    min-width: 200px;
    max-width: 500px;
}

.nav-search-dark > div {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    color: #94a3b8; /* slate-400 */
    font-size: var(--text-lg);
    pointer-events: none;
}

.search-input-dark {
    width: 100%;
    padding: var(--space-md) var(--space-md) var(--space-md) 2.5rem;
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    border: 1px solid #334155; /* slate-700 */
    border-radius: var(--radius-md);
    color: #f1f5f9; /* slate-50 */
    font-size: var(--text-sm);
    transition: var(--transition-base);
}

.search-input-dark:focus {
    outline: none;
    border-color: #3b82f6; /* blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

.search-input-dark::placeholder {
    color: #64748b; /* slate-500 */
}

.nav-links-dark {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-shrink: 0;
}

.nav-link-dark {
    text-decoration: none;
    color: #cbd5e1; /* slate-300 */
    font-weight: 500;
    font-size: var(--text-sm);
    transition: var(--transition-base);
    position: relative;
    padding: var(--space-sm) 0;
    letter-spacing: -0.01em;
}

.nav-link-dark::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width var(--transition-base);
    border-radius: var(--radius-full);
}

.nav-link-dark:hover,
.nav-link-dark.active {
    color: #f1f5f9; /* slate-50 */
}

.nav-link-dark:hover::after,
.nav-link-dark.active::after {
    width: 100%;
}

.btn-dark-outline {
    background: transparent;
    border: 1.5px solid #334155; /* slate-700 */
    color: #cbd5e1; /* slate-300 */
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-dark-outline:hover {
    border-color: #3b82f6; /* blue-500 */
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.user-badge-dark {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm);
}

/* Responsive navbar */
@media (max-width: 768px) {
    .navbar-dark .container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-search-dark {
        max-width: 100%;
        order: 3;
    }
    
    .nav-links-dark {
        order: 2;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .nav-brand-dark {
        order: 1;
    }
}

.main-content-dark {
    padding: var(--space-3xl) 0;
    min-height: calc(100vh - 200px);
}

.header-section-dark {
    text-align: center;
    margin-bottom: var(--space-3xl);
    padding: var(--space-3xl) 0;
}

.header-section-dark h2 {
    font-size: var(--text-5xl);
    font-weight: 700;
    color: #f1f5f9; /* slate-50 */
    margin-bottom: var(--space-md);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.subtitle-dark {
    color: #94a3b8; /* slate-400 */
    font-size: var(--text-xl);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Dark theme stats cards */
.dark-theme .stat-card {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    border: 1px solid #1e293b; /* slate-800 */
    color: #f1f5f9;
}

.dark-theme .stat-value {
    color: #3b82f6; /* blue-500 */
}

.dark-theme .stat-label {
    color: #94a3b8; /* slate-400 */
}

/* Dark theme filters */
.dark-theme .filters-section {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    border: 1px solid #1e293b; /* slate-800 */
}

.dark-theme .filters-header h3 {
    color: #f1f5f9;
}

.dark-theme .filter-group label {
    color: #cbd5e1; /* slate-300 */
}

.dark-theme .filter-group input,
.dark-theme .filter-group select {
    background: #0f172a; /* slate-900 */
    border-color: #334155; /* slate-700 */
    color: #f1f5f9;
}

.dark-theme .filter-group input:focus,
.dark-theme .filter-group select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Dark theme sections */
.dark-theme .section {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    border: 1px solid #1e293b; /* slate-800 */
}

.dark-theme .section-header h3 {
    color: #f1f5f9;
}

/* Dark theme table */
.dark-theme .stocks-table {
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    border: 1px solid #1e293b; /* slate-800 */
}

.dark-theme .stocks-table thead {
    background: rgba(15, 23, 42, 0.8); /* slate-900/80 */
}

.dark-theme .stocks-table th {
    color: #cbd5e1; /* slate-300 */
    border-bottom-color: #1e293b; /* slate-800 */
}

.dark-theme .stocks-table td {
    color: #e2e8f0; /* slate-200 */
    border-bottom-color: #1e293b; /* slate-800 */
}

.dark-theme .stocks-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.4); /* slate-900/40 */
}

.dark-theme .stocks-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.1); /* blue-500/10 */
}

.dark-theme .loading {
    color: #94a3b8; /* slate-400 */
}

/* Dark theme premium banner */
.dark-theme .premium-banner {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: 1px solid #1e293b;
}

.dark-theme .premium-content h3,
.dark-theme .premium-content p {
    color: #f1f5f9;
}

/* Dark theme modal */
.dark-theme .modal {
    background: rgba(15, 23, 42, 0.8);
}

.dark-theme .modal-content {
    background: #0f172a; /* slate-900 */
    border: 1px solid #1e293b;
    color: #f1f5f9;
}

.dark-theme .modal-content h2 {
    color: #f1f5f9;
}

.dark-theme .close {
    color: #94a3b8;
}

.dark-theme .close:hover {
    color: #f1f5f9;
    background: rgba(15, 23, 42, 0.6);
}

/* Dark theme forms */
.dark-theme .form-group label {
    color: #cbd5e1;
}

.dark-theme .form-group input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.dark-theme .form-group input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark-theme .form-group input::placeholder {
    color: #64748b; /* slate-500 */
}

/* Dark theme pagination */
.dark-theme .pagination button {
    background: rgba(15, 23, 42, 0.7);
    border-color: #334155;
    color: #cbd5e1;
}

.dark-theme .pagination button:hover:not(:disabled) {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #f1f5f9;
}

.dark-theme .pagination .active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #f1f5f9;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .header-section h2,
    .header-section-dark h2 {
        font-size: var(--text-4xl);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        gap: var(--space-md);
    }
    
    .nav-brand h1 {
        font-size: var(--text-xl);
    }
    
    .header-section {
        padding: var(--space-2xl) 0;
    }
    
    .header-section h2 {
        font-size: var(--text-3xl);
    }
    
    .subtitle {
        font-size: var(--text-lg);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .filters-section {
        padding: var(--space-xl);
    }
    
    .section {
        padding: var(--space-xl);
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .table-container {
        overflow-x: scroll;
    }
    
    .stocks-table {
        font-size: var(--text-xs);
    }
    
    .stocks-table th,
    .stocks-table td {
        padding: var(--space-md) var(--space-sm);
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: var(--space-xl);
    }
    
    .premium-banner {
        padding: var(--space-2xl);
    }
    
    .premium-content h3 {
        font-size: var(--text-2xl);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    .main-content {
        padding: var(--space-xl) 0;
    }
    
    .header-section h2 {
        font-size: var(--text-2xl);
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
}
