/* ============================================================
   TaxCalcHub — Complete Stylesheet (2026)
   Mobile-first, responsive, AdSense-optimized layout
   ============================================================ */

/* CSS Variables */
:root {
    --primary: #0f766e;
    --primary-light: #115e59;
    --primary-dark: #134e4a;
    --accent: #5eead4;
    --accent-light: #ccfbf1;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --bg-dark: #0f172a;
    --border: #e5e7eb;
    --border-light: #f1f5f9;
    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --error: #dc2626;
    --error-bg: #fee2e2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --max-width: 1200px;
    --header-height: 64px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo svg {
    flex-shrink: 0;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--accent-light);
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
    border-radius: 1px;
}

.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
    padding: calc(var(--header-height) + 3rem) 0 3rem;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-alt) 0%, var(--accent-light) 100%);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

.hero-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
}

/* ============================================================
   AD UNITS
   ============================================================ */
.ad-unit {
    margin: 2rem auto;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.ad-banner {
    max-width: 728px;
    min-height: 90px;
}

.ad-inline {
    max-width: 100%;
    min-height: 250px;
}

.ad-unit::before {
    content: 'Advertisement';
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================
   HUB GRID
   ============================================================ */
.hub-grid {
    padding: 3rem 0;
}

.hub-grid h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.calc-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s;
    cursor: default;
}

.calc-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.calc-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.calc-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.calc-card p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.calc-preview {
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.calc-preview .input-row {
    margin-bottom: 0.75rem;
}

.calc-preview label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.calc-preview select,
.calc-preview input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg);
}

/* ============================================================
   CALCULATOR SECTIONS
   ============================================================ */
.calculator-section {
    padding: 3rem 0;
    scroll-margin-top: calc(var(--header-height) + 1rem);
}

.calculator-section.alt-bg {
    background: var(--bg-alt);
}

.calc-header {
    text-align: center;
    margin-bottom: 2rem;
}

.calc-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.calc-description {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.calc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .calc-layout {
        grid-template-columns: 1fr;
    }
}

/* Inputs */
.calc-inputs {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.input-group label .tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--border);
    border-radius: 50%;
    font-size: 0.75rem;
    cursor: help;
    margin-left: 0.25rem;
    color: var(--text-light);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.input-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 0.75rem;
}

.btn-reset:hover {
    background: var(--border-light);
    color: var(--text);
}

/* Results */
.calc-results {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    color: var(--text-muted);
    min-height: 300px;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.results-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}

.results-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.filing-badge {
    padding: 0.375rem 0.75rem;
    background: var(--accent-light);
    color: var(--primary);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.summary-item.highlight .value {
    font-size: 1.5rem;
    color: var(--primary);
}

.summary-item .value.tax-owed { color: var(--error); }
.summary-item .value.refund { color: var(--success); }
.summary-item .value.owed { color: var(--error); }

.results-detail {
    padding: 1.5rem;
}

.results-detail h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.detail-row:last-child { border-bottom: none; }

.detail-row.deduction { color: var(--success); }
.detail-row.credit { color: var(--success); font-weight: 600; }
.detail-row.subtotal { font-weight: 600; border-top: 2px solid var(--border); border-bottom: 2px solid var(--border); }
.detail-row.total { font-weight: 700; font-size: 1rem; border-top: 2px solid var(--border); margin-top: 0.5rem; padding-top: 1rem; }
.detail-row.total.refund { color: var(--success); }
.detail-row.total.owed { color: var(--error); }

/* Bracket Visualization */
.bracket-visualization {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.bracket-visualization h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.bracket-bar {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.bracket-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.bracket-rate {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.875rem;
}

.bracket-range {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bracket-progress {
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.bracket-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.bracket-tax {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    min-width: 80px;
    text-align: right;
}

/* Full Bracket Visual */
.bracket-visualization.full .bracket-visual {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.bracket-visual.active {
    background: var(--accent-light);
    border: 1px solid var(--accent);
}

.bracket-visual.filled {
    background: var(--bg-alt);
    opacity: 0.6;
}

.bracket-visual.empty {
    opacity: 0.4;
}

.bracket-visual .bracket-label {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.bracket-visual .bracket-bar-container {
    height: 12px;
    background: var(--border-light);
    border-radius: 6px;
    overflow: hidden;
}

.bracket-visual .bracket-bar-bg {
    height: 100%;
    width: 100%;
}

.bracket-visual .bracket-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 6px;
    transition: width 0.5s ease;
}

.bracket-visual .bracket-bar-fill.complete {
    width: 100%;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
}

.bracket-visual .bracket-tax-amount {
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 80px;
    text-align: right;
}

/* Info Boxes */
.info-box {
    padding: 1.25rem 1.5rem;
    background: var(--bg-alt);
    border-left: 4px solid var(--primary);
    margin: 1rem 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.info-box.success { border-left-color: var(--success); background: var(--success-bg); }
.info-box.warning { border-left-color: var(--warning); background: var(--warning-bg); }

.info-box h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.info-box p,
.info-box ul {
    font-size: 0.875rem;
    color: var(--text-light);
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box ul li {
    padding: 0.25rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.info-box ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.info-box small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Disclaimer */
.disclaimer {
    padding: 1rem 1.5rem;
    background: var(--warning-bg);
    border-top: 1px solid var(--border);
}

.disclaimer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Error Message */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    background: var(--error-bg);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    color: var(--error);
}

.error-icon {
    font-size: 2rem;
}

/* ============================================================
   FAQ SECTION
   ============================================================ */
.faq-section {
    padding: 3rem 0;
    background: var(--bg-alt);
}

.faq-section h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
}

.faq-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--primary);
    transition: transform 0.3s;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.25rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--bg-dark);
    color: var(--text-muted);
    padding: 3rem 0 1.5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand .logo {
    color: white;
    margin-bottom: 1rem;
}

.footer-brand p {
    font-size: 0.875rem;
    line-height: 1.6;
    max-width: 300px;
}

.footer-links h4 {
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.375rem 0;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.tooltip-popup {
    position: fixed;
    background: var(--text);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    max-width: 250px;
    z-index: 10000;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem;
    }

    .main-nav.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .hero {
        padding: calc(var(--header-height) + 2rem) 0 2rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .calc-layout {
        grid-template-columns: 1fr;
    }

    .calc-results {
        position: static;
    }

    .results-summary {
        grid-template-columns: 1fr 1fr;
    }

    .bracket-bar {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .bracket-visualization.full .bracket-visual {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .results-summary {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .ad-banner {
        min-height: 50px;
    }

    .ad-inline {
        min-height: 150px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .site-header,
    .ad-unit,
    .btn-primary,
    .btn-reset,
    .mobile-menu-btn {
        display: none !important;
    }

    .calculator-section {
        page-break-inside: avoid;
    }

    .results-card {
        border: 1px solid #000;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Focus styles */
input:focus,
select:focus,
button:focus,
a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text-light: #333;
    }
}
