/* ==========================================================================
   IS IT TIME YET? - Design System v2.0
   Clean, modern, accessible design for retirement planning
   ========================================================================== */

/* ==========================================================================
   1. CSS Variables / Design Tokens
   ========================================================================== */
:root {
    /* Primary Brand Colors - Rich Navy Blue Palette */
    --bs-primary: #1e3a5f;
    --bs-primary-rgb: 30, 58, 95;
    --brand-primary: #1e3a5f;
    --brand-primary-light: #2d5a8c;
    --brand-primary-dark: #0f2340;

    /* Secondary Colors */
    --bs-secondary: #4a6fa5;
    --bs-secondary-rgb: 74, 111, 165;
    --brand-secondary: #4a6fa5;

    /* Accent Colors */
    --bs-success: #28a745;
    --bs-success-rgb: 40, 167, 69;
    --brand-accent: #28a745;
    --brand-accent-light: #48c76a;

    /* Neutral Colors */
    --bs-body-bg: #f8fafc;
    --bs-body-color: #2d3748;
    --brand-light: #f1f5f9;
    --brand-dark: #1a202c;
    --brand-muted: #64748b;
    --brand-border: #e2e8f0;

    /* Surface Colors */
    --surface-card: #ffffff;
    --surface-elevated: #ffffff;

    /* Typography */
    --bs-font-sans-serif: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    --font-size-base: 1.0625rem;
    --font-size-sm: 0.9375rem;
    --font-size-lg: 1.1875rem;
    --font-size-xl: 1.375rem;
    --line-height-base: 1.7;

    /* Spacing */
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1.25rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --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-card: 0 2px 8px rgba(30, 58, 95, 0.08), 0 1px 4px rgba(30, 58, 95, 0.06);
    --shadow-card-hover: 0 8px 25px rgba(30, 58, 95, 0.15), 0 4px 10px rgba(30, 58, 95, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ==========================================================================
   2. Base Styles / Reset
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--bs-font-sans-serif);
    font-size: var(--font-size-base);
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */
h1:focus {
    outline: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--brand-primary);
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

h1,
.h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2,
.h2 {
    font-size: 2rem;
}

h3,
.h3 {
    font-size: 1.625rem;
}

h4,
.h4 {
    font-size: 1.375rem;
}

h5,
.h5 {
    font-size: 1.1875rem;
}

h6,
.h6 {
    font-size: var(--font-size-base);
}

p {
    margin-bottom: var(--spacing-md);
}

.lead {
    font-size: var(--font-size-lg);
    font-weight: 400;
}

.text-muted {
    color: var(--brand-muted) !important;
}

small,
.small {
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   4. Cards - Modern with Shadows and Hover Effects
   ========================================================================== */
.card {
    background: var(--surface-card);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    overflow: visible;
}

/* Use this class when a card needs overflow hidden (e.g., for images) */
.card.overflow-clip {
    overflow: hidden;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

/* Disable hover effect for cards that shouldn't move */
.card.no-hover:hover,
.card-body .card:hover,
table .card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
}

.card-header {
    background: var(--brand-light);
    border-bottom: 1px solid var(--brand-border);
    padding: var(--spacing-md) var(--spacing-lg);
    font-weight: 600;
    font-size: var(--font-size-lg);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--brand-primary);
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--brand-muted);
}

.card-text {
    font-size: var(--font-size-base);
}

/* Card variants with colored borders */
.card.border-primary {
    border-left: 4px solid var(--brand-primary);
}

.card.border-success {
    border-left: 4px solid var(--bs-success);
}

.card.border-info {
    border-left: 4px solid #0dcaf0;
}

.card.border-warning {
    border-left: 4px solid #ffc107;
}

.card.border-danger {
    border-left: 4px solid #dc3545;
}

/* Card Custom - for feature cards */
.card-custom {
    border: none;
    border-radius: var(--radius-xl);
}

.card-custom:hover {
    transform: translateY(-5px);
}

/* ==========================================================================
   5. Buttons - Larger, More Accessible
   ========================================================================== */
.btn {
    font-size: var(--font-size-base);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.25);
}

.btn-sm {
    font-size: var(--font-size-sm);
    padding: 0.5rem 1rem;
}

.btn-lg {
    font-size: var(--font-size-lg);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

.btn-success {
    background-color: var(--bs-success);
    border-color: var(--bs-success);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   6. Form Controls - Larger, Rounded, Better Accessibility
   ========================================================================== */
.form-control,
.form-select {
    font-size: var(--font-size-base);
    padding: 0.875rem 1rem;
    border: 2px solid var(--brand-border);
    border-radius: var(--radius-md);
    background-color: var(--surface-card);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 52px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--brand-muted);
    opacity: 0.7;
}

.form-control-sm {
    font-size: var(--font-size-sm);
    padding: 0.625rem 0.875rem;
    min-height: 42px;
}

.form-control-lg {
    font-size: var(--font-size-lg);
    padding: 1rem 1.25rem;
    min-height: 60px;
}

.form-label {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--brand-dark);
    margin-bottom: 0.5rem;
}

/* Input Groups */
.input-group {
    border-radius: var(--radius-md);
}

.input-group-text {
    font-size: var(--font-size-base);
    padding: 0.875rem 1rem;
    background-color: var(--brand-light);
    border: 2px solid var(--brand-border);
    border-radius: var(--radius-md);
    color: var(--brand-muted);
    font-weight: 500;
}

.input-group>.form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group>.input-group-text:first-child {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Checkboxes and Radios */
.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    border: 2px solid var(--brand-border);
    border-radius: var(--radius-sm);
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}

.form-check-label {
    font-size: var(--font-size-base);
    padding-left: 0.25rem;
}

/* ==========================================================================
   7. Number Input with Commas (JavaScript enhancement needed)
   ========================================================================== */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ==========================================================================
   8. Tables - Enhanced Readability
   ========================================================================== */
.table {
    font-size: var(--font-size-base);
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    font-weight: 600;
    color: var(--brand-primary);
    background-color: var(--brand-light);
    padding: 1rem;
    border-bottom: 2px solid var(--brand-border);
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--brand-border);
}

.table-striped>tbody>tr:nth-of-type(odd) {
    background-color: rgba(241, 245, 249, 0.5);
}

.table-hover>tbody>tr:hover {
    background-color: rgba(30, 58, 95, 0.05);
}

.table-sm th,
.table-sm td {
    padding: 0.75rem;
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   9. Alerts - Rounded and Modern
   ========================================================================== */
.alert {
    font-size: var(--font-size-base);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid var(--bs-success);
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-secondary {
    background-color: var(--brand-light);
    color: var(--brand-dark);
    border-left: 4px solid var(--brand-muted);
}

/* ==========================================================================
   10. Badges - Larger and More Visible
   ========================================================================== */
.badge {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-full);
}

/* ==========================================================================
   11. Dropdown Menus
   ========================================================================== */
.dropdown-menu {
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-sm);
}

.dropdown-item {
    font-size: var(--font-size-base);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--brand-light);
    color: var(--brand-primary);
}

.dropdown-item i {
    width: 1.5rem;
}

/* ==========================================================================
   12. Utility Classes
   ========================================================================== */
.text-primary {
    color: var(--brand-primary) !important;
}

.bg-light {
    background-color: var(--brand-light) !important;
}

.bg-white {
    background-color: var(--surface-card) !important;
}

.section-padding {
    padding-top: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
}

.shadow-card {
    box-shadow: var(--shadow-card);
}

.rounded-custom {
    border-radius: var(--radius-lg);
}

/* Feature Icon Circles */
.feature-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.feature-icon-sm {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* ==========================================================================
   13. Charts Container Styling
   ========================================================================== */
.chart-container {
    position: relative;
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.chart-container svg {
    max-width: 100%;
    height: auto;
}

/* SVG Chart Improvements */
svg text {
    font-family: var(--bs-font-sans-serif);
    font-size: 12px;
}

/* ==========================================================================
   14. Spinner / Loading States
   ========================================================================== */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.spinner-border-sm {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 0.2rem;
}

/* ==========================================================================
   15. Container Width Overrides
   ========================================================================== */
.container {
    max-width: 1200px;
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ==========================================================================
   16. Accessibility Improvements
   ========================================================================== */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-primary);
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* High contrast for important numbers */
.amount-display {
    font-family: 'Inter', system-ui, sans-serif;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   17. Print Styles
   ========================================================================== */
@media print {
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .btn,
    .navbar,
    footer {
        display: none;
    }
}

/* ==========================================================================
   18. Blazor Specific Overrides
   ========================================================================== */
#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: var(--shadow-lg);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 3px solid #ffc107;
    font-size: var(--font-size-base);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    font-size: 1.25rem;
}

/* ==========================================================================
   19. Responsive Typography
   ========================================================================== */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    h1,
    .h1 {
        font-size: 2rem;
    }

    h2,
    .h2 {
        font-size: 1.75rem;
    }

    h3,
    .h3 {
        font-size: 1.5rem;
    }

    .card-body {
        padding: var(--spacing-md);
    }

    .section-padding {
        padding-top: var(--spacing-lg);
        padding-bottom: var(--spacing-lg);
    }
}

/* ==========================================================================
   20. Animations
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.4s ease-out forwards;
}

/* ==========================================================================
   21. Chart Tooltip Styles
   ========================================================================== */
.chart-tooltip {
    position: absolute;
    display: none;
    background: rgba(30, 58, 95, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    pointer-events: none;
    max-width: 300px;
}

.chart-tooltip strong {
    color: var(--brand-accent-light);
}

/* ==========================================================================
   22. ApexCharts Customizations
   ========================================================================== */
.apexcharts-tooltip {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.apexcharts-tooltip-title {
    background: var(--brand-primary) !important;
    color: white !important;
    font-weight: 600 !important;
}

.apexcharts-legend-text {
    font-size: var(--font-size-sm) !important;
    font-weight: 500 !important;
}