:root {
  --bg: #0F2A23;
  --card: #0B1F1A;
  --card2: #112920;
  --gold: #C6A55C;
  --gold-2: #E0C27A;
  --text: #F5F5F5;
  --muted: #A8B3AE;
  --danger: #e05c5c;
  --topbar-h: 58px;
  --total-bar-h: 56px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 15% 5%, rgba(198,165,92,0.12), transparent 45%),
    radial-gradient(70% 110% at 85% 20%, rgba(198,165,92,0.09), transparent 58%),
    linear-gradient(180deg, #0f2a23, #0b1f1a);
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid rgba(198,165,92,0.22);
  background: rgba(11,31,26,0.92);
  backdrop-filter: blur(10px);
}

.logo { display: inline-flex; align-items: center; text-decoration: none; }
.logo-mark { height: 34px; width: auto; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-btn {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}
.link-btn:hover { color: var(--gold); }

#lang {
  background: transparent;
  border: 1px solid rgba(198,165,92,0.35);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
#lang:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ================================================================
   STEP PROGRESS BAR
   ================================================================ */
.calc-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px 16px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.calc-steps::-webkit-scrollbar { display: none; }

.cs-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 52px;
  flex-shrink: 0;
}

.cs-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(198,165,92,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  transition: background 0.2s, border-color 0.2s;
}
.cs-dot span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s;
}

.cs-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  max-width: 56px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

/* Active step */
.cs-step.is-active .cs-dot {
  background: var(--gold);
  border-color: var(--gold);
}
.cs-step.is-active .cs-dot span { color: #0f2a23; }
.cs-step.is-active .cs-label { color: var(--gold); font-weight: 600; }

/* Done step */
.cs-step.is-done .cs-dot {
  background: rgba(198,165,92,0.25);
  border-color: var(--gold);
}
.cs-step.is-done .cs-dot span { color: var(--gold); }
.cs-step.is-done .cs-label { color: var(--gold-2); }

/* Connector line between steps */
.cs-connector {
  flex: 1;
  height: 2px;
  background: rgba(198,165,92,0.2);
  margin-bottom: 22px;
  min-width: 12px;
  max-width: 40px;
  transition: background 0.2s;
}
.cs-connector.is-done { background: rgba(198,165,92,0.55); }

/* ================================================================
   MAIN WIZARD AREA
   ================================================================ */
.calc-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px calc(var(--total-bar-h) + 24px);
}

/* ── Panel (one step) ── */
.calc-panel { display: none; }
.calc-panel.is-active { display: block; }

.cp-header { margin-bottom: 20px; padding-top: 8px; }
.cp-title {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.cp-sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}

/* ================================================================
   PRODUCT GRID
   ================================================================ */
.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

/* ── Product card ── */
.cp-card {
  position: relative;
  background: var(--card);
  border: 1.5px solid rgba(198,165,92,0.15);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  display: flex;
  flex-direction: column;
}
.cp-card:hover { border-color: rgba(198,165,92,0.4); transform: translateY(-2px); }
.cp-card.is-selected {
  border-color: var(--gold);
  background: rgba(198,165,92,0.08);
}
.cp-card.is-selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: var(--gold);
  color: #0f2a23;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
}

.cp-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: rgba(255,255,255,0.03);
  padding: 8px;
}
.cp-card-img[src=""],
.cp-card-img:not([src]) { display: none; }

.cp-card-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cp-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cp-card-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: auto;
}

/* ── Qty controls (appear when card is selected) ── */
.cp-qty {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px 8px;
  border-top: 1px solid rgba(198,165,92,0.15);
}
.cp-card.is-selected .cp-qty { display: flex; }

.cp-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(198,165,92,0.4);
  background: transparent;
  color: var(--gold);
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  font-family: inherit;
}
.cp-qty-btn:hover { background: rgba(198,165,92,0.15); }
.cp-qty-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  min-width: 20px;
  text-align: center;
}

/* ================================================================
   STEP ACTIONS (bottom of each panel)
   ================================================================ */
.cp-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
  flex-wrap: wrap;
}

.btn-back {
  background: transparent;
  border: 1px solid rgba(198,165,92,0.35);
  color: var(--muted);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.btn-back:hover { border-color: var(--gold); color: var(--text); }

.btn-skip {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  margin-left: auto;
}
.btn-skip:hover { color: var(--text); }

.btn-next {
  background: var(--gold);
  border: none;
  color: #0f2a23;
  padding: 10px 28px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.btn-next:hover { background: var(--gold-2); }

.btn-submit {
  background: var(--gold);
  border: none;
  color: #0f2a23;
  padding: 12px 32px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}
.btn-submit:hover { background: var(--gold-2); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ================================================================
   CART SUMMARY (step 7)
   ================================================================ */
.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid rgba(198,165,92,0.12);
  border-radius: 10px;
  padding: 10px 14px;
}

.cart-item-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  flex-shrink: 0;
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-meta { font-size: 0.78rem; color: var(--muted); }

.cart-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

.cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
  font-size: 0.9rem;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid rgba(198,165,92,0.25);
  border-bottom: 1px solid rgba(198,165,92,0.25);
  margin-bottom: 24px;
}
#cart-total-label { font-size: 1rem; color: var(--muted); }
#cart-grand-total { font-size: 1.4rem; font-weight: 800; color: var(--gold); }

/* ── Contact form ── */
.contact-form { display: flex; flex-direction: column; gap: 16px; }

.cf-field { display: flex; flex-direction: column; gap: 6px; }

.cf-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.cf-field input {
  background: var(--card);
  border: 1.5px solid rgba(198,165,92,0.25);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}
.cf-field input:focus { border-color: var(--gold); }
.cf-field input.is-invalid { border-color: var(--danger); }

.cf-err {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0;
}

.cf-actions { margin-top: 4px; }

/* ================================================================
   RUNNING TOTAL BAR (sticky bottom)
   ================================================================ */
.calc-total-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--total-bar-h);
  background: rgba(11,31,26,0.96);
  border-top: 1px solid rgba(198,165,92,0.28);
  backdrop-filter: blur(12px);
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.ctb-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 860px;
  width: 100%;
}

.ctb-label { font-size: 0.85rem; color: var(--muted); }
.ctb-amount { font-size: 1.15rem; font-weight: 800; color: var(--gold); }
.ctb-items { font-size: 0.78rem; color: var(--muted); margin-left: auto; }

/* ================================================================
   POST-SUBMIT POPUP
   ================================================================ */
.calc-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.calc-popup-overlay[hidden] { display: none; }

.calc-popup-box {
  background: var(--card2);
  border: 1px solid rgba(198,165,92,0.3);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: popIn 0.22s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}

.popup-total-block {
  background: rgba(198,165,92,0.08);
  border: 1px solid rgba(198,165,92,0.25);
  border-radius: 12px;
  padding: 18px 16px 14px;
  margin-bottom: 20px;
}
.popup-total-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.popup-total-amount {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1.1;
  margin-bottom: 12px;
}
.popup-discount-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.popup-badge {
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 10px;
  letter-spacing: 0.02em;
}
.popup-badge--discount {
  background: rgba(220,60,60,0.18);
  color: #ff6b6b;
  border: 1px solid rgba(220,60,60,0.35);
}
.popup-badge--bonus {
  background: rgba(80,200,120,0.15);
  color: #5cb85c;
  border: 1px solid rgba(80,200,120,0.3);
}

.popup-heading {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.3;
}

.popup-sub {
  margin: 0 0 22px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.popup-contacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.popup-tg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #2AABEE;
  color: #fff;
  border-radius: 10px;
  padding: 13px 20px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.popup-tg-btn:hover { opacity: 0.9; }
.popup-tg-btn--secondary {
  background: rgba(42,171,238,0.15);
  color: #2AABEE;
  border: 1px solid rgba(42,171,238,0.4);
}

.popup-order-id {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 16px;
}

.popup-close {
  background: transparent;
  border: 1px solid rgba(198,165,92,0.3);
  color: var(--muted);
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.popup-close:hover { border-color: var(--gold); color: var(--text); }

/* ================================================================
   CONTACT GATE MODAL
   ================================================================ */
.contact-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.contact-gate-overlay[hidden] { display: none; }

.contact-gate-box {
  background: var(--card2);
  border: 1px solid rgba(198,165,92,0.3);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  animation: popIn 0.22s ease-out;
}
.contact-gate-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold);
}
.contact-gate-sub {
  margin: 0 0 20px;
  font-size: 0.88rem;
  color: var(--muted);
}
.btn-gate-close {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: 1px solid rgba(198,165,92,0.25);
  color: var(--muted);
  padding: 10px;
  border-radius: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-gate-close:hover { border-color: var(--gold); color: var(--text); }

/* ================================================================
   RESULT PAGE (step 7)
   ================================================================ */
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid rgba(198,165,92,0.2);
  margin-top: 8px;
  font-size: 1rem;
  color: var(--muted);
}
#cart-grand-total { font-size: 1.4rem; font-weight: 800; color: var(--gold); }

.result-promo-block {
  background: rgba(198,165,92,0.07);
  border: 1px dashed rgba(198,165,92,0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
  text-align: center;
}
.result-promo-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.result-badge {
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 12px;
}
.result-badge--discount {
  background: rgba(220,60,60,0.15);
  color: #ff6b6b;
  border: 1px solid rgba(220,60,60,0.3);
}
.result-badge--bonus {
  background: rgba(80,200,120,0.13);
  color: #5cb85c;
  border: 1px solid rgba(80,200,120,0.28);
}
.result-promo-cta {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold);
}
.result-contacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 480px) {
  .cp-title { font-size: 1.2rem; }
  .cp-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .calc-popup-box { padding: 24px 18px; }
  .popup-heading { font-size: 1.1rem; }
  .cs-label { display: none; }
  .cs-dot { width: 28px; height: 28px; }
  .cs-connector { min-width: 8px; max-width: 24px; }
}

@media (min-width: 600px) {
  .cp-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
}

@media (min-width: 860px) {
  .calc-main { padding-left: 24px; padding-right: 24px; }
  .cp-title { font-size: 1.6rem; }
}
