/* ==========================================================================
   ZheTech — Website Cost Calculator
   A custom-built, multi-step investment estimator. Not a plugin skin.
   ========================================================================== */

.calc-section { padding-block: var(--space-8) var(--space-9); }

/* ----- Shell ---------------------------------------------------------- */
.calc-shell {
    position: relative; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
    margin-top: var(--space-7);
}
.calc-shell::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-500) 60%, #9FD5CF 100%);
}

/* ----- Progress steps --------------------------------------------------- */
.calc-progress { position: relative; padding: var(--space-6) var(--space-7) var(--space-5); border-bottom: 1px solid var(--border); }
.calc-progress ol { display: flex; justify-content: space-between; gap: var(--space-2); position: relative; z-index: 1; }
.calc-progress li { flex: 1; display: flex; }
.calc-step-btn {
    display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%;
    background: none; border: 0; padding: 4px; cursor: pointer; color: var(--muted);
}
.calc-step-num {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    border: 2px solid var(--border-strong); background: var(--surface); color: var(--muted);
    font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
    transition: all var(--dur) var(--ease);
}
.calc-step-lbl { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; transition: color var(--dur) var(--ease); }
.calc-step-btn[aria-current="step"] .calc-step-num { border-color: var(--brand); background: var(--brand); color: var(--on-brand); transform: scale(1.08); }
.calc-step-btn[aria-current="step"] .calc-step-lbl { color: var(--brand); }
.calc-step-btn.is-done .calc-step-num { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.calc-step-btn.is-done .calc-step-lbl { color: var(--text-2); }
.calc-step-btn:hover .calc-step-num { border-color: var(--brand); }
.calc-step-btn:focus-visible { outline: none; }
.calc-step-btn:focus-visible .calc-step-num { box-shadow: var(--ring); }

.calc-progress-track { position: absolute; top: calc(var(--space-6) + 17px); left: var(--space-7); right: var(--space-7); height: 2px; background: var(--border); z-index: 0; }
.calc-progress-fill { display: block; height: 100%; width: 0%; background: var(--brand); transition: width .45s var(--ease); }

/* ----- Body layout: main + sticky summary -------------------------------- */
.calc-body { display: grid; grid-template-columns: 1fr 320px; gap: 0; align-items: start; }
.calc-main { padding: var(--space-7); border-right: 1px solid var(--border); min-width: 0; }

/* ----- Sliding track ------------------------------------------------------ */
.calc-viewport { overflow: hidden; }
.calc-viewport.is-animated { transition: height .35s var(--ease); }
.calc-track { display: flex; width: 500%; transition: transform .5s cubic-bezier(.22,.61,.36,1); align-items: flex-start; }
.calc-step { flex: 0 0 20%; min-width: 0; padding-right: var(--space-2); }
.calc-step[inert] { pointer-events: none; }

.calc-step-head { margin-bottom: var(--space-6); }
.calc-step-eyebrow { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
.calc-step-head h3 { font-size: var(--fs-xl); }
.calc-step-head p { color: var(--text-2); margin-top: 8px; font-size: var(--fs-sm); }

.calc-substep { margin-top: var(--space-7); }
.calc-substep h4 { font-size: var(--fs-base); font-weight: 700; }
.calc-substep-desc { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; margin-bottom: var(--space-4); }

/* ----- Option cards (radio) ------------------------------------------------ */
.calc-options { display: grid; gap: 12px; }
.calc-grid-2 { grid-template-columns: repeat(2, 1fr); }
.calc-grid-3 { grid-template-columns: repeat(3, 1fr); }

.calc-card {
    position: relative; display: flex; flex-direction: column; gap: 6px;
    padding: 16px 18px; border: 1.5px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg); cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.calc-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.calc-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.calc-card:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 4px 14px rgba(15,73,74,.10); }
.calc-card:has(input:focus-visible) { box-shadow: var(--ring); }
.calc-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.calc-card-label { font-weight: 700; font-size: var(--fs-sm); color: var(--text); line-height: 1.3; }
.calc-card-check {
    display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex: none;
    border: 1.5px solid var(--border-strong); color: transparent; background: var(--surface);
    transition: all var(--dur) var(--ease);
}
.calc-card:has(input:checked) .calc-card-check { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.calc-card-hint { font-size: var(--fs-xs); color: var(--muted); }
.calc-card-price { margin-top: auto; padding-top: 6px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-base); color: var(--brand); }
.calc-card-plain { padding: 14px 18px; }
.calc-card-plain .calc-card-price { display: none; }

/* ----- Fixed / included line ------------------------------------------------ */
.calc-fixed {
    display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px;
    background: var(--brand-tint); border: 1px solid var(--brand-500); border-radius: var(--radius);
}
.calc-fixed-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: var(--on-brand); flex: none; }
.calc-fixed-body { flex: 1; min-width: 0; }
.calc-fixed-label { display: block; font-weight: 700; font-size: var(--fs-sm); color: var(--brand-700); }
.calc-fixed-desc { display: block; color: var(--text-2); font-size: var(--fs-xs); margin-top: 4px; }
.calc-fixed-price { font-family: var(--font-display); font-weight: 700; color: var(--brand); flex: none; }

/* ----- Additional features (checkbox rows) ---------------------------------- */
.calc-chip-list { grid-template-columns: repeat(2, 1fr); }
.calc-chip {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border: 1.5px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg); cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.calc-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.calc-chip:hover { border-color: var(--brand); }
.calc-chip:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.calc-chip:has(input:focus-visible) { box-shadow: var(--ring); }
.calc-chip-box {
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; flex: none;
    border: 1.5px solid var(--border-strong); color: transparent; background: var(--surface);
    transition: all var(--dur) var(--ease);
}
.calc-chip:has(input:checked) .calc-chip-box { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.calc-chip-label { flex: 1; font-weight: 600; font-size: var(--fs-sm); }
.calc-chip-price { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); color: var(--brand); flex: none; }

/* ----- Nav buttons ----------------------------------------------------------- */
.calc-nav { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-7); }
.calc-back:disabled { opacity: 0; pointer-events: none; }
.calc-next, .calc-submit { margin-left: auto; }
/* .btn sets display:inline-flex, which otherwise beats the UA [hidden] rule */
.calc-next[hidden], .calc-submit[hidden] { display: none; }

/* ----- Sticky summary (desktop) ---------------------------------------------- */
.calc-summary { padding: var(--space-7); position: sticky; top: 96px; align-self: start; }
.calc-summary-eyebrow { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.calc-summary-total {
    font-family: var(--font-display); font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.4rem); font-weight: 700;
    color: var(--brand); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums;
}
.calc-summary-total.bump { animation: calc-bump .35s var(--ease); }
@keyframes calc-bump { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.calc-summary-lines { display: grid; gap: 10px; margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.calc-line { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); color: var(--text-2); }
.calc-line span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-line strong { color: var(--text); font-weight: 700; flex: none; }
.calc-line.is-group-title { color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin-top: 4px; }
.calc-summary-note { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--space-5); line-height: 1.5; }

/* ----- Step 5 inline review (visible on all breakpoints) --------------------- */
.calc-review { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-6); margin-bottom: var(--space-6); }
.calc-review-total { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.calc-review-total span { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.calc-review-total strong { font-family: var(--font-display); font-size: var(--fs-2xl); color: var(--brand); font-variant-numeric: tabular-nums; }
.calc-review-lines { display: grid; gap: 8px; margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }

.calc-form-status { padding: 12px 16px; border-radius: var(--radius-sm); font-size: var(--fs-sm); margin-bottom: var(--space-4); display: none; }
.calc-form-status.ok { display: block; background: var(--brand-tint); color: var(--brand-700); border: 1px solid var(--brand-500); }
.calc-form-status.err { display: block; background: #FDECEA; color: #B42318; border: 1px solid #F1B0AB; }
.calc-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--space-4); }
.calc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ----- Mobile sticky bar + sheet ---------------------------------------------- */
.calc-mobile-bar {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    align-items: center; justify-content: space-between; gap: var(--space-4);
    padding: 12px var(--space-5); padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--brand); color: var(--on-brand); box-shadow: 0 -8px 24px rgba(0,0,0,.18);
}
.cmb-info { display: flex; flex-direction: column; line-height: 1.2; }
.cmb-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.cmb-total { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); }

.calc-sheet { position: fixed; inset: 0; z-index: 200; }
.calc-sheet-backdrop { position: absolute; inset: 0; background: rgba(17,17,17,.45); }
.calc-sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 78vh; overflow-y: auto;
    background: var(--surface); border-radius: 20px 20px 0 0; padding: 14px var(--space-6) var(--space-7);
    box-shadow: 0 -20px 50px rgba(0,0,0,.25);
    transform: translateY(100%); transition: transform .35s cubic-bezier(.22,.61,.36,1);
}
.calc-sheet.is-open .calc-sheet-panel { transform: translateY(0); }
.calc-sheet-handle { display: block; width: 40px; height: 4px; border-radius: 3px; background: var(--border-strong); margin: 0 auto 14px; }
.calc-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.calc-sheet-head h3 { font-size: var(--fs-lg); }
.calc-sheet-close { background: var(--surface-2); border: 1px solid var(--border); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-2); }
.calc-sheet-total { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; color: var(--brand); }
.calc-sheet-lines { display: grid; gap: 8px; margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }

/* ----- FAQ -------------------------------------------------------------------- */
.faq-list { display: grid; gap: 12px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px var(--space-6); }
.faq-item summary {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    padding: var(--space-5) 0; cursor: pointer; font-weight: 700; font-size: var(--fs-base); list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item .faq-caret { color: var(--brand); flex: none; transition: transform var(--dur) var(--ease); transform: rotate(90deg); }
.faq-item[open] .faq-caret { transform: rotate(-90deg); }
.faq-item p { color: var(--text-2); padding-bottom: var(--space-5); margin-top: -6px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
    .calc-body { grid-template-columns: 1fr; }
    .calc-main { border-right: 0; border-bottom: 1px solid var(--border); }
    .calc-summary { position: static; display: none; } /* replaced by mobile bar + sheet */
    .calc-mobile-bar { display: flex; }
    .calc-mobile-bar[hidden] { display: none; }
}

@media (max-width: 760px) {
    .calc-progress { padding: var(--space-5) var(--space-4) var(--space-4); }
    .calc-progress-track { left: var(--space-4); right: var(--space-4); }
    .calc-step-lbl { display: none; }
    .calc-main { padding: var(--space-5); }
    .calc-grid-2, .calc-grid-3, .calc-chip-list { grid-template-columns: 1fr; }
    .calc-form-grid { grid-template-columns: 1fr; }
    .calc-nav { position: sticky; bottom: 0; background: linear-gradient(0deg, var(--surface) 60%, transparent); padding-top: var(--space-4); margin-top: var(--space-5); }
}

@media (max-width: 400px) {
    .calc-summary-total, .calc-review-total strong, .calc-sheet-total { font-size: 1.6rem; }
}

/* ----- Reduced motion ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .calc-track { transition: none; }
    .calc-viewport.is-animated { transition: none; }
    .calc-sheet-panel { transition: none; }
    .calc-summary-total.bump { animation: none; }
    .calc-card, .calc-step-num { transition: none; }
}
