/* Premium Bonds Calculator - Corporate Professional Design */

/* CSS Variables - Corporate Color System */
:root {
    /* Primary Corporate Blue */
    --primary: #003366;
    --primary-light: #004080;
    --primary-dark: #002244;
    --primary-subtle: #f0f4f8;
    
    /* Neutral Grays */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    
    /* Semantic Colors */
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --info: #0284c7;
    
    /* Layout */
    --max-width: 1280px;
    --header-height: 80px;
    
    /* Typography - System Font Stack */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    /* Shadows - Subtle and Professional */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
    
    /* Borders */
    --border-color: #e5e7eb;
    --border-radius: 4px;
}

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

/* Base */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--gray-50);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--gray-900);
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--gray-700);
    line-height: 1.625;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 150ms ease;
}

a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Header */
header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 400;
    margin-top: 0.25rem;
}

/* Navigation */
nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

nav a {
    color: var(--gray-700);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 150ms ease;
}

nav a:hover {
    color: var(--primary);
    text-decoration: none;
    border-bottom-color: var(--primary);
}

nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    transition: background 150ms ease;
    border: none;
    cursor: pointer;
}

.nav-button:hover {
    background: var(--primary-light);
    text-decoration: none;
}

/* Main Layout */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 2rem;
    min-height: calc(100vh - var(--header-height) - 200px);
}

/* Container Components */
.container {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: white;
    transition: all 150ms ease;
    font-family: var(--font-primary);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.05);
}

.input-large {
    font-size: 1.25rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    text-align: center;
}

/* Investment Input */
#investmentInput {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

#investmentInput h2 {
    font-size: 1.125rem;
    color: var(--gray-700);
    font-weight: 500;
    margin-bottom: 1rem;
}

.input-wrapper {
    max-width: 300px;
    margin: 0 auto;
    position: relative;
}

.currency-symbol {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 1.25rem;
    pointer-events: none;
}

.investment-input {
    padding-left: 2.5rem;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

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

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-mono);
    letter-spacing: -0.025em;
}

.stat-description {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

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

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

.data-table .font-mono {
    font-family: var(--font-mono);
}

.data-table .highlight {
    background: var(--primary-subtle);
    font-weight: 600;
}

/* Charts */
.chart-container {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

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

.chart svg {
    width: 100%;
    height: 100%;
}

.chart .axis {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.chart .axis line,
.chart .axis path {
    stroke: var(--gray-200);
}

.chart .bar {
    fill: var(--primary);
    opacity: 0.8;
    transition: opacity 150ms ease;
}

.chart .bar:hover {
    opacity: 1;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 150ms ease;
    font-family: var(--font-primary);
}

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

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

.btn-secondary {
    background: white;
    color: var(--primary);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-group {
    display: inline-flex;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--gray-300);
}

.btn-group .btn {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--gray-300);
}

.btn-group .btn:last-child {
    border-right: none;
}

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

/* Toggle Buttons */
.toggle-group {
    display: inline-flex;
    background: var(--gray-100);
    padding: 0.125rem;
    border-radius: var(--border-radius);
}

.toggle-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: calc(var(--border-radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 150ms ease;
}

.toggle-btn:hover {
    color: var(--gray-900);
}

.toggle-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Information Panels */
.info-panel {
    background: var(--primary-subtle);
    border: 1px solid var(--primary);
    border-left-width: 4px;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.info-panel-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.info-panel-text {
    color: var(--gray-700);
    font-size: 0.875rem;
}

/* Alert Messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fed7aa;
    color: #92400e;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* Footer */
footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
}

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

.footer-links a {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--primary);
}

/* Support Button */
.support-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 150ms ease;
    text-decoration: none;
    z-index: 50;
}

.support-btn:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.support-btn svg {
    width: 24px;
    height: 24px;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

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

/* Tooltips */
.tooltip {
    position: absolute;
    background: var(--gray-900);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--gray-900);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-600); }

.bg-primary { background-color: var(--primary); }
.bg-success { background-color: var(--success); }
.bg-error { background-color: var(--error); }
.bg-warning { background-color: var(--warning); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }

/* Responsive Design */
@media (max-width: 768px) {
    h1 { font-size: 1.875rem; }
    h2 { font-size: 1.25rem; }
    
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    nav {
        width: 100%;
        justify-content: space-between;
    }
    
    main {
        padding: 2rem 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }
    
    .support-btn {
        width: 48px;
        height: 48px;
        bottom: 1rem;
        right: 1rem;
    }
}

/* Print Styles */
@media print {
    header, footer, nav, .support-btn {
        display: none;
    }
    
    main {
        padding: 0;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        break-inside: avoid;
    }
}

/* Accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
