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

:root {
    /* Classic Variables */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    
    /* Modern Terminal Tokens */
    --brand-primary: #2563eb;
    --brand-secondary: #6366f1;
    --brand-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    
    /* Slate Scale */
    --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;
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: 1px solid rgba(226, 232, 240, 0.8);
    --glass-blur: blur(16px);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Global Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5, .font-heading {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary); 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* ============================================================
   1. Classic Navigation (dashboard-classic.html & general pages)
   ============================================================ */
#navbar, .top-nav, nav:not(.sidebar-nav) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5%;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

#navbar ul, .top-nav ul, nav:not(.sidebar-nav) ul {
    list-style: none;
    display: flex;
    gap: 28px;
    align-items: center;
    margin: 0;
    padding: 0;
}

#navbar a, .top-nav a, nav:not(.sidebar-nav) a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s ease;
    position: relative;
    padding: 6px 0;
}

#navbar a:hover, nav a:hover, #navbar a.active, nav a.active {
    color: var(--brand-primary);
}

#navbar a::after, nav:not(.sidebar-nav) a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

#navbar a:hover::after, nav:not(.sidebar-nav) a:hover::after, #navbar a.active::after, nav:not(.sidebar-nav) a.active::after {
    width: 100%;
}

/* ============================================================
   2. Classic Dashboard Components (dashboard-classic.html)
   ============================================================ */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 5% 48px;
}

.welcome-section {
    background: var(--accent-gradient);
    color: white;
    padding: 36px 40px;
    border-radius: 20px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.35);
    position: relative;
    overflow: hidden;
}

.welcome-section h1 {
    color: white !important;
    margin: 0 0 8px 0;
    font-size: 30px;
    letter-spacing: -0.5px;
}

.welcome-section p {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 15px;
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.portfolio-section {
    background: var(--bg-secondary);
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
    border: 1px solid var(--slate-200);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portfolio-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.portfolio-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateX(4px);
}

.portfolio-item-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.portfolio-item-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
}

/* ============================================================
   3. Modern Terminal Layout (dashboard.html)
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid var(--slate-200);
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
    padding: 0 32px;
    margin-bottom: 48px;
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    margin: 4px 16px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--slate-500);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.sidebar-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-item:hover {
    background: var(--slate-100);
    color: var(--slate-900);
    transform: translateX(4px);
}

.sidebar-item.active {
    background: var(--brand-primary);
    color: white !important;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.sidebar-item.active i, .sidebar-item.active span {
    color: white !important;
}

.main-surface {
    flex: 1;
    margin-left: 280px;
    background-color: var(--slate-50);
    padding: 40px;
    max-width: calc(100vw - 280px);
}

/* ============================================================
   4. Universal Cards & Stats
   ============================================================ */
.card {
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-float);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.stat-card {
    padding: 24px;
    background: var(--slate-50);
    border-radius: 16px;
    border: 1px solid var(--slate-200);
}

.stat-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -0.02em;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

.trend-up, .ticker-up { color: var(--success) !important; }
.trend-down, .ticker-down { color: var(--danger) !important; }

/* ============================================================
   5. Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
    background: white;
    color: var(--slate-700) !important;
    border: 1px solid var(--slate-200);
}

.btn-secondary:hover {
    background: var(--slate-50);
    border-color: var(--slate-300);
    transform: translateY(-1px);
}

/* ============================================================
   6. Form Inputs & Selects
   ============================================================ */
.input-field, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--slate-900);
    transition: all 0.2s ease;
}

.input-field:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ============================================================
   7. Modals (Both Classic & Modern)
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: 20px;
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--slate-200);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--slate-100);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-content {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 520px;
    padding: 32px;
    box-shadow: var(--shadow-float);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   8. Institutional Ticker
   ============================================================ */
.ticker-container {
    background: var(--slate-900);
    color: white;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.ticker-wrap {
    display: flex;
    white-space: nowrap;
    overflow: hidden;
}

.ticker-wrap .ticker, .ticker-wrap {
    animation: scroll 30s linear infinite;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    padding: 0 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
}

/* ============================================================
   9. Lists & Charts
   ============================================================ */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.list-item:hover {
    background: var(--slate-50);
    border-color: var(--brand-primary);
}

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

/* ============================================================
   10. Animations & Utilities
   ============================================================ */
.reveal {
    opacity: 1;
    transform: none;
    transition: all 0.4s ease;
}

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

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .main-surface { margin-left: 0; max-width: 100vw; }
}

/* Selected state for toggle buttons (risk profile, add-holding mode) */
.btn-secondary.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}
