/* Premium Design System - Inspired by Robinhood, Figma, Canva */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Color System */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;
    
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-200: #a7f3d0;
    --emerald-300: #6ee7b7;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;
    
    --purple-50: #faf5ff;
    --purple-100: #f3e8ff;
    --purple-200: #e9d5ff;
    --purple-300: #d8b4fe;
    --purple-400: #c084fc;
    --purple-500: #a855f7;
    --purple-600: #9333ea;
    --purple-700: #7c3aed;
    --purple-800: #6b21a8;
    --purple-900: #581c87;
    
    --rose-50: #fff1f2;
    --rose-100: #ffe4e6;
    --rose-200: #fecdd3;
    --rose-300: #fda4af;
    --rose-400: #fb7185;
    --rose-500: #f43f5e;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    --rose-800: #9f1239;
    --rose-900: #881337;
    
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Consolas', 'Fira Code', monospace;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-backdrop: blur(16px);
}

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

/* Base */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    font-weight: 400;
    line-height: 1.6;
    color: var(--slate-800);
    background: linear-gradient(135deg, var(--slate-50) 0%, var(--primary-50) 100%);
    min-height: 100vh;
    font-feature-settings: 'rlig' 1, 'calt' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
header {
    background: linear-gradient(135deg, 
        var(--primary-600) 0%, 
        var(--purple-600) 50%, 
        var(--emerald-600) 100%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease-in-out infinite;
    color: white;
    text-align: center;
    padding: var(--space-16) var(--space-4);
    position: relative;
    overflow: hidden;
}

.header-top {
    position: absolute;
    top: var(--space-4);
    right: var(--space-6);
    z-index: 10;
}

.discord-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.discord-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

header h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    letter-spacing: -0.02em;
}

header h1::after {
    content: '🎓';
    position: absolute;
    top: -10px;
    right: -50px;
    font-size: 0.7em;
    animation: float 3s ease-in-out infinite;
}

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

header p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 400;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    line-height: 1.7;
}

/* Main Container */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-4);
    position: relative;
    z-index: 1;
}

/* Amount Controls */
.amount-controls {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    margin: calc(-1 * var(--space-8)) auto var(--space-8);
    box-shadow: var(--shadow-xl);
    max-width: 800px;
    position: relative;
}

.amount-control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.amount-control-group label {
    font-weight: 600;
    color: var(--slate-700);
    font-size: 1.1rem;
    margin-bottom: var(--space-2);
}

#amount-input {
    width: 100%;
    padding: var(--space-4) var(--space-6);
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    background: white;
    transition: all 0.2s ease;
    font-family: var(--font-mono);
}

#amount-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

#amount-slider {
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, 
        var(--emerald-200) 0%, 
        var(--primary-300) 50%, 
        var(--purple-300) 100%);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
}

#amount-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary-500), var(--purple-600));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
}

#amount-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.amount-presets {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    justify-content: center;
}

.amount-presets button {
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--slate-300);
    background: white;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--slate-600);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.amount-presets button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.amount-presets button:hover::before {
    left: 100%;
}

.amount-presets button:hover {
    border-color: var(--primary-400);
    color: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Overview Chart */
.overview-chart {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.overview-chart::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--emerald-500) 0%, 
        var(--primary-500) 50%, 
        var(--purple-500) 100%);
}

.overview-chart h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.overview-chart p {
    color: var(--slate-600);
    font-size: 1.1rem;
    margin-bottom: var(--space-6);
    line-height: 1.7;
}

.chart-container {
    height: 500px;
    position: relative;
    margin-bottom: var(--space-6);
    background: linear-gradient(135deg, 
        var(--slate-50) 0%, 
        rgba(255, 255, 255, 0.8) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--slate-200);
    backdrop-filter: blur(10px);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    flex-wrap: wrap;
    padding: var(--space-4);
    background: var(--slate-50);
    border-radius: var(--radius-lg);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--slate-700);
}

.legend-line {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary-500), var(--purple-500));
    position: relative;
}

.thick-line {
    height: 6px;
    background: linear-gradient(90deg, var(--primary-500), var(--purple-500));
}

.dashed-line {
    height: 4px;
    background: transparent;
    border-top: 3px dashed var(--primary-500);
    border-radius: 0;
}

.dotted-line {
    height: 4px;
    background: transparent;
    position: relative;
    border-radius: 0;
}

.dotted-line::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 0;
    right: 0;
    height: 2px;
    background-image: radial-gradient(circle, var(--primary-500) 1px, transparent 1px);
    background-size: 8px 4px;
    background-repeat: repeat-x;
}

/* Chart container */
.chart-container {
    position: relative;
}

/* Results Section */
.results {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.results::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--rose-400) 0%, 
        var(--emerald-400) 100%);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.results-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--slate-800);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

#amount-display {
    color: var(--emerald-600);
    font-family: var(--font-mono);
}

/* Settings Toggle */
#settings-toggle {
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(135deg, var(--slate-100), white);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-lg);
    font-weight: 600;
    color: var(--slate-600);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

#settings-toggle:hover {
    background: linear-gradient(135deg, var(--primary-50), var(--purple-50));
    border-color: var(--primary-300);
    color: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Settings Panel */
.settings-panel {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-inner);
}

.settings-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: var(--space-4);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.filter-group label {
    display: block;
    font-weight: 500;
    color: var(--slate-600);
    margin-bottom: var(--space-2);
}

.filter-group select {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    background: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Table Styles */
.view-container {
    overflow: hidden;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    background: white;
}

#bonus-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

#bonus-table thead {
    background: linear-gradient(135deg, var(--slate-50) 0%, var(--primary-50) 100%);
}

#bonus-table th {
    padding: var(--space-5) var(--space-6);
    text-align: left;
    font-weight: 600;
    color: var(--slate-700);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--slate-200);
    position: relative;
    transition: all 0.2s ease;
}

#bonus-table th.sortable {
    cursor: pointer;
    user-select: none;
}

#bonus-table th.sortable:hover {
    background: linear-gradient(135deg, var(--primary-100), var(--purple-100));
    color: var(--primary-700);
}

.sort-arrow {
    margin-left: var(--space-2);
    font-weight: 700;
    color: var(--primary-500);
    transition: all 0.2s ease;
}

#bonus-table td {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
    transition: all 0.2s ease;
}

#bonus-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

#bonus-table tbody tr:hover {
    background: linear-gradient(135deg, var(--primary-25) 0%, var(--emerald-25) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.brokerage-name {
    font-weight: 700;
    color: var(--slate-800);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brokerage-favicon {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    object-fit: contain;
    background: white;
    padding: 2px;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.brokerage-favicon:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.offer-title {
    font-weight: 500;
    color: var(--slate-600);
    margin-bottom: var(--space-1);
}

.offer-type {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    background: linear-gradient(135deg, var(--primary-100), var(--emerald-100));
    color: var(--primary-700);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--primary-200);
}

.bonus-amount {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--emerald-600), var(--emerald-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-mono);
}

.effective-percent {
    font-weight: 700;
    color: var(--primary-600);
    font-size: 1.1rem;
    font-family: var(--font-mono);
}

.hold-period {
    color: var(--slate-600);
    font-weight: 500;
    font-family: var(--font-mono);
}

.expiration-date {
    color: var(--slate-600);
    font-weight: 500;
    font-family: var(--font-mono);
}

.expires-soon {
    background: linear-gradient(135deg, var(--rose-50) 0%, var(--rose-100) 100%) !important;
    border-left: 4px solid var(--rose-500) !important;
}

.expires-soon .expiration-date {
    color: var(--rose-700);
    font-weight: 700;
}

/* Summary Stats */
.summary {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    margin-bottom: var(--space-8);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-6);
}

.stat {
    text-align: center;
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--slate-50) 0%, white 100%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-200);
    transition: all 0.3s ease;
}

.stat:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--emerald-50) 100%);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-600), var(--emerald-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-mono);
}

.stat-label {
    color: var(--slate-600);
    font-weight: 500;
    margin-top: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

/* Notes section */
.notes {
    margin: var(--space-8) 0;
}

.notes h3 {
    color: var(--slate-800);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.notes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notes-list li {
    background: var(--slate-50);
    border-left: 3px solid var(--blue-500);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--slate-700);
    line-height: 1.6;
}

.notes-list li:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
    color: var(--slate-300);
    text-align: center;
    padding: var(--space-12) var(--space-4);
    margin-top: var(--space-16);
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--primary-500) 50%, 
        transparent 100%);
}

.affiliate-disclosure {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    backdrop-filter: blur(10px);
}

.affiliate-disclosure p {
    color: var(--slate-400);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

footer p {
    margin-bottom: var(--space-4);
    color: var(--slate-400);
}

footer p:last-child {
    margin-bottom: 0;
    font-weight: 600;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Hide desktop-only content on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Reset body margins */
    body {
        margin: 0;
        padding: 0;
    }
    
    /* Header - reduce padding dramatically */
    header {
        padding: var(--space-4) var(--space-2);
        text-align: center;
        margin-bottom: 0;
    }
    
    .header-top {
        position: static;
        text-align: center;
        margin-bottom: var(--space-3);
    }
    
    .discord-link {
        font-size: 0.8rem;
        padding: var(--space-1) var(--space-3);
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: var(--space-1);
        line-height: 1.2;
    }
    
    header p {
        font-size: 0.9rem;
        line-height: 1.3;
        margin-bottom: 0;
    }
    
    /* Main content - minimal padding */
    main {
        padding: var(--space-2);
    }
    
    /* Section spacing */
    section {
        margin-bottom: var(--space-4);
    }
    
    /* Amount controls */
    .amount-control-group {
        gap: var(--space-4);
    }
    
    .amount-presets {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-2);
        width: 100%;
    }
    
    .amount-presets button {
        padding: var(--space-3) var(--space-2);
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
    }
    
    /* Chart improvements - maximize space */
    .overview-chart {
        margin: var(--space-2) 0;
        padding: 0;
    }
    
    .chart-container {
        height: 400px; /* Bigger chart on mobile */
        margin: var(--space-2) -var(--space-2); /* Full width */
        padding: var(--space-2);
        overflow: hidden;
        border-radius: 0; /* Square corners for full width */
    }
    
    .overview-chart h2 {
        font-size: 1.5rem;
        margin-bottom: var(--space-2);
    }
    
    .overview-chart p {
        font-size: 0.9rem;
        margin-bottom: var(--space-4);
    }
    
    /* Results section */
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
    }
    
    .results-header h2 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    #settings-toggle {
        align-self: center;
        padding: var(--space-3) var(--space-6);
    }
    
    /* Table improvements - full width */
    .view-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: var(--space-2) -var(--space-2); /* Full width edge to edge */
        border-radius: 0;
        background: white;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    #bonus-table {
        min-width: 555px; /* Narrower with reordered columns (90+110+90+85+180) */
        font-size: 0.9rem; /* Larger text */
        margin: 0;
        width: 100%;
        table-layout: fixed; /* Fix column widths */
    }
    
    /* Mobile column reordering using CSS Grid */
    #bonus-table thead tr,
    #bonus-table tbody tr {
        display: grid;
        grid-template-columns: 90px 110px 90px 85px 180px; /* brokerage, bonus, apy, hold, offer */
        grid-template-areas: "brokerage bonus apy hold offer";
        align-items: center;
    }
    
    /* Assign grid areas to reorder columns */
    #bonus-table th:nth-child(1), #bonus-table td:nth-child(1) { grid-area: brokerage; } /* Brokerage */
    #bonus-table th:nth-child(2), #bonus-table td:nth-child(2) { grid-area: offer; }     /* Offer -> last */
    #bonus-table th:nth-child(3), #bonus-table td:nth-child(3) { grid-area: bonus; }    /* Your Bonus -> 2nd */
    #bonus-table th:nth-child(4), #bonus-table td:nth-child(4) { grid-area: apy; }      /* Effective APY -> 3rd */
    #bonus-table th:nth-child(5), #bonus-table td:nth-child(5) { grid-area: hold; }     /* Hold Period -> 4th */
    
    /* Mobile-optimized column widths - prioritize important data */
    /* Brokerage column - very compact with favicon */
    #bonus-table th:nth-child(1), 
    #bonus-table td:nth-child(1) { 
        width: 90px; 
        min-width: 90px; 
        padding: var(--space-2) var(--space-1) !important;
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    /* Make brokerage cell favicon smaller and text more compact */
    #bonus-table .brokerage-cell {
        flex-direction: column;
        gap: 2px;
        align-items: center;
        text-align: center;
        justify-content: center;
        height: 100%;
        padding: var(--space-1) 0;
    }
    
    #bonus-table .brokerage-favicon {
        width: 14px;
        height: 14px;
        margin-bottom: 2px;
    }
    
    /* Compact brokerage name */
    .brokerage-cell .brokerage-name {
        font-size: 0.7rem;
        font-weight: 600;
        line-height: 1.1;
        word-break: break-word;
        hyphens: auto;
    }
    
    /* Brokerage badges for IRA/referral - mobile - match offer-type style */
    .brokerage-badge {
        display: inline-flex;
        align-items: center;
        padding: 2px var(--space-2);
        border-radius: var(--radius-md);
        font-size: 0.6rem;
        font-weight: 600;
        line-height: 1;
        margin-top: 2px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        border: 1px solid;
    }
    
    .ira-badge {
        background: linear-gradient(135deg, var(--purple-100), var(--purple-200));
        color: var(--purple-700);
        border-color: var(--purple-200);
    }
    
    .referral-badge {
        background: linear-gradient(135deg, var(--emerald-100), var(--emerald-200));
        color: var(--emerald-700);
        border-color: var(--emerald-200);
    }
    /* Your Bonus column - most important, keep wide and visible */
    #bonus-table th:nth-child(3), 
    #bonus-table td:nth-child(3) { 
        width: 110px; 
        min-width: 110px; 
        font-weight: 700;
        font-size: 0.85rem; /* Slightly smaller */
        color: var(--emerald-600);
    }
    /* Effective APY column - important, keep visible */
    #bonus-table th:nth-child(4), 
    #bonus-table td:nth-child(4) { 
        width: 90px; 
        min-width: 90px; 
        font-size: 0.8rem; /* Slightly smaller */
    }
    /* Hold Period column - important, keep visible */
    #bonus-table th:nth-child(5), 
    #bonus-table td:nth-child(5) { 
        width: 85px; 
        min-width: 85px; 
        font-size: 0.8rem;
    }
    /* Offer column - can scroll to see, make narrower */
    #bonus-table th:nth-child(2), 
    #bonus-table td:nth-child(2) { 
        width: 180px; 
        min-width: 180px; 
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    #bonus-table th,
    #bonus-table td {
        padding: var(--space-3) var(--space-2);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Make important columns more readable */
    #bonus-table .bonus-amount {
        font-size: 1rem;
        font-weight: 700;
        color: var(--emerald-600);
    }
    
    /* Brokerage column with favicon */
    #bonus-table td:first-child {
        position: sticky;
        left: 0;
        background: var(--slate-50);
        z-index: 1;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
        min-width: 120px;
    }
    
    #bonus-table th:first-child {
        position: sticky;
        left: 0;
        background: var(--slate-100);
        z-index: 2;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    }
    
    .brokerage-cell {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        font-weight: 600;
    }
    
    .brokerage-favicon {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .bonus-amount {
        font-size: 1.1rem;
        font-weight: 700;
    }
    
    /* Summary stats */
    .summary-stats {
        grid-template-columns: 1fr;
        gap: var(--space-4);
        margin: var(--space-6) 0;
    }
    
    .stat {
        text-align: center;
        padding: var(--space-4);
    }
    
    .stat-number {
        font-size: 2rem;
        display: block;
    }
    
    /* Settings panel - full width */
    .settings-panel {
        margin: var(--space-2) -var(--space-2);
        border-radius: 0;
    }
    
    .settings-content {
        padding: var(--space-3);
    }
    
    /* Amount controls - make more compact */
    .amount-controls {
        margin: var(--space-2) 0;
    }
    
    .amount-control-group {
        padding: var(--space-3);
        margin: 0 -var(--space-2);
        background: var(--slate-50);
        border-radius: var(--radius-lg);
    }
}

/* Desktop - restore original table layout */
@media (min-width: 769px) {
    #bonus-table {
        min-width: 0; /* Remove mobile min-width */
        table-layout: auto; /* Auto sizing on desktop */
    }
    
    /* Remove grid layout for desktop */
    #bonus-table thead tr,
    #bonus-table tbody tr {
        display: table-row;
        grid-template-columns: none;
        grid-template-areas: none;
    }
    
    /* Reset grid areas */
    #bonus-table th, 
    #bonus-table td {
        grid-area: auto;
        width: auto;
        min-width: auto;
        font-size: inherit;
        padding: var(--space-4) var(--space-6);
    }
    
    /* Desktop brokerage cell - horizontal layout */
    #bonus-table .brokerage-cell {
        flex-direction: row;
        gap: var(--space-3);
        align-items: center;
        text-align: left;
    }
    
    #bonus-table .brokerage-favicon {
        width: 20px;
        height: 20px;
    }
    
    .brokerage-cell .brokerage-name {
        font-size: inherit;
        font-weight: 600;
        line-height: 1.4;
        word-break: normal;
        hyphens: none;
    }
    
    /* Desktop badge styling - match mobile gradient style */
    .brokerage-badge {
        font-size: 0.75rem;
        padding: var(--space-1) var(--space-3);
        margin-top: 3px;
        margin-left: 8px;
        display: inline-flex;
        align-items: center;
        border-radius: var(--radius-md);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border: 1px solid;
    }
    
    /* Apply the same gradient colors on desktop */
    .ira-badge {
        background: linear-gradient(135deg, var(--purple-100), var(--purple-200));
        color: var(--purple-700);
        border-color: var(--purple-200);
    }
    
    .referral-badge {
        background: linear-gradient(135deg, var(--emerald-100), var(--emerald-200));
        color: var(--emerald-700);
        border-color: var(--emerald-200);
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    /* Even more aggressive space optimization */
    main {
        padding: var(--space-1);
    }
    
    header {
        padding: var(--space-3) var(--space-1);
    }
    
    header h1 {
        font-size: 1.6rem;
        margin-bottom: var(--space-1);
    }
    
    header p {
        font-size: 0.85rem;
    }
    
    .amount-presets {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-1);
    }
    
    .amount-presets button {
        font-size: 0.75rem;
        padding: var(--space-2) var(--space-1);
    }
    
    .chart-container {
        height: 350px; /* Still decent size on small screens */
        margin: var(--space-1) -var(--space-1);
        padding: var(--space-1);
    }
    
    #bonus-table {
        font-size: 0.85rem; /* Keep readable */
        min-width: 520px; /* Smaller with reordered columns */
    }
    
    /* Even more compact columns for very small screens */
    #bonus-table thead tr,
    #bonus-table tbody tr {
        grid-template-columns: 80px 100px 80px 75px 165px; /* even smaller */
    }
    
    #bonus-table th:nth-child(1), 
    #bonus-table td:nth-child(1) { 
        width: 80px; 
        min-width: 80px; 
    }
    #bonus-table th:nth-child(3), 
    #bonus-table td:nth-child(3) { 
        width: 100px; 
        min-width: 100px; 
        font-size: 0.8rem; /* Even smaller on tiny screens */
    }
    #bonus-table th:nth-child(4), 
    #bonus-table td:nth-child(4) { 
        width: 80px; 
        min-width: 80px; 
        font-size: 0.75rem; /* Even smaller on tiny screens */
    }
    #bonus-table th:nth-child(5), 
    #bonus-table td:nth-child(5) { 
        width: 75px; 
        min-width: 75px; 
        font-size: 0.75rem;
    }
    #bonus-table th:nth-child(2), 
    #bonus-table td:nth-child(2) { 
        width: 165px; 
        min-width: 165px; 
    }
    
    #bonus-table th,
    #bonus-table td {
        padding: var(--space-2) var(--space-1);
    }
    
    .results-header h2 {
        font-size: 1.25rem;
        margin-bottom: var(--space-2);
    }
    
    /* Full width containers */
    .view-container,
    .chart-container,
    .settings-panel {
        margin-left: -var(--space-1);
        margin-right: -var(--space-1);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-600), var(--emerald-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-backdrop);
}

/* Modern Card System for Detail Pages */
.modern-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--primary-500) 0%, 
        var(--purple-500) 50%, 
        var(--emerald-500) 100%);
}

.modern-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Bonus Header Enhancements */
.bonus-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.bonus-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, 
        var(--emerald-500) 0%, 
        var(--primary-500) 33%, 
        var(--purple-500) 66%, 
        var(--rose-500) 100%);
}

.brokerage-title-section {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.brokerage-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: white;
    padding: var(--space-1);
    flex-shrink: 0;
}

.title-group h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--slate-900);
    margin-bottom: var(--space-2);
    line-height: 1.2;
}

.title-group h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--slate-700);
    line-height: 1.4;
}

.offer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.offer-type-badge, .expiry-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Style badges based on content */
.offer-type-badge {
    background: linear-gradient(135deg, var(--slate-100), var(--slate-50));
    color: var(--slate-800);
    border: 1px solid var(--slate-200);
}

.offer-type-badge:contains("IRA"),
.ira-badge {
    background: linear-gradient(135deg, var(--emerald-100), var(--emerald-50));
    color: var(--emerald-800);
    border: 1px solid var(--emerald-200);
}

.offer-type-badge:contains("Referral"),
.referral-badge {
    background: linear-gradient(135deg, var(--purple-100), var(--purple-50));
    color: var(--purple-800);
    border: 1px solid var(--purple-200);
}

.expiry-badge {
    background: linear-gradient(135deg, var(--rose-100), var(--rose-50));
    color: var(--rose-800);
    border: 1px solid var(--rose-200);
}

/* Calculator Enhancement */
.calculator {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    align-items: center;
}

.calc-input label {
    display: block;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: var(--space-3);
    font-size: 1.1rem;
}

.calc-input input {
    width: 100%;
    padding: var(--space-4);
    border: 2px solid var(--slate-200);
    border-radius: var(--radius-lg);
    font-size: 1.25rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.calc-input input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    background: white;
}

.calc-result {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.result-label {
    font-weight: 600;
    color: var(--slate-700);
}

.result-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--emerald-600);
}

/* Detail Cards */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
}

.detail-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
}

.detail-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.detail-card .detail-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--slate-900);
    margin-bottom: var(--space-2);
}

.detail-card .detail-description {
    font-size: 0.875rem;
    color: var(--slate-600);
    margin: 0;
}

/* Enhanced Tables */
.tiers-table {
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tiers-table table {
    width: 100%;
    border-collapse: collapse;
}

.tiers-table thead {
    background: rgba(255, 255, 255, 0.8);
}

.tiers-table th {
    padding: var(--space-4) var(--space-6);
    font-weight: 700;
    color: var(--slate-800);
    text-align: left;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.tiers-table td {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--slate-700);
    font-weight: 500;
}

.tiers-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Enhanced Lists */
.restrictions-list, .benefits-list, .notes-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.restrictions-list li, .benefits-list li, .notes-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    line-height: 1.6;
}

.restrictions-list li::before {
    content: '⚠️';
    flex-shrink: 0;
}

.benefits-list li::before {
    content: '✨';
    flex-shrink: 0;
}

.notes-list li::before {
    content: '📝';
    flex-shrink: 0;
}

/* Source Links Enhancement */
.source-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.btn-large {
    padding: var(--space-5) var(--space-8);
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 200px;
    justify-content: center;
}

.attribution-text {
    font-size: 0.9rem;
    color: var(--slate-600);
    font-style: italic;
    text-align: center;
    padding: var(--space-4);
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Breadcrumb Enhancement */
.breadcrumb {
    margin-bottom: var(--space-6);
}

.breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    color: var(--slate-700);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.breadcrumb a:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-600);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Mobile Responsive for Detail Pages */
@media (max-width: 768px) {
    .modern-card {
        margin: var(--space-4) -var(--space-2);
        padding: var(--space-6);
        border-radius: var(--radius-lg);
    }
    
    .bonus-header {
        margin: var(--space-4) -var(--space-2) var(--space-4);
        padding: var(--space-6);
        border-radius: var(--radius-lg);
    }
    
    .brokerage-title-section {
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }
    
    .brokerage-logo {
        width: 48px;
        height: 48px;
        align-self: center;
    }
    
    .title-group h2 {
        font-size: 1.5rem;
    }
    
    .title-group h3 {
        font-size: 1.125rem;
    }
    
    .calculator {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .source-buttons {
        flex-direction: column;
    }
    
    .btn-large {
        min-width: auto;
        width: 100%;
    }
    
    .tiers-table {
        font-size: 0.875rem;
    }
    
    .tiers-table th,
    .tiers-table td {
        padding: var(--space-3) var(--space-4);
    }
    
    /* Hide some table columns on very small screens */
    @media (max-width: 480px) {
        .tiers-table th:nth-child(2),
        .tiers-table td:nth-child(2) {
            display: none;
        }
    }
}