:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app-container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

/* Credits Bar */
.credits-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.credit-text {
    font-size: 0.9rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.credit-text strong {
    color: var(--primary);
    font-weight: 700;
}

.credit-text i {
    font-size: 0.95rem;
    color: var(--primary);
}

.credit-divider {
    color: var(--text-muted);
    font-weight: 300;
}

.logo i {
    color: white;
    background: var(--primary);
    padding: 8px;
    border-radius: 12px;
}

.logo span span {
    color: var(--primary);
}

/* Calculator Card */
.calculator-card {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    border: 1px solid var(--border);
}

.card-header {
    text-align: left;
    margin-bottom: 2rem;
}

.card-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Inputs */
.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
    background: #f8fafc;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.input-group label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--primary);
    font-size: 1.25rem;
}

.input-wrapper input {
    width: 100%;
    padding: 1.1rem 1.1rem 1.1rem 3.2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.2s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.result-col {
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.result-col.firm {
    background: #fdf2f8;
    border-color: #fce7f3;
}

.result-col.company {
    background: #eff6ff;
    border-color: #dbeafe;
}

.col-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.col-header i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: block;
}

.col-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tax-rate {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-table th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.85rem 0.6rem;
    border-bottom: 2px solid var(--border);
    opacity: 0.7;
}

.result-table td {
    padding: 1.1rem 0.6rem;
    font-size: 1.05rem;
    color: var(--text-muted);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
    vertical-align: top;
}

.result-table tr:last-child td {
    border-bottom: none;
}

.result-table td:nth-child(1) {
    width: 42%;
}

.result-table td:nth-child(2) {
    width: 22%;
    font-weight: 700;
    color: var(--text);
    text-align: right;
}

.result-table td:nth-child(3) {
    width: 22%;
    font-weight: 700;
    color: var(--text);
    text-align: right;
}

.result-table td:nth-child(4) {
    width: 14%;
    text-align: center;
}

/* Badges */
.badge {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-partner {
    background: #fee2e2;
    color: #991b1b;
}

.badge-director {
    background: #dcfce7;
    color: #166534;
}

.badge-firm {
    background: #fef9c3;
    color: #854d0e;
}

.badge-company {
    background: #dbeafe;
    color: #1e40af;
}

.highlight-row {
    background: rgba(37, 99, 235, 0.03);
}

.highlight-row td:first-child span {
    color: var(--primary);
    font-weight: 600;
}

.label-with-calc {
    display: flex;
    flex-direction: column;
}

.calc-breakdown {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 4px;
    line-height: 1.4;
    white-space: pre-line;
    font-style: italic;
}

.total-row td {
    border-top: 2px solid var(--border);
    border-bottom: none !important;
    background: #f8fafc;
    padding: 1.25rem 0.5rem !important;
}

.total-row td:nth-child(3) {
    color: var(--primary) !important;
    font-size: 1.1rem;
}

.individual-tax {
    color: var(--warning) !important;
}

.entity-tax {
    color: var(--danger) !important;
}

/* Summary Box */
.comparison-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    margin-top: 1rem;
}

.summary-info h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.summary-info p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.summary-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--success);
}

.summary-value.negative {
    color: var(--danger);
}

.interactive-option-row td {
    background: rgba(37, 99, 235, 0.05);
    padding: 0.6rem 0.8rem !important;
    border-radius: 10px;
}

.option-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.option-container span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.toggle-group {
    display: inline-flex;
    background: var(--border);
    padding: 4px;
    border-radius: 10px;
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-group label {
    padding: 6px 15px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.toggle-group input[type="radio"]:checked+label {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Highlighting */
.lower-tax-highlight {
    background: #dbeafe !important;
    /* light blue */
    color: #1e40af !important;
    /* dark blue */
    animation: blink-highlight 2s infinite;
}

@keyframes blink-highlight {

    0%,
    100% {
        background-color: #dbeafe;
    }

    50% {
        background-color: #ffffff;
    }
}

.comparison-message {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--success);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.effective-rate-row td {
    border-top: 1px solid var(--border);
    background: #f1f5f9;
    padding: 0.75rem 0.5rem !important;
}

.effective-rate-row td:nth-child(3) {
    color: var(--primary) !important;
    font-size: 1rem;
    font-weight: 800;
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* PDF Print Styles */
@media print {
    @page {
        size: A4;
        margin: 8mm;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
        font-size: 10px;
    }

    .app-container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .header-actions {
        display: none !important;
    }

    .app-header {
        margin-bottom: 0.3rem;
        page-break-after: avoid;
    }

    .logo {
        font-size: 1rem;
    }

    .logo i {
        font-size: 1rem;
        padding: 4px;
    }

    .credits {
        font-size: 0.65rem;
    }

    .credit-name {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
    }

    .credit-contact {
        font-size: 0.65rem;
        margin-bottom: 0.1rem;
    }

    .credit-firm {
        font-size: 0.6rem;
    }

    .calculator-card {
        box-shadow: none;
        border: none;
        padding: 0.3rem;
        page-break-inside: avoid;
    }

    .card-header h1 {
        font-size: 1.1rem;
        margin-bottom: 0.15rem;
    }

    .card-header p {
        font-size: 0.7rem;
        margin-bottom: 0.3rem;
    }

    .input-section {
        background: #f5f5f5;
        border: 1px solid #ccc;
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        gap: 0.5rem;
        page-break-inside: avoid;
    }

    .input-group label {
        font-size: 0.65rem;
        margin-bottom: 0.15rem;
    }

    .input-wrapper input {
        padding: 0.3rem 0.3rem 0.3rem 1.5rem;
        font-size: 0.75rem;
    }

    .input-wrapper i {
        font-size: 0.9rem;
        left: 0.4rem;
    }

    .results-grid {
        gap: 0.5rem;
        margin-bottom: 0.4rem;
        page-break-inside: avoid;
    }

    .result-col {
        padding: 0.4rem;
    }

    .col-header {
        margin-bottom: 0.4rem;
    }

    .col-header i {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .col-header h2 {
        font-size: 0.85rem;
        margin-bottom: 0.1rem;
    }

    .tax-rate {
        font-size: 0.6rem;
    }

    .result-table {
        font-size: 0.7rem;
    }

    .result-table th {
        font-size: 0.6rem;
        padding: 0.3rem 0.2rem;
    }

    .result-table td {
        padding: 0.4rem 0.2rem;
        font-size: 0.7rem;
    }

    .result-table td:nth-child(1) {
        width: 40%;
        font-size: 0.68rem;
    }

    .result-table td:nth-child(2) {
        width: 22%;
    }

    .result-table td:nth-child(3) {
        width: 22%;
    }

    .result-table td:nth-child(4) {
        width: 16%;
    }

    .badge {
        font-size: 0.55rem;
        padding: 1px 4px;
    }

    .calc-breakdown {
        font-size: 0.6rem;
        line-height: 1.2;
    }

    .interactive-option-row td {
        padding: 0.4rem 0.3rem !important;
    }

    .option-container {
        gap: 0.5rem;
    }

    .option-container span {
        font-size: 0.65rem;
    }

    .toggle-group {
        padding: 2px;
    }

    .toggle-group label {
        padding: 3px 8px;
        font-size: 0.6rem;
    }

    .total-row td {
        padding: 0.6rem 0.2rem !important;
        font-size: 0.7rem;
    }

    .total-row td:nth-child(3) {
        font-size: 0.85rem;
    }

    .effective-rate-row td {
        padding: 0.5rem 0.2rem !important;
        font-size: 0.7rem;
    }

    .effective-rate-row td:nth-child(3) {
        font-size: 0.8rem;
    }

    .comparison-message {
        margin-top: 0.4rem;
        padding: 0.4rem;
        font-size: 0.75rem;
        page-break-inside: avoid;
    }

    .fine-print {
        font-size: 0.6rem;
        margin-top: 0.4rem;
    }

    .fine-print p {
        margin: 0;
        line-height: 1.3;
    }

    .interactive-option-row.desktop-only {
        display: table-row !important;
    }

    .lower-tax-highlight {
        background: #dbeafe !important;
        color: #1e40af !important;
        animation: none !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Ensure entity tax and individual tax colors print */
    .entity-tax {
        color: #dc2626 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .individual-tax {
        color: #f59e0b !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.benefit-pulse {
    animation: pulse 0.5s ease-in-out;
}