/* ============================================
   ROI Dashboard - Premium Dark Theme
   ============================================ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --border-color: rgba(99, 102, 241, 0.15);
    --border-hover: rgba(99, 102, 241, 0.35);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-indigo: #6366f1;
    --accent-violet: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --accent-sky: #0ea5e9;
    
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-danger: linear-gradient(135deg, #f43f5e, #fb7185);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #fbbf24);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background particles */
.bg-particles {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-particles::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(1deg); }
    66% { transform: translate(-20px, 20px) rotate(-1deg); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 48px;
}

/* ============================================
   Header
   ============================================ */
.header {
    margin-bottom: 32px;
    animation: fadeInDown 0.6s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

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

.logo-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.3);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 20px 5px rgba(99, 102, 241, 0.15); }
}

.header h1 {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

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

.header-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 13px;
    color: var(--accent-emerald);
    font-weight: 500;
}

.badge-dot {
    width: 8px; height: 8px;
    background: var(--accent-emerald);
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.header-date {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   Scenario Tabs
   ============================================ */
.scenario-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-family: inherit;
    backdrop-filter: blur(10px);
}

.tab:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.tab.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border-color: var(--accent-indigo);
    color: var(--text-primary);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.tab-icon { font-size: 22px; }
.tab-label { font-size: 14px; font-weight: 600; }
.tab-rate { font-size: 12px; color: var(--text-muted); }
.tab.active .tab-rate { color: var(--accent-indigo); }

/* ============================================
   KPI Cards
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.kpi-card.highlight {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(6, 182, 212, 0.05));
    border-color: rgba(16, 185, 129, 0.3);
}

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

.invest-icon { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.return-icon { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.roi-icon { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.breakeven-icon { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }

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

.kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-card.highlight .kpi-value {
    background: var(--gradient-success);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ============================================
   Chart Sections
   ============================================ */
.chart-section {
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease 0.35s both;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.chart-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.chart-card.main-chart {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.9), rgba(30, 41, 59, 0.6));
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chart-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.chart-wrapper {
    position: relative;
    width: 100%;
    min-height: 320px;
}

.chart-card.main-chart .chart-wrapper {
    min-height: 400px;
}

/* ============================================
   Table Section
   ============================================ */
.table-section {
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease 0.5s both;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    backdrop-filter: blur(10px);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

thead th {
    background: rgba(99, 102, 241, 0.08);
    padding: 14px 16px;
    text-align: right;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

thead th:first-child {
    text-align: left;
    border-radius: var(--radius-sm) 0 0 0;
}

thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

tbody td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s;
    white-space: nowrap;
}

tbody td:first-child { text-align: left; font-weight: 500; }

tbody tr:hover td {
    background: rgba(99, 102, 241, 0.06);
}

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

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.need-add {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-rose);
}

.status-badge.breakeven {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
}

.status-badge.profit {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-emerald);
}

.value-negative { color: var(--accent-rose); }
.value-positive { color: var(--accent-emerald); }

/* ============================================
   Insight Section
   ============================================ */
.insight-section {
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease 0.55s both;
}

.insight-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-xl);
    padding: 32px;
    backdrop-filter: blur(10px);
}

.insight-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.insight-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.insight-item:last-child { border-bottom: none; }

.insight-item .bullet {
    flex-shrink: 0;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent-indigo);
    margin-top: 8px;
}

.insight-highlight {
    color: var(--accent-indigo);
    font-weight: 600;
}

.insight-positive { color: var(--accent-emerald); font-weight: 600; }
.insight-negative { color: var(--accent-rose); font-weight: 600; }

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .container { padding: 16px; }
    .chart-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
    .scenario-tabs { flex-direction: column; }
    .header h1 { font-size: 22px; }
}

/* ============================================
   Password Gate
   ============================================ */
.password-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    animation: fadeIn 0.3s ease;
}

.password-overlay::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
    animation: bgFloat 15s ease-in-out infinite;
}

.password-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.password-card {
    position: relative;
    z-index: 1;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(20px);
    animation: fadeInUp 0.6s ease;
}

.password-logo {
    margin-bottom: 20px;
    animation: pulse 3s ease-in-out infinite;
}

.password-title {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.password-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.password-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.password-input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.password-input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

.password-btn {
    padding: 14px 18px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.password-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

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

.password-error {
    font-size: 13px;
    color: var(--accent-rose);
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-top: 4px;
}

.password-error.show {
    opacity: 1;
    animation: shake 0.4s ease;
}

.password-input.error {
    border-color: var(--accent-rose);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

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