/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --brand-primary: #1DAA61;
    --brand-light: #4cbf7c;
    --brand-soft: #e8f5e9;
    --brand-subtle: rgba(29, 170, 97, 0.08);
    --dark: #0f172a;
    --gray-dark: #1e293b;
    --gray: #475569;
    --gray-medium: #94a3b8;
    --gray-light: #f1f5f9;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 30px -12px rgba(0,0,0,0.1);
    --radius: 20px;
    --radius-sm: 12px;
}

body {
    background: var(--gray-light);
    color: var(--dark);
    line-height: 1.5;
}

.calc-hero {
    background: linear-gradient(135deg, #082616, #020805);
    color: #ffffff;
    padding: 36px 24px 0;
    border-radius: 18px;
    margin: 28px auto;
    width: 92%;
    max-width: 1400px;
    position: relative;
    overflow: hidden;
}

/* subtle glow */
.calc-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.15), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.12), transparent 40%);
    pointer-events: none;
}

.calc-hero__inner {
    max-width: 760px;
    padding-bottom: 26px;
}

/* Title */

.calc-hero__title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

/* Subheading */

.calc-hero__subtitle {
    font-size: 15.5px;
    opacity: 0.92;
    line-height: 1.5;
}

/* =================================
   TABS — ATTACHED TO HERO
================================= */

.calc-hero__tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #ffffff;

    border-radius: 16px 16px 0 0;

    position: relative;
    top: 1px; /* visually merges with content */

    overflow-x: auto;
    scrollbar-width: none;
}

.calc-hero__tabs::-webkit-scrollbar {
    display: none;
}

.calc-hero__tabs a {
    text-decoration: none;
}

/* Individual tab */

.tab {
    border: none;
    background: transparent;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;

    transition: all .18s ease;
}

/* Hover */

.tab:hover {
    background: #f3f4f6;
}

/* Active */

.tab.active {
    background: #1daa61;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(29,170,97,0.35);
}

/* Main Wrapper */
.sip-calculator-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Hero Section */
.calculator-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--brand-subtle);
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hero-title-main {
    color: var(--dark);
}

.hero-title-accent {
    background: var(--brand-gradient, linear-gradient(135deg, var(--brand-primary), var(--brand-light)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.hero-title-accent::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--brand-subtle);
    border-radius: 3px;
    z-index: -1;
}

.hero-subtitle {
    color: var(--gray);
    font-size: 1rem;
    max-width: 500px;
}

/* Main Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
}

/* Left Panel */
.input-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    height: fit-content;
    position: sticky;
    top: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.panel-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.75rem;
    background: var(--brand-soft);
    color: var(--brand-primary);
    border-radius: 20px;
    font-weight: 500;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-bottom: 2rem;
}

.input-field {
    width: 100%;
}

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-dark);
}

.field-amount {
    color: var(--brand-primary);
    font-weight: 600;
}

.field-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--gray-light);
    color: var(--dark);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.field-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--brand-subtle);
}

.field-slider {
    width: 100%;
    margin: 0.25rem 0;
}

.field-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--gray-medium);
    margin-top: 0.25rem;
}

/* Range Slider — base only */
input[type=range] {
    width: 100%;
    height: 4px;
    background: var(--gray-light); /* fallback */
    border-radius: 2px;
    outline: none;
}

/* Thumb — keep this */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--brand-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--brand-primary);
    cursor: pointer;
}

/* Inflation Toggle */
.inflation-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--brand-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 0.5rem;
}

.inflation-toggle input {
    display: none;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: rgba(0,0,0,0.1);
    border-radius: 30px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-indicator {
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

input:checked + .toggle-track {
    background: var(--brand-primary);
}

input:checked + .toggle-track .toggle-indicator {
    left: 22px;
}

.toggle-label {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.toggle-label strong {
    font-size: 0.9rem;
    color: var(--dark);
}

.toggle-label small {
    font-size: 0.7rem;
    color: var(--gray);
}

/* Quick Result */
.quick-result {
    background: var(--brand-gradient, linear-gradient(135deg, var(--brand-primary), var(--brand-light)));
    color: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 1rem;
}

.quick-result strong {
    font-size: 2rem;
    display: block;
    margin: 0.25rem 0;
}

.result-placeholder {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Right Panel */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Result Card */
.result-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.main-result {
    background: linear-gradient(145deg, var(--white), var(--gray-light));
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.result-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray);
}

.result-badge {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--brand-soft);
    padding: 0.4rem 1rem;
    border-radius: 40px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stats-grid div {
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-light);
}

.stats-grid strong {
    display: block;
    font-size: 1.1rem;
    color: var(--dark);
    margin-top: 0.25rem;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
}

.chart-card.full-width {
    grid-column: span 2;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.chart-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.chart-card-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    background: var(--gray-light);
    border-radius: 20px;
    color: var(--gray);
}

.chart-container {
    position: relative;
    width: 100%;
}

.donut-container {
    height: 200px;
}

.line-container {
    height: 240px;
}

/* FAQ Compact */
.faq-compact {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.faq-compact-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
}

.faq-compact-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.faq-compact-item {
    padding: 0.75rem;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
}

.faq-q {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.faq-a {
    font-size: 0.75rem;
    color: var(--gray);
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .input-panel {
        position: static;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card.full-width {
        grid-column: span 1;
    }
    
    .faq-compact-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .calculator-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .hero-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .faq-compact-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart.js Customization */
.chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(2px);
    border-radius: inherit;
}

/* Error States */
.error-message {
    color: #dc2626;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
}

/* Utility Classes */
.text-brand { color: var(--brand-primary); }
.bg-soft { background: var(--brand-soft); }

/* ===== MAIN DONUT IN RESULT CARD ===== */

.main-donut {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.25rem auto;
    position: relative;
}

.main-donut canvas {
    width: 100% !important;
    height: 100% !important;
}