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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    text-align: center;
    padding: 2rem 0 1.5rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
}

main {
    padding-bottom: 2rem;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.input-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.input-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
    color: var(--text);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    font-weight: 500;
    pointer-events: none;
}

.currency-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.currency-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--card-bg);
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Tooltips */
.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.25rem;
    cursor: help;
    position: relative;
}

.tooltip::before,
.tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.tooltip::before {
    content: attr(data-tooltip);
    background: var(--text);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 200px;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
}

.tooltip::after {
    content: '';
    border: 5px solid transparent;
    border-top-color: var(--text);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: -4px;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* Summary Card */
.summary-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.25rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.875rem;
}

.summary-row span:first-child {
    color: var(--text-light);
}

.summary-row span:last-child {
    font-weight: 600;
}

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.results-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.tax-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
}

.tax-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    font-size: 0.95rem;
}

.tax-label {
    color: var(--text-light);
}

.tax-amount {
    font-weight: 600;
    color: var(--text);
}

.tax-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.tax-row.total {
    padding-top: 0.75rem;
}

.tax-row.total .tax-label {
    font-weight: 600;
    color: var(--text);
}

.tax-row.total .tax-amount {
    color: var(--primary);
    font-size: 1.1rem;
}

/* Effective Rate Card */
.effective-rate-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1rem;
    text-align: center;
}

.rate-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.rate-value {
    font-size: 2rem;
    font-weight: 700;
}

/* Quarterly Section */
.quarterly-section {
    margin-top: 1.5rem;
}

.quarterly-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.payment-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--border);
    transition: transform 0.15s;
}

.payment-card:hover {
    transform: translateX(2px);
}

.payment-card.next-payment {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.05));
    border-left-color: var(--primary);
}

.payment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.payment-quarter {
    font-weight: 600;
    font-size: 0.95rem;
}

.payment-badge {
    background: var(--warning);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.payment-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.payment-date {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
}

.countdown {
    color: var(--warning);
    font-weight: 500;
}

/* Ad Space */
.ad-space {
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-light);
    font-size: 0.8rem;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .input-section,
    .results-section {
        padding: 1.25rem;
    }

    .payment-amount {
        font-size: 1.25rem;
    }

    .rate-value {
        font-size: 1.75rem;
    }
}
