/* ===================================
   SAVINGS CALCULATOR STYLES
   UK-Focused Professional Design
   CalcTechLab
   =================================== */

/* Calculator Container */
.savings-calculator-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

/* ===================================
   HEADER
   =================================== */

.calculator-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    padding: 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.calculator-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.header-icon {
    margin-bottom: 1rem;
}

.header-icon svg {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.header-content .subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 500;
    margin-bottom: 1rem;
}

.header-description {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

.uk-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 1rem;
}

/* ===================================
   CURRENCY SELECTOR
   =================================== */

.currency-bar {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.currency-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.currency-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.currency-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
}

.currency-btn:hover {
    border-color: var(--brand-primary);
    background: var(--bg-tertiary);
}

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

/* ===================================
   TABS
   =================================== */

.calculator-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 3px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.calculator-tabs::-webkit-scrollbar {
    height: 4px;
}

.calculator-tabs::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 2px;
}

.tab-btn {
    flex: 1;
    min-width: 160px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(27, 94, 32, 0.05);
    color: var(--brand-primary);
}

.tab-btn.active {
    background: white;
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.tab-btn .tab-icon {
    margin-right: 0.5rem;
}

/* ===================================
   TAB CONTENT
   =================================== */

.tab-content {
    padding: 2rem 1.5rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ===================================
   CALCULATOR GRID
   =================================== */

.calculator-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ===================================
   INPUT SECTION
   =================================== */

.input-section {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.input-section h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    width: 24px;
    height: 24px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group label .info-icon {
    cursor: help;
    opacity: 0.6;
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

.form-group label .info-icon:hover {
    opacity: 1;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .currency-symbol {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-wrapper input[type="number"],
.input-wrapper input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    padding-left: 28px;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.form-group input[type="number"]:not(.input-wrapper input),
.form-group input[type="text"]:not(.input-wrapper input),
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.form-group .unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.9rem;
    pointer-events: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.field-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-style: normal;
    display: none;
}

.form-group:hover .field-note,
.form-group:focus-within .field-note {
    display: block;
}

/* ===================================
   ADVANCED OPTIONS
   =================================== */

.advanced-options {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--border-color);
}

.advanced-toggle {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin: 0 auto;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced-toggle:hover {
    color: var(--text-primary);
}

.advanced-content {
    display: none;
    margin-top: 1rem;
}

.advanced-content.show {
    display: block;
}

/* ===================================
   CALCULATE BUTTON
   =================================== */

.calculate-btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(27, 94, 32, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculate-btn .btn-icon {
    font-size: 1.3rem;
}

/* ===================================
   RESULTS SECTION
   =================================== */

.results-section {
    background: var(--bg-card);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    display: none;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.results-section.show {
    display: block;
}

.results-section h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Primary Result Card */
.primary-result {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.primary-result h3 {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.primary-result .big-number {
    font-size: 3rem;
    font-weight: 700;
    margin: 1rem 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.primary-result .result-label {
    font-size: 0.95rem;
    opacity: 0.85;
}

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

.result-card {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    text-align: center;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.result-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.result-card h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.result-card .number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0.75rem 0;
}

.result-card .small-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ISA-specific styling */
.isa-result {
    border-color: var(--isa);
}

.isa-result .number {
    color: var(--isa);
}

/* ===================================
   CHARTS
   =================================== */

.chart-section {
    margin-top: 2rem;
}

.chart-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.chart-tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-tab-btn:hover {
    color: var(--brand-primary);
}

.chart-tab-btn.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    height: 400px;
    position: relative;
}

.chart-panel {
    display: none;
}

.chart-panel.active {
    display: block;
}

/* ===================================
   BREAKDOWN TABLE
   =================================== */

.breakdown-section {
    margin-top: 2rem;
}

.breakdown-section h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.breakdown-table thead {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
}

.breakdown-table th,
.breakdown-table td {
    padding: 1rem;
    text-align: left;
}

.breakdown-table th {
    font-weight: 600;
    font-size: 0.9rem;
}

.breakdown-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.breakdown-table tbody tr:hover {
    background: var(--bg-tertiary);
}

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

.breakdown-table td {
    font-size: 0.95rem;
}

.breakdown-table .number {
    font-weight: 600;
    color: var(--brand-primary);
}

/* ===================================
   ACTION BUTTONS
   =================================== */

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--brand-primary);
    color: var(--brand-primary);
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

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

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

.action-btn.primary:hover {
    background: var(--text-primary);
}

/* ===================================
   PRESET SCENARIOS
   =================================== */

.preset-section {
    margin-bottom: 2rem;
}

.preset-section h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.preset-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.preset-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.preset-card h4 {
    color: var(--brand-primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.preset-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.preset-card .preset-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.preset-card .isa-badge {
    display: inline-block;
    background: var(--isa);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.75rem;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .input-section {
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.75rem;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
    }
    
    .header-content .subtitle {
        font-size: 1rem;
    }
    
    .calculator-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        min-width: auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .result-grid {
        grid-template-columns: 1fr;
    }
    
    .primary-result .big-number {
        font-size: 2.5rem;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .preset-grid {
        grid-template-columns: 1fr;
    }
    
    .currency-selector {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .primary-result .big-number {
        font-size: 2rem;
    }
    
    .breakdown-table {
        font-size: 0.85rem;
    }
    
    .breakdown-table th,
    .breakdown-table td {
        padding: 0.75rem;
    }
}

/* ===================================
   LOADING STATE
   =================================== */

.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--brand-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .calculator-header,
    .calculator-tabs,
    .input-section,
    .action-buttons,
    .currency-bar {
        display: none;
    }
    
    .container {
        box-shadow: none;
    }
    
    .results-section {
        display: block !important;
    }
}
/* ===================================
   TABLE COLOR CODING (2025/2026)
   =================================== */

/* Alternating row colors for better readability */
.even-row {
    background-color: #f8f9fa;
}

.odd-row {
    background-color: #ffffff;
}

.even-row:hover,
.odd-row:hover {
    background-color: #e8f5e9;
    transition: background-color 0.2s ease;
}

/* Color-coded cells for different metrics */
.balance-cell {
    color: #2E7D32;
    font-weight: 600;
}

.deposits-cell {
    color: #1976D2;
    font-weight: 500;
}

.interest-cell {
    color: #F57C00;
    font-weight: 500;
}

.bonus-cell {
    color: #7B1FA2;
    font-weight: 500;
}

.allowance-cell {
    color: #0288D1;
    font-weight: 500;
}

/* Enhanced table styling */
.breakdown-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.breakdown-table tbody tr:last-child {
    border-bottom: 2px solid #2E7D32;
}

/* ===================================
   TOOLTIPS
   =================================== */

.info-tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    visibility: hidden;
    background-color: var(--text-primary);
    color: var(--bg-card);
    text-align: left;
    border-radius: 6px;
    padding: 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    min-width: 250px;
    max-width: 400px;
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-primary) transparent transparent transparent;
}

.info-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}
