/* ============================================
   LuxTax 2025 - Calculator Page Styles
   Ultra-modern, editorial layout
   ============================================ */

/* ============================================
   Progress Bar — minimal, refined
   ============================================ */
.progress-section {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    max-width: 520px;
    margin: 0 auto;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    cursor: default;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-muted);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
}

.step-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.progress-step.active .step-number {
    background: var(--primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 0 4px rgba(27, 46, 74, 0.12);
}

.progress-step.active .step-label {
    color: var(--primary);
}

.progress-step.completed .step-number {
    background: var(--success);
    color: white;
    border-color: transparent;
}

.progress-step.completed .step-label {
    color: var(--success);
}

.progress-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 12px;
    margin-bottom: 26px;
    border-radius: 1px;
    transition: background 0.4s var(--ease);
    max-width: 72px;
}

.progress-line.filled {
    background: var(--success);
}

/* ============================================
   Calculator Section
   ============================================ */
.calculator-section {
    padding: 48px 0;
}

/* Scroll area with snap behaviour */
.calc-scroll-area {
    /* No snap on the outer container; snap lives on the viewport via card-row */
}

/* Card Row: side-by-side form + tips per section */
.calc-card-row {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
    margin-bottom: 8px;
    scroll-margin-top: 80px;
    position: relative;
}

.calc-form-col {
    min-width: 0;
}

/* Tips column: initially hidden, animates in */
.calc-tips-col {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    /* Animation: start off-screen right, invisible */
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

/* When the row is in view, tips animate in */
.calc-card-row.in-view .calc-tips-col {
    opacity: 1;
    transform: translateX(0);
}

/* Dotted connector line from form to tips */
.calc-card-row.in-view::after {
    content: '';
    position: absolute;
    top: 40px;
    left: calc(100% - 320px - 32px + 2px);
    width: 28px;
    height: 0;
    border-top: 2px dashed var(--border);
    opacity: 0;
    animation: connectorIn 0.4s var(--ease) 0.2s forwards;
}

@keyframes connectorIn {
    to { opacity: 1; }
}

.calc-tips-col::-webkit-scrollbar {
    width: 3px;
}
.calc-tips-col::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Legacy layout fallback for Step 4 (results, no tips) */
.calc-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

/* ============================================
   Tip Cards — clean, subtle
   ============================================ */
.tip-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
    transition: var(--transition);
}

.tip-card:hover {
    border-color: var(--text-muted);
    box-shadow: var(--shadow-xs);
}

.tip-card h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tip-card h4 .tip-icon {
    font-size: 14px;
    opacity: 0.6;
}

.tip-card p, .tip-card li {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
}

.tip-card ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.tip-card li {
    padding: 3px 0 3px 18px;
    position: relative;
}

.tip-card li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
    font-size: 11px;
}

.tip-card-warning {
    border-left: 3px solid var(--warning);
    background: var(--warning-light);
}

.tip-card-warning h4 {
    color: var(--warning);
}

.tip-card-info {
    border-left: 3px solid var(--primary-light);
    background: #f5f8ff;
}

.tip-card-money {
    border-left: 3px solid var(--success);
    background: var(--success-light);
}

.tip-card-money h4 {
    color: var(--success);
}

.tip-card .tip-table {
    width: 100%;
    font-size: 12px;
    margin-top: 8px;
    border-collapse: collapse;
}

.tip-card .tip-table th,
.tip-card .tip-table td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.tip-card .tip-table th {
    font-weight: 600;
    color: var(--text-secondary);
}

.tip-card .tip-table td {
    color: var(--text-light);
}

.tip-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tip-link:hover {
    color: var(--primary);
}

/* ============================================
   Error Summary
   ============================================ */
.form-error-summary:empty {
    display: none;
}

.form-error-summary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: var(--danger);
    padding: 14px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Form Steps — smooth transitions
   ============================================ */
.form-step {
    display: none;
    animation: stepIn 0.4s var(--ease);
}

.form-step.active {
    display: block;
}

@keyframes stepIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-header {
    margin-bottom: 36px;
}

.step-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.step-header p {
    color: var(--text-light);
    font-size: 15px;
    line-height: 1.6;
}

/* ============================================
   Form Cards — elevated, spacious
   ============================================ */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.form-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.card-description {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ============================================
   Form Elements — tall, airy
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-white);
    transition: var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

.form-group select {
    background-color: var(--bg-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 46, 74, 0.08);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    accent-color: var(--primary);
    border-radius: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 36px;
    gap: 12px;
}

/* Reference Links */
.ref-link {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px dashed var(--primary-light);
    transition: var(--transition-fast);
}

.ref-link:hover {
    color: var(--primary);
    border-bottom-style: solid;
}

/* ============================================
   Tax Class Display — elegant callout
   ============================================ */
.tax-class-display {
    margin-top: 24px;
    padding: 20px 24px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 16px;
}

.tax-class-badge {
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 700;
    background: var(--primary);
    color: white;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.tax-class-display p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ============================================
   Results Section — dashboard-feel
   ============================================ */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.result-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.result-card:hover {
    box-shadow: var(--shadow-sm);
}

.result-card-highlight {
    background: var(--primary);
    color: white;
    border: none;
    grid-column: span 3;
    padding: 40px 32px;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

/* Subtle pattern overlay on highlight card */
.result-card-highlight::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 60%);
    pointer-events: none;
}

.result-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.result-card-highlight .result-label {
    color: rgba(255, 255, 255, 0.65);
}

.result-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.result-card-highlight .result-value {
    color: white;
    font-size: 42px;
    position: relative;
}

.result-sub {
    font-size: 14px;
    margin-top: 4px;
    opacity: 0.7;
    position: relative;
    font-weight: 500;
}

/* ============================================
   Breakdown Table — clean rows
   ============================================ */
.breakdown-table {
    width: 100%;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.breakdown-row.total {
    border-top: 2px solid var(--primary);
    border-bottom: none;
    font-weight: 700;
    padding-top: 20px;
    margin-top: 8px;
}

.breakdown-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.breakdown-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.breakdown-row.deduction .breakdown-value {
    color: var(--success);
}

.breakdown-row.deduction .breakdown-value::before {
    content: "- ";
}

.breakdown-row.addition .breakdown-value::before {
    content: "+ ";
}

.breakdown-row.total .breakdown-label {
    color: var(--primary);
}

.breakdown-row.total .breakdown-value {
    color: var(--primary);
    font-size: 16px;
}

/* ============================================
   Breakdown Explanation Boxes
   ============================================ */

/* The explanation box below each row */
.breakdown-explain {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 4px;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-light);
}

/* ============================================
   Bracket Chart — polished bars
   ============================================ */
.bracket-chart {
    margin-top: 20px;
}

.bracket-bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.bracket-rate {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    width: 40px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.bracket-bar-container {
    flex: 1;
    height: 24px;
    background: var(--bg-muted);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.bracket-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s var(--ease);
    min-width: 2px;
}

.bracket-amount {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    width: 96px;
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Monthly Grid — card feel
   ============================================ */
.monthly-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.monthly-item {
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.monthly-label {
    font-size: 14px;
    color: var(--text-light);
}

.monthly-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Legal References — pill tags
   ============================================ */
.legal-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.legal-ref-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition-fast);
}

.legal-ref-tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .calc-card-row,
    .calc-layout {
        grid-template-columns: 1fr;
    }

    .calc-tips-col {
        position: static;
        max-height: none;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        /* Still animate, but from below on mobile */
        opacity: 0;
        transform: translateY(16px) translateX(0);
    }

    .calc-card-row.in-view .calc-tips-col {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }

    /* Hide dotted connector on mobile */
    .calc-card-row.in-view::after {
        display: none;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

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

    .result-card-highlight {
        grid-column: span 2;
    }

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

    .form-card {
        padding: 24px;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    .tax-class-display {
        flex-direction: column;
        text-align: center;
    }

    .calc-tips-col {
        grid-template-columns: 1fr !important;
    }

    .step-header h2 {
        font-size: 24px;
    }

    .calculator-section {
        padding: 32px 0;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .result-card-highlight {
        grid-column: span 1;
        padding: 28px 20px;
    }

    .result-card-highlight .result-value {
        font-size: 32px;
    }

    .progress-bar {
        gap: 0;
    }

    .step-label {
        font-size: 9px;
    }

    .step-number {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar, .progress-section, .form-actions, .footer, .calc-tips-col {
        display: none !important;
    }

    .form-step {
        display: block !important;
    }

    .form-step[data-step="1"],
    .form-step[data-step="2"],
    .form-step[data-step="3"] {
        display: none !important;
    }

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

    .result-card-highlight {
        background: #0f1c2e !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: white;
    }
}
