/* --- THEME VARIABLES --- */
:root {
    --paper: #fdfbf7;
    --ink: #2c3e50;
    --green: #166534;
    --light-green: #dcfce7;
    --red: #991b1b;
    --warning-bg: #fef9c3;
    --warning-text: #854d0e;
    --bg: #e5e7eb;
    --info: #2563eb;
    --gold: #b45309;
    --light-gold: #fef3c7;
    --input-bg: #ffffff;
    --border: #ccc;
    --label-color: #64748b;
    --slap-red: #fee2e2;
    --slap-text: #b91c1c;
    --safe-green: #f0fdf4;
    --safe-text: #15803d;
}

body.dark-mode {
    --paper: #1e293b;
    --ink: #e2e8f0;
    --green: #4ade80;
    --light-green: #064e3b;
    --red: #f87171;
    --warning-bg: #422006;
    --warning-text: #fde047;
    --bg: #0f172a;
    --info: #60a5fa;
    --gold: #fbbf24;
    --light-gold: #451a03;
    --input-bg: #334155;
    --border: #475569;
    --label-color: #94a3b8;
    --slap-red: #450a0a;
    --slap-text: #fca5a5;
    --safe-green: #052e16;
    --safe-text: #86efac;
}

html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
    font-family: 'Segoe UI', Roboto, Helvetica, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
    margin: 0;
    padding: 20px;
    padding-bottom: 50px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    flex: 1;
}

/* --- CONTROLS --- */
.controls {
    background: var(--paper);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    height: fit-content;
    transition: background 0.3s;
}

.header-row {
    display: flex; flex-direction: column; align-items: center; gap: 15px;
    margin-bottom: 25px; border-bottom: 1px solid var(--border); padding-bottom: 20px;
}
.logo { font-size: 1.4rem; font-weight: 800; color: var(--green); }

.settings-area { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 100%; }
.settings-label { font-size: 0.8rem; font-weight: bold; color: var(--label-color); text-transform: uppercase; }
.toggle-group { display: flex; gap: 8px; width: 100%; justify-content: center; }

.icon-btn {
    background: none; border: 1px solid var(--border); color: var(--ink);
    padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 1rem;
}

#langSelector {
    padding: 8px; border-radius: 6px; background: var(--input-bg);
    color: var(--ink); border: 1px solid var(--border); flex-grow: 1; max-width: 200px;
}

.form-group { margin-bottom: 15px; }
label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 0.9rem; }

input, select {
    width: 100%; padding: 12px; background-color: var(--input-bg); color: var(--ink);
    border: 1px solid var(--border); border-radius: 8px; font-size: 16px; box-sizing: border-box;
}

/* JACKPOT PULSE */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(22, 101, 52, 0.4); border-color: var(--green); }
    70% { box-shadow: 0 0 0 10px rgba(22, 101, 52, 0); border-color: var(--green); }
    100% { box-shadow: 0 0 0 0 rgba(22, 101, 52, 0); border-color: var(--green); }
}
input#jackpot:placeholder-shown { animation: pulse-glow 2s infinite; border: 2px solid var(--green); }
input#jackpot:focus { animation: none; border: 2px solid var(--info); outline: none; }

/* WARNINGS & TIPS */
.dynamic-tip {
    font-size: 0.75rem; color: var(--info); background: var(--input-bg);
    border-left: 3px solid var(--info); padding: 8px; margin-top: 5px;
    border-radius: 0 4px 4px 0; display: none; line-height: 1.3;
}
.warning-message {
    background-color: var(--warning-bg); color: var(--warning-text);
    padding: 12px; border-radius: 8px; border: 1px solid var(--warning-text);
    font-size: 0.85rem; display: none; margin-bottom: 15px; font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button.generate-btn {
    width: 100%; padding: 15px; background: var(--green); color: #fff;
    border: none; border-radius: 8px; font-weight: bold; font-size: 1.1rem;
    cursor: pointer; margin-top: 10px;
    transition: transform 0.1s;
}
button.generate-btn:active { transform: scale(0.98); }

.live-check-btn {
    display: none; font-size: 0.85rem; text-decoration: none; color: white;
    background-color: var(--info); padding: 10px 12px; border-radius: 6px;
    margin-top: 8px; font-weight: 600; text-align: center;
}
.btn-power { background-color: #dc2626; }
.btn-mega { background-color: #2563eb; }

/* --- STUB --- */
.paycheck-stub {
    background: var(--paper); border: 1px solid var(--border);
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transition: background 0.3s;
}

.stub-header {
    background: var(--bg); padding: 15px 25px; border-bottom: 2px solid var(--ink);
    display: flex; justify-content: space-between;
}
.stub-body { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px dashed var(--border); }
.stub-section { padding: 20px; }
.stub-section.left { border-right: 1px solid var(--border); }

.line-item { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.line-item.deduction { color: var(--red); }
.line-item.exempt { color: var(--green); font-weight: bold; }
.line-item.subtotal { font-weight: bold; border-top: 1px solid var(--border); padding-top: 5px; margin-top: 10px; }

.small-note { font-size: 0.7rem; color: var(--label-color); display: block; margin-top: -5px; margin-bottom: 5px; font-style: italic; }
.exempt-note {
    background-color: var(--light-green); color: var(--green); 
    padding: 4px 8px; border-radius: 4px; font-weight: bold; font-style: normal;
    display: inline-block; margin-top: 5px; border: 1px solid var(--green);
}

/* --- THE SLAP (SURTAX POPUP) --- */
@keyframes slap-in {
    0% { transform: scale(0.8); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.surtax-box {
    display: none; /* Hidden by default */
    margin-top: 15px; margin-bottom: 15px;
    padding: 12px; border-radius: 8px;
    animation: slap-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 2px solid transparent;
}

.surtax-box.danger {
    background-color: var(--slap-red);
    color: var(--slap-text);
    border-color: var(--slap-text);
}

.surtax-box.safe {
    background-color: var(--safe-green);
    color: var(--safe-text);
    border-color: var(--safe-text);
}

.surtax-title { font-weight: 900; display: block; margin-bottom: 4px; text-transform: uppercase; font-size: 0.8rem; }
.surtax-amount { font-weight: bold; font-size: 1.1rem; }
.surtax-note { display: block; font-size: 0.65rem; margin-top: 5px; opacity: 0.8; font-style: italic; }

.net-pay-box { background: var(--light-green); padding: 20px; border-top: 2px solid var(--ink); }
.net-amount { font-size: 2.5rem; font-weight: 900; color: var(--green); margin: 5px 0 0 0; text-align: right; }

.net-disclaimer {
    font-size: 0.7rem; color: var(--ink); opacity: 0.8; margin-top: 15px; 
    font-style: italic; line-height: 1.4; border-top: 1px solid var(--border);
    padding-top: 10px; text-align: center;
}

/* SPLIT BOX */
.split-box {
    background: rgba(255,255,255,0.2); border: 2px dashed rgba(22, 101, 52, 0.5);
    margin-top: 15px; padding: 10px; border-radius: 8px;
    color: var(--ink); font-family: 'Segoe UI', sans-serif;
    display: none;
}
.split-label { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; color: var(--green); }
.split-amount { font-size: 1.5rem; font-weight: 800; color: var(--ink); }

/* ANNUITY SPECIFIC */
.annuity-legend {
    display: flex; gap: 15px; margin-bottom: 15px; justify-content: center;
    font-size: 0.8rem; background: var(--bg); padding: 10px; border-radius: 8px;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.white { background: #fff; border: 1px solid #ccc; }
.dot.green { background: var(--green); }

.annuity-info-box {
    background: var(--paper); border: 1px solid var(--info); color: var(--ink);
    padding: 10px; border-radius: 6px; font-size: 0.75rem; margin-bottom: 15px;
    line-height: 1.4;
}

.annuity-row {
    background: var(--input-bg); padding: 10px; margin-bottom: 5px; border-radius: 6px;
    display: grid; grid-template-columns: 60px 1fr 1fr; border: 1px solid var(--border);
    align-items: center;
}
.hidden-row { display: none; }
.toggle-btn {
    width: 100%; padding: 8px; margin-top: 10px; background: none; border: 1px dashed var(--green);
    color: var(--green); cursor: pointer; font-weight: bold; border-radius: 6px;
}
.toggle-btn:hover { background: var(--light-green); }

/* --- RICH FEATURES --- */
.gdp-wrapper {
    background: var(--paper); border-radius: 12px; padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); margin-bottom: 20px;
    margin-top: 20px;
}
.gdp-result-box {
    padding: 15px; border-radius: 8px; display: flex; align-items: center; gap: 15px; margin-top: 10px;
    background-color: var(--bg); border: 1px solid var(--border);
}
.gdp-flag { font-size: 2.5rem; flex-shrink: 0; }
.gdp-text { font-size: 1rem; line-height: 1.4; }

.fun-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fun-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; }
.fun-card {
    background: var(--paper); padding: 15px; border-radius: 10px; text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid var(--border);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.fun-icon { font-size: 2rem; display: block; margin-bottom: 5px; }
.fun-count { font-weight: 800; color: var(--green); font-size: 1.2rem; }
.fun-price-tag { 
    font-size: 0.65rem; color: var(--label-color); margin-top: 5px; 
    background: var(--input-bg); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border);
}

/* --- CONTENT SECTION --- */
.content-section {
    background: var(--paper); padding: 30px; border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); margin-top: 30px;
    grid-column: 1 / -1; line-height: 1.6;
}
.content-section h2 { color: var(--green); margin-bottom: 15px; font-size: 1.5rem; }
.content-section h3 { color: var(--ink); margin-top: 20px; margin-bottom: 10px; font-size: 1.2rem; }
.content-section p { margin-bottom: 15px; color: var(--label-color); }
.faq-item { margin-bottom: 20px; }
.faq-question { font-weight: bold; color: var(--ink); display: block; margin-bottom: 5px; }
.faq-answer { color: var(--label-color); font-size: 0.95rem; }

.legal-footer { margin-top: 60px; padding: 20px 0; text-align: center; border-top: 1px solid var(--border); grid-column: 1 / -1; }
.legal-text { max-width: 800px; margin: 0 auto; font-size: 0.75rem; color: var(--label-color); line-height: 1.6; padding: 0 20px; }
.footer-link { color: var(--info); text-decoration: none; font-weight: bold; cursor: pointer; }

/* --- COOKIE BANNER --- */
.cookie-banner {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 15px 25px; border-radius: 50px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2); display: none; align-items: center; gap: 15px;
    z-index: 9999; width: 90%; max-width: 600px; font-size: 0.85rem;
}
.cookie-btn {
    background: var(--green); color: white; border: none; padding: 8px 16px;
    border-radius: 20px; cursor: pointer; font-weight: bold; white-space: nowrap;
}

@media (max-width: 800px) {
    .main-wrapper { grid-template-columns: 1fr; }
    .stub-body { grid-template-columns: 1fr; }
    .stub-section.left { border-right: none; border-bottom: 1px solid var(--border); }
}