:root {
    /* Light Mode Colors */
    --bg-primary: #f5f7fb;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;
    --accent: #06b6d4;
    --border: #e2e8f0;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    --ad-bg: #f8fafc;
    --ad-border: #cbd5e1;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 20px;
    --radius-md: 12px;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #0b0f19;
    --bg-card: #151d30;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #6366f1;
    --primary-light: #1e293b;
    --primary-dark: #4f46e5;
    --accent: #22d3ee;
    --border: #1e293b;
    --shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    --ad-bg: #1e293b;
    --ad-border: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

header {
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dark/Light mode Toggle */
.theme-toggle {
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    padding: 0.6rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    color: var(--text-primary);
}
.theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}
.theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }

/* Main Container */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 3rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Ad slots styling - Premium and Non-Intrusive */
.ad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ad-bg);
    border: 1px dashed var(--ad-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 0.5rem 0;
    position: relative;
    min-height: 100px;
    overflow: hidden;
}
.ad-container::before {
    content: "SPONSORED";
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 700;
}
.ad-top {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 0 auto;
}
.ad-bottom {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 1.5rem auto 0 auto;
}
.ad-sidebar {
    width: 100%;
    min-height: 250px;
    margin-top: 1rem;
}

/* Prevent Google AdSense elements from collapsing inside flex containers */
.adsbygoogle {
    width: 100% !important;
    display: block;
}

/* Page Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}
@media (min-width: 992px) {
    .layout-grid {
        grid-template-columns: 450px 1fr;
    }
}

/* Card panels */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 2.25rem;
    transition: var(--transition);
}
.card:hover {
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.1);
}

/* Title & Headers */
h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* Forms styles */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}
input[type="date"] {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}
input[type="date"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    margin-top: 0.5rem;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}
.btn:active {
    transform: translateY(0);
}

/* Alert/Error styles */
.alert-danger {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
[data-theme="dark"] .alert-danger {
    background-color: #7f1d1d33;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* Results Display */
.results-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}
.welcome-state svg {
    width: 64px;
    height: 64px;
    stroke: var(--primary);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.main-age-hero {
    background: linear-gradient(135deg, var(--primary-light), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
[data-theme="dark"] .main-age-hero {
    background: linear-gradient(135deg, #1e1b4b, #083344);
    border-color: rgba(99, 102, 241, 0.2);
}
.main-age-numbers {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.age-unit {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    min-width: 100px;
    flex: 1;
}
.age-val {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}
.age-lbl {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Countdown & Zodiac row */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.mini-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.mini-card-icon {
    background: var(--primary-light);
    color: var(--primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
[data-theme="dark"] .mini-card-icon {
    background: rgba(99, 102, 241, 0.2);
}
.mini-card-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.mini-card-val {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Life Stats Table Details */
.fact-table-card h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
}
.metrics-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 576px) {
    .metrics-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
.metric-row {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.metric-lbl {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.metric-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    margin-top: 0.25rem;
}

/* Fun facts */
.fun-facts-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
@media (max-width: 576px) {
    .fun-facts-row {
        grid-template-columns: 1fr;
    }
}
.fun-fact-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}
.fun-fact-box svg {
    width: 24px;
    height: 24px;
    stroke: var(--accent);
    margin-bottom: 0.5rem;
}

/* FAQ Section Styling */
.faq-section {
    margin-top: 3rem;
}
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.faq-question {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.faq-answer {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Info Section Content styling */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    margin-top: 2rem;
    box-shadow: var(--shadow);
}
.info-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.info-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* New Social Share Bar */
.share-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 12px 24px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    align-self: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.share-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.share-buttons {
    display: flex;
    gap: 10px;
}
.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
    text-decoration: none;
}
.share-btn svg {
    width: 18px;
    height: 18px;
}
.share-btn.twitter-x {
    background: #1da1f2;
}
.share-btn.twitter-x:hover {
    background: #0c85d0;
    transform: scale(1.1);
}
.share-btn.facebook {
    background: #1877f2;
}
.share-btn.facebook:hover {
    background: #0d5ec4;
    transform: scale(1.1);
}
.share-btn.linkedin {
    background: #0a66c2;
}
.share-btn.linkedin:hover {
    background: #08519c;
    transform: scale(1.1);
}
.share-btn.whatsapp {
    background: #25d366;
}
.share-btn.whatsapp:hover {
    background: #1ebd56;
    transform: scale(1.1);
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.footer-info {
    display: flex;
    align-items: center;
    gap: 20px;
}
.current-time-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-primary);
}
[data-theme="light"] .current-time-badge {
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

/* Utility classes */
.text-center { text-align: center; }
.text-primary-color { color: var(--primary); }

/* ===== EMI Calculator additions ===== */
.preset-tabs{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:1.5rem}
.preset-tab{border:1px solid var(--border);background:var(--bg-primary);color:var(--text-secondary);padding:.5rem .9rem;border-radius:999px;font-size:.85rem;font-weight:600;cursor:pointer;font-family:inherit;transition:var(--transition)}
.preset-tab:hover{border-color:var(--primary);color:var(--primary)}
.preset-tab.active{background:var(--primary);border-color:var(--primary);color:#fff}
.field-row{display:flex;gap:.5rem}
.field-row input,.field-row select{flex:1;min-width:0}
.field-row select{flex:0 0 110px}
input[type="number"],input[type="month"],select{width:100%;padding:.85rem 1rem;border-radius:var(--radius-md);border:1px solid var(--border);background-color:var(--bg-primary);color:var(--text-primary);font-family:inherit;font-size:1rem;outline:none;transition:var(--transition)}
input[type="number"]:focus,input[type="month"]:focus,select:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-light)}
input[type="range"]{width:100%;accent-color:var(--primary);margin-top:.25rem}
.input-prefix{position:relative}
.input-prefix span{position:absolute;left:1rem;top:50%;transform:translateY(-50%);color:var(--text-secondary);font-weight:600}
.input-prefix input{padding-left:2rem}
.hint{font-size:.8rem;color:var(--text-secondary)}
.opt-box{border:1px dashed var(--border);border-radius:var(--radius-md);padding:1rem;margin-bottom:1.25rem}
.opt-box summary{cursor:pointer;font-weight:600;font-size:.9rem}
.opt-box .form-group{margin:1rem 0 0}
.emi-hero{background:linear-gradient(135deg,var(--primary-light),rgba(6,182,212,.15));border:1px solid rgba(79,70,229,.15);border-radius:var(--radius-lg);padding:2rem;text-align:center}
[data-theme="dark"] .emi-hero{background:linear-gradient(135deg,#1e1b4b,#083344);border-color:rgba(99,102,241,.2)}
.emi-hero h2{font-size:1rem;color:var(--text-secondary);font-weight:600;text-transform:uppercase;letter-spacing:.05em}
.emi-big{font-family:'Outfit',sans-serif;font-size:3rem;font-weight:800;color:var(--primary);line-height:1.2;margin:.25rem 0}
.emi-sub{color:var(--text-secondary);font-size:.9rem}
.breakdown{display:grid;grid-template-columns:1fr;gap:1.5rem;align-items:center}
@media(min-width:640px){.breakdown{grid-template-columns:200px 1fr}}
.donut-wrap{position:relative;width:200px;height:200px;margin:0 auto}
.donut-wrap svg{width:100%;height:100%;transform:rotate(-90deg)}
.donut-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
.donut-center b{font-family:'Outfit',sans-serif;font-size:1.4rem}
.donut-center small{color:var(--text-secondary);font-size:.75rem}
.legend-row{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-radius:var(--radius-md);background:var(--bg-primary);border:1px solid var(--border);margin-bottom:.75rem;gap:1rem}
.legend-row .dot{width:12px;height:12px;border-radius:50%;display:inline-block;margin-right:.5rem}
.legend-row .val{font-family:'Outfit',sans-serif;font-weight:700}
.prepay-result{background:rgba(34,197,94,.1);border:1px solid rgba(34,197,94,.35);border-radius:var(--radius-md);padding:1rem;font-size:.95rem}
.sched-head{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:.75rem;margin-bottom:1rem}
.btn-sm{background:var(--bg-primary);color:var(--text-primary);border:1px solid var(--border);border-radius:var(--radius-md);padding:.55rem 1rem;font-weight:600;font-size:.85rem;cursor:pointer;font-family:inherit}
.btn-sm:hover{border-color:var(--primary);color:var(--primary)}
.table-scroll{overflow-x:auto;max-height:520px;overflow-y:auto;border:1px solid var(--border);border-radius:var(--radius-md)}
.sched-table{width:100%;border-collapse:collapse;font-size:.88rem;white-space:nowrap}
.sched-table th{position:sticky;top:0;background:var(--bg-primary);text-align:right;padding:.7rem .9rem;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:var(--text-secondary)}
.sched-table td{text-align:right;padding:.6rem .9rem;border-top:1px solid var(--border)}
.sched-table th:first-child,.sched-table td:first-child{text-align:left}
.sched-table tr.yr{cursor:pointer;font-weight:700}
.sched-table tr.yr:hover{background:var(--primary-light)}
.sched-table tr.yr td:first-child::before{content:"▸ ";color:var(--primary)}
.sched-table tr.yr.open td:first-child::before{content:"▾ "}
.sched-table tr.mo{background:var(--bg-primary);color:var(--text-secondary);display:none}
.sched-table tr.mo.show{display:table-row}
.alert-warn{background:#fef3c7;border:1px solid #fde68a;color:#92400e;padding:1rem;border-radius:var(--radius-md);font-size:.9rem}
[data-theme="dark"] .alert-warn{background:#78350f33;border-color:#78350f;color:#fcd34d}
.info-card h3{font-family:'Outfit',sans-serif;margin:1.25rem 0 .5rem}
.info-card code{background:var(--bg-primary);border:1px solid var(--border);padding:.15rem .4rem;border-radius:6px;font-size:.9rem}
.loan-table{width:100%;border-collapse:collapse;font-size:.9rem;margin-bottom:1rem}
.loan-table th,.loan-table td{border:1px solid var(--border);padding:.6rem .8rem;text-align:left;color:var(--text-secondary)}
.loan-table th{background:var(--bg-primary);color:var(--text-primary)}

/* Hide empty ad boxes when no ad is served */
.ad-container:has(ins.adsbygoogle[data-ad-status="unfilled"]){display:none}

/* ===== Mobile fixes: stop grid/flex children from overflowing the screen ===== */
.layout-grid{grid-template-columns:minmax(0,1fr)}
@media (min-width:992px){.layout-grid{grid-template-columns:450px minmax(0,1fr)}}
.layout-grid>*,.results-wrapper>*,.container>*{min-width:0;max-width:100%}
.container{min-width:0;max-width:1200px}
body{overflow-x:hidden}
.loan-table{display:block;overflow-x:auto}
@media (max-width:576px){
  .container{padding:0 1rem 2rem;gap:1.25rem}
  .card,.info-card{padding:1.25rem}
  .emi-hero{padding:1.25rem}
  .emi-big{font-size:2.25rem}
  h1{font-size:1.65rem}
  .field-row select{flex-basis:96px}
  .sched-table{font-size:.8rem}
  .sched-table th,.sched-table td{padding:.5rem .6rem}
  .donut-wrap{width:170px;height:170px}
  .legend-row{flex-wrap:wrap}
}

/* Side ad rails: only where they fit beside the 1200px content, never over it */
@media (max-width:1559px){.ad-rail-left,.ad-rail-right{display:none!important}}
