/* Shared calculator UI — client portal + public page */

body.page-calculator-public {
    background-color: var(--bg, #f8fafc);
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
}

[data-theme="dark"] body.page-calculator-public {
    background-color: var(--bg, #0f172a);
    background-image:
        linear-gradient(rgba(96, 165, 250, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(96, 165, 250, 0.06) 1px, transparent 1px);
}

/* Hero */
.calc-page-hero {
    position: relative;
    padding: 128px 0 40px;
    text-align: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--bg, #fff);
}

.calc-page-hero__bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.calc-page-hero__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
}

.calc-page-hero__orb--1 {
    width: 420px;
    height: 420px;
    background: rgba(59, 130, 246, 0.22);
    top: -180px;
    left: 10%;
}

.calc-page-hero__orb--2 {
    width: 320px;
    height: 320px;
    background: rgba(139, 92, 246, 0.16);
    top: -120px;
    right: 8%;
}

.calc-page-hero .container {
    position: relative;
    z-index: 1;
}

.calc-page-hero h1 {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    color: var(--text-main, var(--text, #1e293b));
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.calc-page-hero p {
    font-size: 16px;
    color: var(--text-muted, var(--text-secondary, #64748b));
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.65;
}

.calc-hero-actions {
    margin-top: 18px;
}

.calc-hero-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.calc-hero-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Page wrap + stepper */
.calc-page-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.calc-how-it-works {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin: 24px 0 28px;
    padding: 14px 18px 12px;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.95), rgba(248, 250, 252, 0.98));
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    position: relative;
    box-shadow: 0 8px 24px -12px rgba(59, 130, 246, 0.15);
}

.calc-how-track {
    position: absolute;
    top: 28px;
    left: 18%;
    right: 18%;
    height: 3px;
    background: rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    overflow: hidden;
    z-index: 0;
    transform: translateY(-50%);
    pointer-events: none;
}

.calc-how-track-fill {
    height: 100%;
    width: 8%;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    border-radius: 999px;
    transition: width 0.28s ease;
}

.calc-how-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    position: relative;
    z-index: 1;
    min-width: 0;
    text-align: center;
    padding: 0 2px;
}

.calc-how-step__label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    max-width: 11em;
    white-space: normal;
}

.calc-how-step__num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(239, 246, 255, 0.98);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.calc-how-step.is-active .calc-how-step__num {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(239, 246, 255, 0.98), 0 0 0 7px rgba(59, 130, 246, 0.22);
}

.calc-how-step.is-active .calc-how-step__label {
    color: #1e293b;
}

.calc-how-step.is-done .calc-how-step__num {
    background: #dcfce7;
    color: #059669;
    font-size: 0;
    box-shadow: 0 0 0 4px rgba(239, 246, 255, 0.98);
}

.calc-how-step.is-done .calc-how-step__num::after {
    content: '✓';
    font-size: 12px;
    font-weight: 700;
}

.calc-how-step.is-done .calc-how-step__label {
    color: #059669;
}

.calc-how-step.is-pending .calc-how-step__num {
    background: #f1f5f9;
    color: #94a3b8;
}

.calc-main {
    padding: 0 0 80px;
}

.calc-container {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.calc-form {
    flex: 1;
    min-width: 0;
}

.calc-summary {
    width: 340px;
    flex-shrink: 0;
    background: #fff;
    padding: 0;
    border-radius: 18px;
    border: 1px solid var(--border, #e2e8f0);
    position: sticky;
    top: 96px;
    box-shadow: 0 16px 40px -12px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}

.calc-summary::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #6366f1, #8b5cf6);
}

.calc-summary-title,
.calc-summary-meta,
#summary-items,
.summary-total,
.summary-disclaimer,
.calc-submit-form {
    padding-left: 22px;
    padding-right: 22px;
}

.calc-summary-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main, var(--text, #1e293b));
    margin: 18px 0 4px;
    padding-top: 0;
}

.calc-summary-meta {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.calc-section {
    background: #fff;
    padding: 20px 20px 18px;
    border-radius: 16px;
    border: 1px solid var(--border, #e2e8f0);
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.calc-section:hover {
    box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.08);
}

.calc-section--active {
    border-color: #93c5fd;
    box-shadow: 0 8px 28px -8px rgba(59, 130, 246, 0.18);
}

.calc-section-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.calc-section-step {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    flex-shrink: 0;
    background: #f1f5f9;
    color: var(--text-muted, #64748b);
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.calc-section--active .calc-section-step {
    background: var(--primary);
    color: #fff;
}

.calc-section-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main, var(--text, #1e293b));
    border: none;
    padding: 0;
}

.calc-section-hint {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    font-weight: 500;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

#summary-items {
    min-height: 72px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 0;
    padding: 10px 0;
    font-size: 13px;
    line-height: 1.45;
    border-bottom: 1px dashed #e2e8f0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item__label {
    flex: 1;
    min-width: 0;
    color: var(--text-muted, #64748b);
    word-break: break-word;
}

.summary-item__value {
    flex-shrink: 0;
    font-weight: 700;
    color: var(--text-main, var(--text, #1e293b));
    white-space: nowrap;
}

.summary-item__value--included {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    background: #dcfce7;
    padding: 3px 9px;
    border-radius: 999px;
}

.summary-item__value--price {
    color: var(--primary);
    font-size: 14px;
}

.summary-empty {
    color: var(--text-muted, #64748b);
    font-size: 13px;
    text-align: center;
    padding: 28px 8px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 16px;
    padding-top: 16px;
    padding-bottom: 4px;
    border-top: 2px solid #e2e8f0;
}

.summary-total__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main, var(--text, #1e293b));
}

.summary-total__amount {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.summary-total__price {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.summary-total__tax {
    font-size: 13px;
    color: var(--text-muted, #64748b);
    font-weight: 600;
}

.summary-disclaimer {
    font-size: 11px;
    color: var(--text-muted, #64748b);
    margin-top: 6px;
    padding-bottom: 8px;
    text-align: right;
    font-style: italic;
}

.option-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    background: #fafbfc;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.option-card:hover {
    border-color: #93c5fd;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.15);
}

.option-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.option-card.selected {
    border-color: var(--primary);
    background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.14);
}

.option-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-main, var(--text, #1e293b));
    line-height: 1.4;
    padding-right: 28px;
}

.option-price {
    font-weight: 800;
    color: var(--primary);
    font-size: 17px;
    margin-top: auto;
}

.option-check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.option-card.selected .option-check {
    border-color: var(--primary);
    background: var(--primary);
}

.option-card.selected .option-check::after {
    content: '✓';
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.option-card.checkbox-style .option-check {
    border-radius: 6px;
}

.option-card.auto-included::after {
    content: "Included in base price";
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 10px;
    color: var(--primary);
    font-weight: 600;
}

.option-card.auto-included.checkbox-style {
    pointer-events: none;
}

.option-card.auto-included.selected {
    border-color: #cbd5e1;
    background: #f1f5f9;
    box-shadow: none;
}

.option-card.auto-included.selected .option-check {
    border-color: #94a3b8;
    background: #cbd5e1;
}

.option-card.auto-included.selected .option-price {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 15px;
}

.option-desc {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    margin-bottom: 8px;
    line-height: 1.4;
    flex-grow: 1;
}

.number-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #fafbfc;
    border: 1.5px solid #e2e8f0;
    padding: 16px 18px;
    border-radius: 14px;
    margin-bottom: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.number-input-group:focus-within {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.number-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.number-desc {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    line-height: 1.4;
}

.number-unit-price {
    font-size: 13px;
    color: var(--text-muted, #64748b);
}

.number-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-qty {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #475569;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-qty:hover {
    background: var(--primary);
    color: #fff;
}

.input-qty {
    width: 48px;
    text-align: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px;
    font-weight: 600;
    font-size: 15px;
    -moz-appearance: textfield;
}

.input-qty::-webkit-outer-spin-button,
.input-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.calc-submit-form {
    margin-top: 16px;
    padding-bottom: 22px;
}

.calc-submit-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.calc-submit-btn:disabled,
.calc-mobile-bar__submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.calc-submit-note {
    font-size: 11px;
    color: var(--text-muted, #64748b);
    text-align: center;
    margin-top: 12px;
    line-height: 1.5;
}

.calc-alt-link {
    text-align: center;
    margin-top: 10px;
    padding-bottom: 4px;
}

.calc-alt-link a {
    color: var(--text-muted, #64748b);
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
}

.calc-alt-link a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.calc-mobile-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border, #e2e8f0);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.1);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calc-mobile-bar__info {
    min-width: 0;
    flex: 1;
}

.calc-mobile-bar__price {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.calc-mobile-bar__label {
    font-size: 11px;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.calc-mobile-bar__submit {
    flex-shrink: 0;
    padding: 10px 18px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 130px;
    border-radius: 10px;
}

.calc-mobile-bar__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    body.page-calculator,
    body.page-calculator-public {
        --fab-edge: 76px;
    }
}

@media (max-width: 900px) {
    .calc-container {
        flex-direction: column;
    }

    .calc-summary {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .calc-page-hero {
        padding: 112px 16px 32px;
    }

    .calc-main {
        padding-bottom: 100px;
    }

    .calc-how-it-works {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
        padding: 12px 8px 10px;
        margin: 16px 0 20px;
    }

    .calc-how-track {
        top: 26px;
        left: 14%;
        right: 14%;
    }

    .calc-how-step {
        gap: 6px;
    }

    .calc-how-step__label {
        font-size: 10px;
        max-width: 8em;
    }

    .calc-how-step__num {
        width: 24px;
        height: 24px;
        font-size: 11px;
        box-shadow: 0 0 0 3px rgba(239, 246, 255, 0.98);
    }

    .calc-summary .calc-submit-form {
        display: none;
    }

    .calc-summary {
        order: -1;
        margin-bottom: 8px;
    }

    .calc-form {
        order: 1;
    }

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

    .calc-section {
        padding: 16px;
        margin-bottom: 12px;
    }

    .calc-section-head {
        gap: 12px;
        margin-bottom: 12px;
    }

    .calc-section-step {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .option-card {
        padding: 14px;
    }

    .calc-mobile-bar {
        display: flex;
    }

    body.page-calculator .content-area,
    body.page-calculator-public {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 600px) {
    .number-input-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .number-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .summary-total__price {
        font-size: 26px;
    }

    .calc-mobile-bar__submit {
        min-width: 110px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .calc-how-step__label {
        font-size: 11px;
    }
}

/* Dark mode */
[data-theme="dark"] .calc-page-hero {
    background: var(--bg, #0f172a);
    border-color: var(--border, #334155);
}

[data-theme="dark"] .calc-how-it-works {
    background: linear-gradient(135deg, #172554, #1e293b);
    border-color: #334155;
}

[data-theme="dark"] .calc-how-step__num {
    box-shadow: 0 0 0 4px #1e293b;
}

[data-theme="dark"] .calc-how-step.is-active .calc-how-step__num {
    box-shadow: 0 0 0 4px #1e293b, 0 0 0 7px rgba(59, 130, 246, 0.28);
}

[data-theme="dark"] .calc-how-step.is-done .calc-how-step__num {
    box-shadow: 0 0 0 4px #1e293b;
}

[data-theme="dark"] .calc-how-step.is-active .calc-how-step__label {
    color: #f1f5f9;
}

[data-theme="dark"] .calc-how-step.is-pending .calc-how-step__num {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .calc-summary,
[data-theme="dark"] .calc-section,
[data-theme="dark"] .calc-mobile-bar,
[data-theme="dark"] .option-card,
[data-theme="dark"] .number-input-group {
    background: var(--bg-elevated, #1e293b);
    border-color: var(--border, #334155);
}

[data-theme="dark"] .calc-mobile-bar {
    background: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .option-card {
    background: #0f172a;
}

[data-theme="dark"] .option-card.selected {
    background: linear-gradient(180deg, #172554 0%, #1e293b 100%);
}

[data-theme="dark"] .calc-how-step {
    color: #cbd5e1;
}

[data-theme="dark"] .summary-item {
    border-color: #334155;
}

.calc-action-btn {
    padding: 6px 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    background: transparent;
}

/* Light Theme - Copy */
.calc-action-copy {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
}
.calc-action-copy:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Light Theme - Clear */
.calc-action-clear {
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}
.calc-action-clear:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Dark Theme Overrides */
[data-theme="dark"] .calc-action-copy {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}
[data-theme="dark"] .calc-action-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

[data-theme="dark"] .calc-action-clear {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
[data-theme="dark"] .calc-action-clear:hover {
    background: rgba(239, 68, 68, 0.15);
}

