/* Reset and Base Styles */ /* added to ensure the github repo was aligned */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1em;
    opacity: 0.9;
}

/* Wallet Section */
.wallet-section {
    padding: 15px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wallet-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.wallet-info span {
    color: #333;
}

.wallet-info strong {
    color: #667eea;
    font-family: monospace;
}

/* Status Messages */
.status-message,
.error-message {
    padding: 12px 40px;
    margin: 0;
}

.status-message {
    background: #d4edda;
    color: #155724;
    border-bottom: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border-bottom: 1px solid #f5c6cb;
}

.hidden {
    display: none !important;
}

/* Main Content */
.main-content {
    padding: 30px 40px;
}

/* Form Section */
.form-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-section h3 {
    color: #555;
    font-size: 1.1em;
    margin: 20px 0 10px 0;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.form-section h3:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Form Grid Layouts */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px 20px;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px 20px;
}


/* Two-column layout for Pension & Income (responsive) */
.pension-income-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }

    .pension-income-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Stack fields vertically on mobile (inside pension/income entries) */
    .pension-entry > div[style*="grid-template-columns"],
    .income-entry > div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .pension-entry .form-group,
    .income-entry .form-group {
        width: 100% !important;
    }

    }

/* Form Group - Compact */
.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: #555;
    font-weight: 500;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Info Badge */
.info-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
}

.info-text {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
    font-style: italic;
}

/* Benefit Calculator Box */
.benefit-box {
    background: #f0f4ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.benefit-box h4 {
    color: #667eea;
    font-size: 0.95em;
    margin-bottom: 10px;
}

.benefit-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.benefit-info:last-child {
    margin-bottom: 0;
}

.benefit-label {
    color: #555;
    font-size: 0.9em;
}

.benefit-value {
    font-weight: 600;
    color: #667eea;
    font-size: 1em;
}

/* Buttons */
.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Action Button Styles - Retirement Planning */
.btn-action {
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: block;
}

.btn-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-free {
    background: #6c757d;
    color: white;
}

.btn-free:hover:not(:disabled) {
    background: #5a6268;
}

.btn-enhanced {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-enhanced:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-batch {
    background: #28a745;
    color: white;
}

.btn-batch:hover:not(:disabled) {
    background: #218838;
}

.btn-subtitle {
    display: block;
    font-size: 0.85em;
    opacity: 0.9;
    margin-top: 4px;
    font-weight: 400;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* Results Section */
.results-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 3px solid #e0e0e0;
}

.results-section h2 {
    color: #333;
    margin-bottom: 25px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.summary-card h3 {
    font-size: 0.9em;
    margin-bottom: 8px;
    opacity: 0.9;
}

.big-number {
    font-size: 2em;
    font-weight: bold;
}

/* Account Breakdown Summary */
.account-summary {
    margin: 20px 0;
}

.account-summary h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.account-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e8e8e8;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.account-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.account-card h4 {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.account-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
    margin: 0;
}

/* Recommendations and Warnings */
.recommendations,
.warnings {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.recommendations h3,
.warnings h3 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.recommendations ul,
.warnings ul {
    list-style: none;
    padding-left: 0;
}

.recommendations li,
.warnings li {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-size: 0.9em;
}

.warnings {
    background: #fff3cd;
}

.warnings li {
    border-left-color: #ffc107;
}

/* Chart */
.chart-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    height: 400px;
}

.chart-container h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Tax Mode Selector Styles */
.tax-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-option:hover {
    border-color: #4CAF50;
    background-color: #f9f9f9;
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #4CAF50;
    font-weight: 600;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #4CAF50;
    background-color: #f0f8f0;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.radio-label strong {
    font-size: 16px;
}

.info-box {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 16px;
    border-radius: 4px;
    margin-top: 12px;
}

.info-box p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

/* Mode Toggle Styles */
.mode-toggle-container {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.mode-option {
    padding: 15px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
}

.mode-option:hover {
    border-color: #0066cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
}

.mode-option.active {
    border-color: #0066cc;
    background: #e7f3ff;
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mode-label strong {
    font-size: 16px;
    color: #212529;
}

.mode-description {
    font-size: 13px;
    color: #6c757d;
}

/* Batch mode specific sections (hidden by default) */
.batch-only {
    display: none;
}

.batch-mode .batch-only {
    display: block;
}

.batch-mode .free-only {
    display: none;
}

/* ===== BATCH MODE CONTROLS ===== */

.batch-controls {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-left: 0;
    margin-right: auto;
    /* Force left alignment */
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Override any parent centering when form-group contains batch controls */
.form-group:has(.batch-controls) {
    text-align: left;
    display: block;
}

.form-group .batch-controls {
    margin-left: 0 !important;
    margin-right: auto !important;
}


.batch-range-header {
    margin-bottom: 0.75rem;
    text-align: left;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.batch-enable-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    white-space: nowrap;
}

.batch-enable {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer;
    flex-shrink: 0;
}

.batch-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.range-input-group {
    display: flex;
    flex-direction: column;
}

.range-input-group label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.batch-min,
.batch-max {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.batch-min:focus,
.batch-max:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Hide original inputs in batch mode */
.batch-mode input[data-batch-field] {
    display: none;
}


/* ===== BATCH SCENARIO COUNTER ===== */

.batch-scenario-counter {
    margin: 1.5rem 0;
    display: none; /* Hidden by default, shown in batch mode */
}

.counter-status {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.counter-status.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.counter-status.blocked {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #333;
}

.counter-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.counter-icon {
    font-size: 2rem;
}

.counter-details {
    flex: 1;
}

.counter-primary {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.counter-separator {
    opacity: 0.6;
}

.counter-secondary {
    font-size: 0.9rem;
    opacity: 0.9;
}

.counter-warning {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.counter-info {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    opacity: 0.9;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 0.75rem;
}

.counter-status.blocked .counter-info {
    border-top-color: rgba(0,0,0,0.1);
}



/* ===== Multiple Pensions & Properties Styles ===== */

.income-entry,
.pension-entry,
.property-entry {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #8e44ad;
}

/* Income entries - blue border instead of purple */
.income-entry {
    border-left: 4px solid #2196f3;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
}


.pension-header,
.property-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pension-header h4,
.property-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #495057;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-remove:hover {
    background: #c82333;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    background: #5a6268;
}

#pensionsContainer,
#propertiesContainer {
    margin-bottom: 1rem;
}

/* Information tooltip icons */
.info-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background: #2196f3;
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 12px;
    line-height: 18px;
    cursor: help;
    font-weight: bold;
    vertical-align: middle;
}

.info-icon:hover {
    background: #1976d2;
    transform: scale(1.1);
    transition: all 0.2s ease;
}
