/* Solve Investment Tool - Modern Financial Tools Styling */
/* Adapted from itstimefortax design system */

:root {
    /* Primary Colors - Cohesive Indigo/Slate Palette */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --accent: #818cf8;
    --secondary: #64748b;
    --secondary-light: #94a3b8;
    --secondary-dark: #475569;

    /* Neutral Colors */
    --dark: #1e293b;
    --gray: #64748b;
    --light-gray: #f1f5f9;
    --white: #ffffff;

    /* Status Colors - Keep distinct */
    --success: #10b981;
    --warning: #f39c12;
    --error: #ef4444;

    /* Financial Colors */
    --profit: #10b981;
    --loss: #ef4444;
    --neutral: #6366f1;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.2);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: var(--dark);
    line-height: 1.6;
    background: var(--light-gray);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 2rem; }
h4 { font-size: 1.5rem; }

p {
    margin-bottom: 1rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s;
}

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

/* Ensure nav button text is readable on hover */
.nav-links .btn-outline:hover {
    background: var(--primary);
    color: var(--white) !important;
}

.nav-links .btn-primary:hover {
    color: var(--white) !important;
}

.nav-links a.highlight {
    color: var(--success);
    font-weight: 700;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--dark);
    border-radius: 2px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

/* Hero Section */
.hero {
    position: relative;
    background: url('https://images.unsplash.com/photo-1552664730-d307ca884978?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    color: var(--white);
    padding: 120px 20px;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.65) 0%, rgba(55, 48, 163, 0.7) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero .btn-white {
    background: var(--white);
    color: var(--primary);
}

.hero .btn-white:hover {
    background: var(--primary-light);
    color: var(--white);
}

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

.hero .btn-outline:hover {
    background: var(--white);
    color: var(--primary);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-gray);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.stat-card.profit {
    background: linear-gradient(135deg, var(--success), var(--teal));
}

.stat-card.loss {
    background: linear-gradient(135deg, var(--error), #c0392b);
}

.stat-card.neutral {
    background: linear-gradient(135deg, var(--neutral), var(--accent));
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-control:disabled {
    background: var(--light-gray);
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-text {
    padding: 12px 16px;
    background: var(--light-gray);
    border: 2px solid #e0e0e0;
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-weight: 500;
    color: var(--gray);
}

/* Calculator Layout */
.calculator-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 20px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.calculator-inputs,
.calculator-results {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: var(--light-gray);
    font-weight: 600;
}

tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.text-right {
    text-align: right;
}

.text-profit {
    color: var(--profit);
    font-weight: 600;
}

.text-loss {
    color: var(--loss);
    font-weight: 600;
}

/* Comparison Tool */
.comparison-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.comparison-side {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.comparison-side h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}

.winner-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--success), var(--teal));
    color: var(--white);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1.25rem;
    text-align: center;
    margin: 1rem 0;
}

.winner-badge.loser {
    background: var(--gray);
}

/* Auth Pages */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.alert-error {
    background: #fdeaea;
    color: var(--error);
    border: 1px solid var(--error);
}

.alert-success {
    background: #eafaf1;
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-info {
    background: #e8f4fd;
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* Dashboard */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 3rem 2rem;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    margin-bottom: 0.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.tool-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--dark);
}

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

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card h3 {
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: var(--gray);
    font-size: 0.875rem;
}

/* Scenarios List */
.scenarios-list {
    list-style: none;
}

.scenario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

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

.scenario-info h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.scenario-meta {
    font-size: 0.875rem;
    color: var(--gray);
}

.scenario-actions {
    display: flex;
    gap: 0.5rem;
}

/* Footer */
.footer {
    background: var(--dark);
    color: var(--white);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.footer-brand h4 {
    margin-bottom: 0.5rem;
}

.footer-brand p {
    opacity: 0.7;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--white);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    text-align: center;
}

.disclaimer {
    font-size: 0.875rem;
    opacity: 0.7;
    max-width: 800px;
    margin: 0 auto 1rem;
}

/* Sections */
.section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 992px) {
    .calculator-grid,
    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .form-row,
    .form-row-3,
    .results-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none; }

/* Admin Mode - Formula Tooltips */
body.admin-mode .admin-tooltip {
    position: relative;
    cursor: help;
    border-bottom: 2px dashed #7c3aed;
    padding-bottom: 1px;
}

body.admin-mode .admin-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

body.admin-mode .admin-tooltip::after {
    content: attr(data-formula);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: 'Monaco', 'Menlo', monospace;
    white-space: normal;
    min-width: 220px;
    max-width: 500px;
    width: max-content;
    text-align: center;
    line-height: 1.5;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body.admin-mode .admin-tooltip:hover::before,
body.admin-mode .admin-tooltip:hover::after {
    opacity: 1;
}

/* Admin indicator badge */
body.admin-mode::before {
    content: 'ADMIN MODE';
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}
