:root {
    --primary-green: #10a37f;
    --dark-bg: #051619;
    --principal-green: #16a34a;
    --interest-orange: #f19120;
    --balance-crimson: #b11f44;
}

.calculator-container { max-width: 1200px; margin: 0 auto; padding: 20px; color: #333; }
.card { background: #fff; border-radius: 12px; box-shadow: 0 4px 25px rgba(0,0,0,0.08); padding: 25px; margin-bottom: 30px; }

/* Header Branding */
.calc-header h1 { color: var(--dark-bg); border-left: 5px solid var(--primary-green); padding-left: 15px; margin-bottom: 5px; }

/* Professional Inputs */
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; }
.tenure-input-row { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.tenure-input-row input { width: 80px; padding: 5px; border: 1px solid #ddd; border-radius: 4px; }

.slider { -webkit-appearance: none; width: 100%; height: 8px; border-radius: 5px; background: #ddd; accent-color: var(--primary-green); outline: none; }

/* Toggle Yr/Mo Buttons */
.unit-toggle { display: flex; background: #f0f0f0; padding: 3px; border-radius: 6px; }
.btn-unit { border: none; padding: 5px 15px; background: transparent; cursor: pointer; font-size: 13px; font-weight: bold; border-radius: 4px; }
.btn-unit.active { background: #fff; color: var(--primary-green); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

/* Table Headers - Matching image_b584ed.png */
.col-year { background-color: #d8dee3; color: #333 !important; }
.col-principal { background-color: var(--principal-green); color: #fff !important; }
.col-interest { background-color: var(--interest-orange); color: #fff !important; }
.col-total { background-color: #cbd5e1; color: #333 !important; }
.col-balance { background-color: var(--balance-crimson); color: #fff !important; }
.col-paid { background-color: #d1d5db; color: #333 !important; }

.emi-table th { padding: 15px; text-align: center; font-size: 13px; border: 1px solid #ddd; }
.emi-table td { padding: 12px; border: 1px solid #eee; text-align: right; }

/* Expandable Rows */
.year-row { background: #fdfdfd; font-weight: 700; cursor: pointer; }
.month-row { display: none; background: #ffffff; font-size: 13px; color: #666; }
.toggle-icon { margin-right: 8px; color: var(--primary-green); font-family: monospace; }

/* Enhanced Input UI for ToolWizardHub */
.label-row input[type="text"], 
.label-row input[type="number"],
.tenure-input-row input {
    height: 48px; /* Increased Height */
    font-size: 1.1rem;
    padding: 0 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-weight: 600;
}

/* Focus effect for better UX */
.label-row input:focus, 
.tenure-input-row input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

/* Increase Unit Toggle Height */
.unit-toggle {
    display: flex;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
    height: 48px; /* Matching input height */
    align-items: center;
}

.btn-unit {
    height: 100%;
    padding: 0 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-unit.active {
    background: #ffffff;
    color: var(--primary-green);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Tenure Label Alignment */
#tenure-label-unit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 15px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 600;
    color: #4b5563;
}

.tenure-input-row {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Mobile Optimization */
@media (max-width: 991px) {
    .main-grid { grid-template-columns: 1fr; }
    .table-responsive { overflow-x: auto; }
}

/* ToolWizardHub EMI Calculator Stylesheet */
:root {
    --primary-navy: #0f172a;
    --secondary-slate: #1e293b;
    --accent-blue: #38bdf8;
    --success-green: #10b981;
    --danger-red: #b11f44;
    --light-bg: #f8fafc;
    --white: #ffffff;
}

.seo-wrapper {
    background-color: var(--white);
    color: #333;
    line-height: 1.8;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.disclaimer-card {
    border: 1px solid #fee2e2;
    border-left: 6px solid var(--danger-red);
    background: #fffafb;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.disclaimer-title {
    color: var(--danger-red);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.seo-header {
    background: linear-gradient(145deg, var(--primary-navy), var(--secondary-slate));
    color: var(--white);
    padding: 4rem 2rem;
    border-radius: 16px;
    margin-bottom: 3.5rem;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.seo-header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #f8fafc;
}

.seo-header p {
    color: var(--accent-blue);
    font-size: 1.3rem;
    max-width: 800px;
    margin: 0 auto;
}

.info-section {
    margin-bottom: 4rem;
}

.info-section h2 {
    font-weight: 700;
    color: var(--secondary-slate);
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.instruction-step {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.step-number {
    background: var(--accent-blue);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.formula-display {
    background: var(--white);
    border: 2px dashed var(--success-green);
    border-radius: 15px;
    padding: 2.5rem;
    margin: 2rem 0;
    text-align: center;
    overflow-x: auto;
}

.formula-math {
    color: #065f46;
    font-size: 2rem;
    font-weight: bold;
}

.scenario-box {
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1.5rem;
}

.optimistic {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 5px solid var(--success-green);
}

.pessimistic {
    background: #fff7ed;
    border: 1px solid #ffedd5;
    border-left: 5px solid #f97316;
}

.feature-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 2rem;
}

.feature-tag {
    background: #e2e8f0;
    color: #475569;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

.example-table {
    margin: 2rem 0;
}

.example-table thead {
    background: var(--secondary-slate);
    color: var(--white);
}

@media (min-width: 992px) { .main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; } }

/* --- Global Variables & Resets --- */
:root {
    --primary-navy: #0f172a;
    --secondary-slate: #1e293b;
    --accent-blue: #38bdf8;
    --success-green: #10b981;
    --danger-red: #b11f44;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --text-main: #334155;
    --border-color: #e2e8f0;
}

/* --- Layout Enhancements --- */
.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 992px) {
    .main-grid {
        grid-template-columns: 1.2fr 0.8fr;
    }
}

/* --- SEO & Content Styling --- */
.seo-content-wrapper {
    background-color: var(--white);
    color: var(--text-main);
    line-height: 1.8;
    font-family: 'Inter', sans-serif;
    padding-top: 50px;
}

.disclaimer-card {
    border: 1px solid #fee2e2;
    border-left: 6px solid var(--danger-red);
    background: #fffafb;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.disclaimer-title {
    color: var(--danger-red);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.hero-header {
    background: linear-gradient(135deg, var(--primary-navy) 0%, var(--secondary-slate) 100%);
    color: var(--white);
    padding: 5rem 2rem;
    border-radius: 16px;
    margin-bottom: 4rem;
    text-align: center;
}

.hero-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.hero-header p {
    color: var(--accent-blue);
    font-size: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.article-section {
    margin-bottom: 5rem;
}

.article-section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-navy);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 10px;
}

.article-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent-blue);
}

.formula-card {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    margin: 3rem 0;
    border: 1px solid var(--border-color);
}

.formula-math {
    font-size: 2.5rem;
    color: var(--primary-navy);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.pro-tip {
    background: #eff6ff;
    border-left: 4px solid var(--accent-blue);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.faq-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 10px;
    transition: transform 0.2s;
}

.faq-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* --- Optimized & High-Contrast Hero Header --- */
.hero-header {
    background: #0f172a; /* Solid dark color for maximum reliability */
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    padding: 2.5rem 1.25rem; /* Better spacing for mobile */
    border-radius: 16px;
    text-align: center;
    margin: 20px auto;
    max-width: 100%;
    box-sizing: border-box;
}

.hero-header h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem); /* Scalable font */
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #ffffff !important;
}

.hero-header p {
    font-size: 1rem;
    color: #38bdf8 !important; /* Brighter blue for visibility */
    max-width: 700px;
    margin: 0 auto 1.5rem auto;
    line-height: 1.5;
}

/* --- Responsive Pills that won't break on Mobile --- */
.feature-pill-container {
    display: flex;
    flex-wrap: wrap; /* Allows wrapping on small screens */
    gap: 10px;
    justify-content: center;
    padding: 0 10px;
}

.feature-pill {
    /* Use a dark background with white text or vice versa for visibility */
    background: #ffffff !important; 
    color: #0f172a !important; 
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    white-space: normal; /* Allows text to wrap inside the pill if very narrow */
}

/* Desktop Refinement */
@media (min-width: 768px) {
    .hero-header { padding: 4rem 2rem; }
    .feature-pill { font-size: 0.95rem; }
}


/* --- Legal Disclaimer Styling --- */
.disclaimer-card {
    border: 1px solid #fee2e2;
    border-left: 6px solid #b11f44; /* High-visibility warning red */
    background-color: #fffafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 100%;
    box-sizing: border-box;
}

.disclaimer-title {
    color: #b11f44;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.disclaimer-body {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #4b5563; /* Dark slate gray for readability */
}

.disclaimer-body p {
    margin-bottom: 0.8rem;
}

.disclaimer-body p:last-child {
    margin-bottom: 0;
}

/* --- Mobile Specific Refinements --- */
@media (max-width: 600px) {
    .disclaimer-card {
        padding: 1rem;
        margin: 1rem auto;
    }
    
    .disclaimer-title {
        font-size: 0.8rem;
    }
    
    .disclaimer-body {
        font-size: 0.8rem;
    }
}


/* --- OPTIMIZED MOBILE FIXES --- */

@media (max-width: 768px) {
    /* 1. Prevent the whole page from shaking or scrolling horizontally */
    .calculator-container {
        padding: 10px;
        width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* 2. Fix the Input Panel overlapping issues */
    .input-panel.card {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Fix the specific label/input row showing in image_d0bc07.png */
    .label-row {
        display: flex;
        flex-direction: column !important; /* Force stack on mobile */
        align-items: flex-start !important;
        gap: 8px;
        margin-bottom: 15px;
    }

    /* Make input boxes full width so they don't cut off */
    .label-row input[type="text"], 
    .label-row input[type="number"] {
        width: 100% !important;
        max-width: 100% !important;
        height: 48px;
        box-sizing: border-box;
    }

    /* 3. Fix the Tenure row (Input + Yr/Mo label) */
    .tenure-input-row {
        display: grid;
        grid-template-columns: 1fr 60px; /* Gives specific space for the 'Yr' box */
        gap: 10px;
        width: 100%;
    }

    .tenure-input-row input {
        width: 100% !important;
    }

    /* 4. Fix Summary Stats and Pie Chart (image_d0bc2e.png) */
    .summary-panel {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .summary-stats {
        width: 100%;
        margin-bottom: 20px;
    }

    .stat-box h2, .stat-box h3 {
        font-size: 1.5rem !important; /* Makes large numbers fit on one line */
    }

    /* 5. THE CENTERED PIE CHART FIX - FORCING SQUARE RATIO */
    .chart-container {
        width: 100% !important;
        max-width: 280px; 
        /* Use aspect-ratio to ensure it remains a perfect square */
        aspect-ratio: 1 / 1 !important; 
        height: auto !important; /* Let aspect-ratio handle height */
        margin: 20px auto !important; 
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative; /* Necessary for Chart.js responsive sizing */
    }

    /* Force the canvas to fill the square container exactly */
    canvas#emiPieChart {
        width: 100% !important;
        height: 100% !important;
        display: block;
    }
}

/* Fix for the Hero Header display in image_c47de5.png */
@media (max-width: 600px) {
    .hero-header {
        padding: 2rem 1rem !important;
    }

    .hero-header h1 {
        font-size: 1.6rem !important;
        line-height: 1.3;
    }

    .feature-pill-container {
        flex-direction: column;
        align-items: center;
    }

    .feature-pill {
        width: 90%; /* Stops pills from being too wide */
        text-align: center;
    }
}

/* For Export Buttons  */
/* Container for alignment */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Professional Export Buttons */
.btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
}

.btn-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* PDF Specific (Red Accent) */
.btn-pdf:hover {
    background-color: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.1);
}

/* Excel Specific (Green Accent) */
.btn-excel:hover {
    background-color: #f0fdf4;
    border-color: #22c55e;
    color: #15803d;
    box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.1);
}

.btn-export:active {
    transform: translateY(1px);
}

/* ===============================
   HERO CONTENT STACK FIX (MOBILE)
   =============================== */
@media (max-width: 600px) {

    .hero-header {
        display: block !important;   /* kill flex/grid leakage */
        text-align: center;
    }

    .hero-header h1,
    .hero-header p,
    .feature-pill-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .hero-header p {
        padding: 0 8px;              /* prevent text clipping */
        word-break: break-word;
    }

    /* FORCE pills to appear */
    .feature-pill-container {
        display: flex !important;
        flex-direction: column;      /* stack pills vertically */
        gap: 8px;
        margin-top: 16px;
    }

    .feature-pill {
        width: 100%;
        max-width: 100%;
        text-align: center;
        white-space: normal;
    }
}

/* --- FINAL MOBILE PILL EDGE FIX --- */
@media (max-width: 600px) {

    .feature-pill-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box;
    }

    .feature-pill {
        width: 90% !important;
        max-width: calc(100% - 8px); /* small inner gap */
        margin: 0 auto;
    }
}

