/* -------------------------------------------------------------
   🎨 Premium "Emerald Glass" Visual System — MetricVault SARS Tax
   ------------------------------------------------------------- */

/* --- 1. Global Reset & Variables --- */
:root {
    --bg-dark: #040810;
    --bg-card: rgba(10, 20, 38, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Emerald/Teal Wealth Accent */
    --accent-emerald: #10b981; 
    --accent-emerald-glow: rgba(16, 185, 129, 0.35);
    --accent-teal: #14b8a6; /* Retirement */
    --accent-teal-glow: rgba(20, 184, 166, 0.3);
    --accent-uif: #06b6d4; /* UIF/Cyan */
    --accent-danger: #f43f5e; /* Tax outflow */
    
    --font-outfit: 'Outfit', sans-serif;
    --font-inter: 'Inter', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-inter);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- 2. Ambient Floating Mesh Backdrops --- */
.bg-glow {
    position: absolute;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    pointer-events: none;
    z-index: -1;
}
.glow-emerald {
    top: 8%;
    left: -150px;
    background-color: var(--accent-emerald);
}
.glow-teal {
    bottom: 12%;
    right: -150px;
    background-color: var(--accent-teal);
}

/* --- 3. Glassmorphic Panels --- */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}
.glass-panel:hover {
    border-color: rgba(16, 185, 129, 0.15);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.05);
}

/* --- 4. Premium App Header --- */
.app-header {
    background: rgba(4, 8, 16, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-logo {
    font-size: 32px;
    text-shadow: 0 0 15px var(--accent-emerald-glow);
}
.brand-text h1 {
    font-family: var(--font-outfit);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}
.brand-text .accent {
    color: var(--accent-emerald);
    text-shadow: 0 0 10px var(--accent-emerald-glow);
}
.brand-text p {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

/* --- 5. Custom Ad Slots --- */
.ad-slot {
    display: none; /* Hidden by default to hide raw placeholder text. Unhide if manual ad scripts are injected. */
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.ad-placeholder {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px;
}
.ad-leaderboard {
    width: 728px;
    height: 90px;
}
.ad-banner {
    width: 100%;
    max-width: 970px;
    height: 250px;
    margin: 40px auto;
}
.ad-square {
    width: 300px;
    height: 250px;
    margin-top: 24px;
}

/* --- 6. Breadcrumb Link --- */
.breadcrumb {
    margin: 24px 0;
}
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-smooth);
    display: inline-block;
}
.back-link:hover {
    color: var(--accent-emerald);
    transform: translateX(-4px);
}

/* --- 7. Responsive Calculator Workspace --- */
.calculator-wrapper {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    margin-bottom: 40px;
    align-items: start;
}

/* --- 8. Input Components & Ranges --- */
.panel-header {
    margin-bottom: 28px;
}
.panel-header h2 {
    font-family: var(--font-outfit);
    font-size: 26px;
    font-weight: 700;
}
.panel-header .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.input-group {
    margin-bottom: 28px;
}
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.input-group label {
    font-family: var(--font-outfit);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.input-numeric {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 6px 12px;
    transition: var(--transition-smooth);
}
.input-numeric:focus-within {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.currency-symbol, .suffix {
    font-family: var(--font-outfit);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
}
.input-numeric input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 16px;
    font-weight: 700;
    width: 90px;
    text-align: right;
    padding-right: 2px;
}
/* Hide number input spinners (Chrome, Safari, Edge, Opera) */
.input-numeric input::-webkit-outer-spin-button,
.input-numeric input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* Hide number input spinners (Firefox) */
.input-numeric input[type=number] {
    -moz-appearance: textfield;
}

/* Chrome-style sliders */
.custom-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    outline: none;
    transition: var(--transition-smooth);
}
.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 2px solid var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald-glow);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: var(--accent-emerald);
}
.range-teal::-webkit-slider-thumb {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px var(--accent-teal-glow);
}
.range-teal::-webkit-slider-thumb:hover {
    background: var(--accent-teal);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
}

/* Radio Tiles for Term/Period Selection */
.radio-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.age-tiles {
    grid-template-columns: repeat(3, 1fr);
}
.tile {
    cursor: pointer;
    text-align: center;
}
.tile input {
    display: none;
}
.tile span {
    display: block;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}
.tile input:checked + span {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-emerald);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

/* --- 9. Affiliate Offer Block --- */
.affiliate-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(10, 20, 38, 0.9));
    border-color: rgba(16, 185, 129, 0.15);
    margin-top: 40px;
    position: relative;
    overflow: hidden;
}
.affiliate-card .tag {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--accent-emerald);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-emerald);
}
.affiliate-card h4 {
    font-family: var(--font-outfit);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}
.affiliate-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}
.cta-btn {
    display: block;
    text-align: center;
    background: var(--text-primary);
    color: var(--bg-dark);
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}
.cta-btn:hover {
    background: var(--accent-emerald);
    color: var(--text-primary);
    box-shadow: 0 4px 20px var(--accent-emerald-glow);
    transform: translateY(-2px);
}

/* --- 10. Output Panels & Visualization --- */
.results-pane h3 {
    font-family: var(--font-outfit);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Donut Chart and Centered Text */
.chart-container {
    position: relative;
    width: 230px;
    height: 230px;
    margin: 0 auto 32px auto;
}
.chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}
.chart-center-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.chart-center-val {
    display: block;
    font-family: var(--font-outfit);
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Output Cards Grid */
.result-highlight-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}
.result-highlight-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.result-highlight-card .value {
    display: block;
    font-family: var(--font-outfit);
    font-size: 32px;
    font-weight: 800;
    color: var(--accent-emerald);
    margin-top: 4px;
    text-shadow: 0 0 20px var(--accent-emerald-glow);
}
.result-highlight-card .caption {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}
.bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.color-gross .bullet { background-color: var(--text-primary); }
.color-tax .bullet { background-color: var(--accent-danger); }
.color-uif .bullet { background-color: var(--accent-uif); }
.color-ra .bullet { background-color: var(--accent-teal); }

.item-value {
    font-family: var(--font-outfit);
    font-size: 16px;
    font-weight: 700;
}
.item-value.warning {
    color: var(--accent-danger);
}
.item-value.success {
    color: var(--accent-teal);
}

.breakdown-item.sub-item {
    border-top: 1px solid var(--border-glass);
    border-bottom: none;
    margin-top: 8px;
    padding-top: 16px;
}
.breakdown-item.sub-item .item-label {
    font-weight: 600;
    color: var(--text-primary);
}
.breakdown-item.sub-item .item-value.highlight {
    font-size: 18px;
    color: var(--accent-emerald);
    text-shadow: 0 0 10px var(--accent-emerald-glow);
}

/* Warnings and Alerts */
.custom-alert {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-radius: 16px;
    padding: 20px;
    margin-top: 24px;
    border: 1px solid transparent;
}
.custom-alert.success {
    background: rgba(20, 184, 166, 0.1);
    border-color: rgba(20, 184, 166, 0.25);
}
.alert-icon {
    font-size: 22px;
}
.alert-text strong {
    font-family: var(--font-outfit);
    font-size: 15px;
    color: var(--text-primary);
    display: block;
}
.alert-text p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 4px;
}

/* --- 11. SEO FAQ Section --- */
.faq-section {
    margin-top: 40px;
    margin-bottom: 60px;
}
.faq-section h2 {
    font-family: var(--font-outfit);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}
.faq-accordion details {
    border-bottom: 1px solid var(--border-glass);
    padding: 18px 0;
    cursor: pointer;
}
.faq-accordion details[open] {
    border-bottom-color: rgba(16, 185, 129, 0.2);
}
.faq-accordion summary {
    font-family: var(--font-outfit);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-accordion summary::-webkit-details-marker {
    display: none;
}
.faq-accordion summary::after {
    content: "+";
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}
.faq-accordion details[open] summary::after {
    content: "−";
    color: var(--accent-emerald);
}
.faq-accordion details p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 12px;
}

/* --- 12. Footer Architecture --- */
.app-footer {
    background: #020408;
    border-top: 1px solid var(--border-glass);
    padding: 48px 0 24px 0;
    font-size: 13px;
}
.footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 32px;
    margin-bottom: 32px;
}
.footer-brand {
    max-width: 400px;
}
.footer-brand h3 {
    font-family: var(--font-outfit);
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
}
.footer-brand h3 .accent {
    color: var(--accent-emerald);
}
.footer-brand p {
    color: var(--text-secondary);
    line-height: 1.6;
}
.footer-links {
    display: flex;
    gap: 24px;
}
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}
.footer-links a:hover {
    color: var(--accent-emerald);
}
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 24px;
    text-align: center;
    color: rgba(255, 255, 255, 0.25);
    font-size: 11px;
}

/* --- 13. System Utilities & Responsiveness --- */
.hidden {
    display: none !important;
}

@media (max-width: 992px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
    }
    .app-header .container {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    .ad-leaderboard {
        width: 100%;
        height: auto;
        min-height: 50px;
    }
    .ad-placeholder {
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .radio-tiles {
        grid-template-columns: 1fr;
    }
    .age-tiles {
        grid-template-columns: repeat(3, 1fr);
    }
    .footer-grid {
        flex-direction: column;
        gap: 24px;
    }
}
