/* ================================================
   MARKET INTELLIGENCE DASHBOARD - Old Money Theme
   ================================================ */

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

:root {
    --green: #2c5f3f;
    --green-deep: #1e3f2b;
    --green-light: #3a7a54;
    --green-muted: rgba(44, 95, 63, 0.08);
    --gold: #b8975a;
    --gold-light: #d4b77a;
    --cream: #f8f5f0;
    --cream-dark: #f0ebe3;
    --cream-deeper: #e8e1d6;
    --white: #ffffff;
    --charcoal: #1a1a1a;
    --text: #2a2a2a;
    --text-muted: #6b6560;
    --border: rgba(44, 95, 63, 0.12);
    --border-light: rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
    --red: #c0392b;
    --red-light: rgba(192, 57, 43, 0.08);
    --green-gain: #27ae60;
    --green-gain-light: rgba(39, 174, 96, 0.08);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    font-weight: 400;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.section-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--gold);
    margin-bottom: 12px;
}

.section-title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    line-height: 1.15;
    color: var(--charcoal);
}

/* --- Navigation --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: rgba(248, 245, 240, 0.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
}

.nav-logo {
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 4px;
    color: var(--green-deep);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 2px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--green);
}

/* --- Main Content --- */
.main-content {
    padding-top: 80px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--green);
    color: #fff;
}

.btn-primary:hover {
    background: var(--green-deep);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(44, 95, 63, 0.25);
}

.btn-outline {
    background: transparent;
    color: var(--green);
    border: 2px solid var(--green);
}

.btn-outline:hover {
    background: var(--green);
    color: #fff;
}

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

.btn-full {
    width: 100%;
}

.divider {
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin: 16px 0;
}

/* --- Login Page --- */
.login-wrapper {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 48px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--charcoal);
    margin-bottom: 4px;
}

.login-header .divider {
    margin: 16px auto;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--charcoal);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--cream);
    border: 1px solid var(--cream-deeper);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.form-group input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-muted);
}

.login-form .btn {
    margin-top: 8px;
    padding: 16px;
}

/* --- Pricing Page --- */
.pricing-plan {
    margin-top: 1.5rem;
}

.pricing-price {
    font-family: 'DM Serif Display', serif;
    font-size: 2.5rem;
    color: var(--green-deep);
    margin: 0.5rem 0 1rem;
}

.pricing-period {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-muted);
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.pricing-features li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.pricing-features li::before {
    content: "✓  ";
    color: var(--green);
    font-weight: 600;
}

.pricing-features li:last-child {
    border-bottom: none;
}

/* --- Alert --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.alert-error {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid rgba(192, 57, 43, 0.15);
}

/* --- Dashboard --- */
.dashboard {
    padding-top: 20px;
    padding-bottom: 80px;
}

.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
}

.dash-header .section-title {
    margin-bottom: 4px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--green-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--green);
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--charcoal);
}

.empty-state p {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}

.error-state {
    border-color: rgba(192, 57, 43, 0.15);
}

.error-state h2 {
    color: var(--red);
}

/* --- Index Cards --- */
.indices-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.index-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all 0.3s ease;
}

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

.index-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.index-price {
    font-family: 'DM Serif Display', serif;
    font-size: 2rem;
    color: var(--charcoal);
    margin-bottom: 4px;
}

.index-change {
    font-size: 0.95rem;
    font-weight: 600;
}

.index-change.positive {
    color: var(--green-gain);
}

.index-change.negative {
    color: var(--red);
}

/* --- AI Section --- */
.ai-section {
    margin-bottom: 32px;
}

.ai-card {
    background: var(--green-deep);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
}

.ai-card h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 20px;
}

.ai-text {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.8;
    font-size: 0.95rem;
    white-space: pre-line;
}

.risk-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.risk-section h3 {
    font-size: 1.2rem;
    color: var(--gold-light);
    margin-bottom: 12px;
}

/* --- Stocks to Watch --- */
.section {
    margin-bottom: 32px;
}

.watch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.watch-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.3s ease;
}

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

.watch-ticker {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--green);
    background: var(--green-muted);
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.watch-reason {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* --- Top Movers --- */
.movers-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.movers-table {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.movers-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 14px 20px;
    background: var(--cream);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

/* 4-column header for unusual volume table */
.section > .movers-table .movers-header {
    grid-template-columns: 1fr 1fr 1fr 0.8fr;
}

.section > .movers-table .movers-row {
    grid-template-columns: 1fr 1fr 1fr 0.8fr;
}

.movers-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 12px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
}

.movers-row:last-child {
    border-bottom: none;
}

.movers-row:hover {
    background: var(--cream);
}

.ticker {
    font-weight: 700;
    color: var(--charcoal);
    letter-spacing: 0.5px;
}

.positive {
    color: var(--green-gain);
    font-weight: 600;
}

.negative {
    color: var(--red);
    font-weight: 600;
}

.volume-highlight {
    border-left: 3px solid var(--gold);
}

.volume-ratio {
    font-weight: 700;
    color: var(--gold);
}

/* --- News --- */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px 24px;
    transition: all 0.3s ease;
}

.news-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.news-headline {
    font-size: 1rem;
    color: var(--charcoal);
    margin-bottom: 6px;
    line-height: 1.4;
}

.news-source {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.news-summary {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
    line-height: 1.5;
}

.news-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Spinner --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}

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

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 768px) {
    .indices-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .movers-section {
        grid-template-columns: 1fr;
    }

    .dash-header {
        flex-direction: column;
        gap: 12px;
    }

    .dash-header .btn {
        align-self: flex-start;
    }

    .ai-card {
        padding: 28px 20px;
    }

    .ai-card h2 {
        font-size: 1.4rem;
    }

    .watch-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .index-price {
        font-size: 1.5rem;
    }

    .movers-header,
    .movers-row {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
}
