/* Modern UI/UX Design - 2025 Trends */
/* Incorporating: Glassmorphism, Bento Box Layouts, Bold Typography, Neumorphism */

:root {
    --primary: #6baaff;
    --primary-dark: #3f84ff;
    --primary-light: #b9d3ff;
    --secondary: #9076ff;
    --accent: #53e5ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef476f;
    
    --text-primary: #0d1730;
    --text-secondary: #42526f;
    --text-light: #7286aa;
    
    --bg-primary: #f7faff;
    --bg-secondary: #eef4ff;
    --bg-tertiary: #e4ecfb;
    --bg-glass: rgba(255, 255, 255, 0.78);
    --bg-glass-dark: rgba(10, 17, 36, 0.78);
    
    --border-color: rgba(92, 118, 170, 0.22);
    --shadow-sm: 0 10px 24px rgba(11, 20, 43, 0.06);
    --shadow-md: 0 16px 36px rgba(11, 20, 43, 0.1);
    --shadow-lg: 0 24px 54px rgba(11, 20, 43, 0.14);
    --shadow-xl: 0 36px 84px rgba(11, 20, 43, 0.2);
    --shadow-glass: 0 20px 52px rgba(20, 37, 78, 0.18);
    
    --gradient-primary: linear-gradient(135deg, #6baaff 0%, #3f84ff 100%);
    --gradient-secondary: linear-gradient(135deg, #6baaff 0%, #9076ff 100%);
    --gradient-accent: linear-gradient(135deg, #53e5ff 0%, #6baaff 100%);
    --gradient-text: linear-gradient(135deg, #6baaff 0%, #53e5ff 44%, #9076ff 100%);
    --gradient-flagship-dark: linear-gradient(180deg, #08111f 0%, #0e1731 55%, #14203d 100%);
    --gradient-flagship-light: linear-gradient(180deg, #f7faff 0%, #eef4ff 52%, #e4ecfb 100%);
    --surface-strong: rgba(255, 255, 255, 0.82);
    --surface-inverse: rgba(8, 13, 30, 0.84);
    --surface-border-strong: rgba(94, 128, 194, 0.26);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 28px;
    /* Hero glass + bento + allocation tiles — portfolio/symbol/market/status lists */
    --glass-panel-radius: 10px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography — institutional fintech (single family, strong hierarchy) */
    --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-heading-weight: 700;

    /*
     * List-page hero typography: /market (status-hero-modern + market shell) and /portfolio hero.
     * Edit these once to keep both pages aligned. (Sizes are +2px vs original baseline.)
     */
    --iris-list-hero-eyebrow-size: 14px;
    --iris-list-hero-title-size: calc(clamp(32px, 4vw, 44px) + 7pt);
    --iris-list-hero-title-weight: 800;
    --iris-list-hero-title-letter-spacing: -0.02em;
    --iris-list-hero-title-line-height: 1.22;
    --iris-list-hero-description-size: clamp(17px, 2vw, 19px);
    --iris-list-hero-description-line-height: 1.55;
    --iris-list-hero-pill-size: 17px;
    --iris-list-hero-panel-label-size: 16px;
    --iris-list-hero-panel-step-size: 15px;
    --iris-list-hero-panel-heading-size: 20px;
    --iris-list-hero-panel-body-size: 18px;
    --iris-list-hero-panel-body-line-height: 1.6;

    /* Primary as RGB triple for rgba(..., a) */
    --primary-rgb: 96, 165, 250;
    --primary-hover: #2563eb;

    /* Shared chrome + legacy header aliases */
    --border-radius: var(--radius-sm);
    --bg-accent: var(--bg-tertiary);
    --primary-color: var(--primary);
    --primary-color-rgb: var(--primary-rgb);
}

[data-theme="dark"] {
    --primary: #6ec8ff;
    --primary-dark: #3fa8e8;
    --primary-light: #a8deff;
    --secondary: #ff5a7a;
    --accent: #54e0ff;
    --success: #47d18c;
    --warning: #e8b339;
    --danger: #e6335a;

    --text-primary: #f4f6fa;
    --text-secondary: #9aa3b2;
    --text-light: #6d7688;

    --bg-primary: #090b10;
    --bg-secondary: #121826;
    --bg-tertiary: #1a2234;
    --bg-glass: rgba(18, 22, 38, 0.88);
    --bg-glass-dark: rgba(6, 8, 14, 0.94);

    --border-color: rgba(110, 200, 255, 0.12);
    --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 54px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 36px 90px rgba(0, 0, 0, 0.55);
    --shadow-glass: 0 24px 64px rgba(0, 0, 0, 0.5);
    --surface-strong: rgba(26, 34, 52, 0.92);
    --surface-inverse: rgba(244, 246, 250, 0.96);
    --surface-border-strong: rgba(110, 200, 255, 0.18);

    --gradient-primary: linear-gradient(135deg, #6ec8ff 0%, #3fa8e8 100%);
    --gradient-secondary: linear-gradient(135deg, #6ec8ff 0%, #ff5a7a 100%);
    --gradient-accent: linear-gradient(135deg, #54e0ff 0%, #6ec8ff 100%);
    --gradient-text: linear-gradient(135deg, #6ec8ff 0%, #a8deff 40%, #ff5a7a 100%);
    --gradient-flagship-dark: linear-gradient(180deg, #090b10 0%, #121826 52%, #1a2234 100%);
    --gradient-flagship-light: linear-gradient(180deg, #121826 0%, #1a2234 50%, #222c42 100%);

    --primary-rgb: 110, 200, 255;
    --primary-hover: #4db4f0;
    --primary-color: var(--primary);
    --primary-color-rgb: var(--primary-rgb);
}

html {
    /* Make browser-level canvas/UI surfaces honor active theme (not white by default). */
    color-scheme: light;
}

[data-theme="dark"] {
    color-scheme: dark;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

html,
body {
    background-color: var(--bg-primary);
}

/*
 * Safari/iOS overscroll failsafe: before any script runs, html may have no data-theme.
 * Do NOT match explicit light mode: light uses data-theme="light" so it is not :not([data-theme]).
 * (Removing the attribute for "light" breaks pages under prefers-color-scheme: dark — body stays dark.)
 */
@media (prefers-color-scheme: dark) {
    html:not([data-theme]),
    html:not([data-theme]) body {
        background-color: #090b10;
    }

    html:not([data-theme]) {
        color-scheme: dark;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Hero Section with Glassmorphism */
.hero-modern {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 0 80px;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(63, 55, 201, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(76, 201, 240, 0.1) 0%, transparent 50%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
    animation: fadeInUp 0.8s ease-out;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.hero-badge i {
    color: var(--primary);
}

.hero-title {
    font-size: clamp(42px, 8vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.gradient-text {
    color: var(--text-primary);
}

.hero-description {
    font-size: clamp(18px, 2.5vw, 22px);
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-cta-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.btn-hero-primary,
.btn-hero-secondary {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-hero-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(96, 165, 250, 0.4);
}

.btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(96, 165, 250, 0.5);
}

.btn-hero-secondary {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-hero-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
}

.hero-trust {
    display: flex;
    gap: 32px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 48px;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.trust-item i {
    color: var(--primary);
}

/* Bento Box Grid */
.bento-section {
    padding: 80px 0;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    grid-auto-rows: minmax(200px, auto);
}

.bento-card {
    padding: 32px;
    border-radius: var(--radius-xl);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.5);
}

.bento-large {
    grid-column: span 8;
    grid-row: span 2;
}

.bento-medium {
    grid-column: span 4;
    grid-row: span 2;
}

.bento-small {
    grid-column: span 4;
    grid-row: span 1;
}

.bento-wide {
    grid-column: span 12;
    grid-row: span 1;
}

.bento-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: var(--shadow-lg);
}

.bento-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.bento-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.bento-stats {
    display: flex;
    gap: 32px;
    margin-top: 32px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.bento-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.bento-link:hover {
    gap: 12px;
    color: var(--primary-dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.feature-item {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feature-item i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 16px;
}

.feature-item h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* CTA Section */
.cta-modern-section {
    padding: 80px 0;
    background: var(--bg-secondary);
}

.cta-modern {
    text-align: center;
}

.cta-content {
    max-width: 700px;
    margin: 0 auto;
}

.cta-title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.cta-description {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.7;
}

.btn-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 36px;
    font-size: 18px;
    font-weight: 600;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    text-decoration: none;
    box-shadow: 0 4px 14px 0 rgba(96, 165, 250, 0.4);
    transition: var(--transition);
}

.btn-cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(96, 165, 250, 0.5);
}

/* Add to Home Screen Prompt */
.add-to-home-prompt {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 32px);
    max-width: 400px;
    animation: slideUp 0.4s ease-out;
}

.prompt-content {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    box-sizing: border-box;
}

.prompt-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}

.prompt-text {
    flex: 1;
}

.prompt-text h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.prompt-text p {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-add-home {
    padding: 10px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-add-home:hover {
    transform: scale(1.05);
}

.btn-dismiss {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-dismiss:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .bento-large {
        grid-column: span 12;
    }
    
    .bento-medium {
        grid-column: span 6;
    }
    
    .bento-small {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .hero-modern {
        min-height: 80vh;
        padding: 80px 0 60px;
    }
    
    .hero-title {
        font-size: 42px;
    }
    
    .hero-description {
        font-size: 18px;
    }
    
    .hero-cta-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-hero-primary,
    .btn-hero-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .hero-trust {
        flex-direction: column;
        gap: 16px;
    }
    
    .bento-section {
        padding: 60px 0;
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .bento-card {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        padding: 24px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-modern-section {
        padding: 60px 0;
    }
    
    .add-to-home-prompt {
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
        transform: none;
    }
    
    .prompt-content {
        padding: 16px;
        gap: 12px;
    }
    
    .prompt-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .prompt-text h4 {
        font-size: 14px;
    }
    
    .prompt-text p {
        font-size: 12px;
    }
    
    .btn-add-home {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero-modern {
        padding: 60px 0 40px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .bento-card {
        padding: 20px;
    }
    
    .bento-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .bento-title {
        font-size: 20px;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transform: translateX(100%);
    transition: var(--transition);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

/* Dark mode adjustments */
[data-theme="dark"] .hero-background {
    background: 
        radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(63, 55, 201, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(76, 201, 240, 0.05) 0%, transparent 50%);
}

[data-theme="dark"] .glass-card {
    background: var(--bg-glass-dark);
}

[data-theme="dark"] .hero-badge,
[data-theme="dark"] .btn-hero-secondary {
    background: var(--bg-glass-dark);
}

[data-theme="dark"] .prompt-content {
    background: var(--bg-glass-dark);
}

[data-theme="dark"] .toast {
    background: var(--bg-glass-dark);
}

@media (max-width: 768px) {
    .toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

