/* ============================================================
   Thunder TV — Order Form
   Clean, minimal white design matching tvnado-us.com style
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #1a7efb;
  --blue-dk: #1568d8;
  --navy:    #150e50;
  --white:   #ffffff;
  --off:     #f5f6f8;
  --text:    #1a1a1a;
  --muted:   #888888;
  --bdr:     #e0e0e0;
  --red:     #e53935;
  --radius:  6px;
  --tr:      0.15s ease;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--off);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  padding-bottom: 80px; /* space for sticky bar */
}

/* ── NAV ── */
.o-nav {
  background: var(--white);
  border-bottom: 1px solid var(--bdr);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.o-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.o-nav-logo svg { width: 32px; height: 32px; }

.o-nav-brand {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.3px;
}

.o-nav-brand span { color: var(--blue); }

.o-nav-back {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--tr);
}

.o-nav-back:hover { color: var(--blue); }
.o-nav-back svg   { width: 15px; height: 15px; }

/* ── PAGE WRAPPER ── */
.o-main {
  max-width: 680px;
  margin: 36px auto;
  padding: 0 16px;
}

/* ── CARD ── */
.o-card {
  background: var(--white);
  border-radius: 10px;
  padding: 36px 40px 44px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

/* ── TITLE ── */
.o-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: -.4px;
}

/* ── ERROR ── */
.o-error {
  background: #fff2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .83rem;
  margin-bottom: 18px;
}

.o-error[hidden] { display: none; }

/* ── FIELD ── */
.o-field { margin-bottom: 20px; }

.o-label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}

.o-req { color: var(--red); margin-left: 2px; }

/* ── TYPE-OF-LINE TOGGLE ── */
.o-toggle-group {
  display: flex;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}

.o-toggle {
  padding: 9px 18px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  border-right: 1px solid var(--bdr);
  user-select: none;
  transition: background var(--tr), color var(--tr);
  white-space: nowrap;
}

.o-toggle:last-child { border-right: none; }
.o-toggle input      { display: none; }
.o-toggle.active     { background: var(--blue); color: #fff; }
.o-toggle:not(.active):hover { background: #f0f5ff; }

/* ── SELECT ── */
.o-select-wrap { position: relative; }

.o-select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  padding: 11px 40px 11px 13px;
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.o-select-wrap select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,126,251,.1);
}

.o-select-wrap select option[value=""][disabled] { color: #aaa; }

.o-select-arrow {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

/* ── TEXT INPUT ── */
.o-input {
  width: 100%;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.o-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,126,251,.1);
}

.o-input::placeholder { color: #bbb; }

/* ── HINT ── */
.o-hint {
  font-size: .78rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 5px;
  line-height: 1.5;
}

/* ── TOTAL PRICE ROW ── */
.o-total-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 20px;
  font-size: 1rem;
}

.o-total-label { color: var(--text); font-weight: 500; }

.o-total-price {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

/* ── PAYMENT METHOD ── */
.o-pay-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.o-pay {
  padding: 8px 18px;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--tr), background var(--tr), color var(--tr);
  white-space: nowrap;
}

.o-pay input    { display: none; }
.o-pay.active   { border-color: var(--blue); background: #eef5ff; color: var(--blue); }
.o-pay:not(.active):hover { border-color: #93c5fd; background: #f8fbff; }

/* ── INVOICE NOTE ── */
.o-invoice-note {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.6;
}

/* ── STICKY BOTTOM BAR ── */
.o-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--bdr);
  padding: 12px 5%;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}

.o-sticky-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

/* ── ORDER BUTTON ── */
.o-btn-order {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 52px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 200px;
  text-align: center;
  transition: background var(--tr), box-shadow var(--tr), transform var(--tr);
  box-shadow: 0 3px 12px rgba(26,126,251,.3);
}

.o-btn-order:hover    { background: var(--blue-dk); box-shadow: 0 5px 18px rgba(26,126,251,.4); transform: translateY(-1px); }
.o-btn-order:active   { transform: translateY(0); }
.o-btn-order:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ── SUCCESS OVERLAY ── */
.o-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadein .2s ease;
}

.o-overlay[hidden] { display: none; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.o-success-box {
  background: var(--white);
  border-radius: 10px;
  padding: 40px 36px 36px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: popup .2s ease;
}

@keyframes popup {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.o-success-icon {
  width: 58px;
  height: 58px;
  background: #22c55e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.o-success-icon svg { width: 26px; height: 26px; }

.o-success-box h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text);
}

.o-success-box p {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.o-success-details {
  text-align: left;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
}

.o-srow {
  display: flex;
  justify-content: space-between;
  padding: 8px 13px;
  font-size: .81rem;
  border-bottom: 1px solid var(--bdr);
}

.o-srow:last-child { border-bottom: none; }
.o-srow span  { color: var(--muted); }
.o-srow strong { color: var(--text); font-weight: 600; max-width: 60%; text-align: right; word-break: break-word; }

/* ── CONDITIONAL FIELD ── */
.o-field-cond[hidden] { display: none; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .o-card     { padding: 24px 18px 32px; }
  .o-title    { font-size: 1.3rem; margin-bottom: 22px; }
  .o-toggle-group { flex-direction: column; width: 100%; }
  .o-toggle   { border-right: none; border-bottom: 1px solid var(--bdr); text-align: center; }
  .o-toggle:last-child { border-bottom: none; }
  .o-pay-group { flex-direction: column; }
  .o-btn-order { width: 100%; min-width: unset; }
  .o-sticky-inner { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================
   DYNAMIC DEVICE SLOTS
   ============================================================ */

/* Container that holds all N device slots */
#device-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual slot */
.o-device-slot {
  background: #f9faff;
  border: 1px solid #dce8ff;
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  transition: border-color var(--tr);
}

.o-device-slot:focus-within {
  border-color: var(--blue);
}

/* Slot label — e.g. "Device 2 of 3 *" */
.o-slot-label {
  font-size: .82rem !important;
  color: #444 !important;
  margin-bottom: 8px !important;
}

/* Number badge on multi-slot label */
.o-slot-label::before {
  content: attr(data-badge);
}

/* ============================================================
   CHANNELS PICKER — qty selector + tag-input + progress bar
   ============================================================ */

/* Qty row */
.cp-qty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.cp-qty-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.cp-qty-sel-wrap {
  flex: 0 0 220px;
}

.cp-qty-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  padding: 9px 36px 9px 12px;
  font-family: inherit;
  font-size: .88rem;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}

.cp-qty-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,126,251,.1);
}

/* Outer wrapper */
.cp-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Tag-input box */
.cp-input-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 44px;
  border: 1px solid var(--bdr);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 7px 36px 7px 10px;
  background: var(--white);
  cursor: pointer;
  position: relative;
  transition: border-color var(--tr), box-shadow var(--tr);
  user-select: none;
}

.cp-input-box.cp-open {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,126,251,.1);
  border-radius: var(--radius) var(--radius) 0 0;
}

.cp-placeholder {
  color: #bbb;
  font-size: .88rem;
  pointer-events: none;
}

.cp-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  color: var(--muted);
  pointer-events: none;
  line-height: 1;
}

/* Tags (selected countries) */
.cp-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #3d3d3d;
  color: #fff;
  border-radius: 99px;
  padding: 3px 10px 3px 12px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-tag-rm {
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  padding: 0 2px;
  display: flex;
  align-items: center;
  transition: color var(--tr);
}

.cp-tag-rm:hover { color: #fff; }

/* Dropdown panel */
.cp-panel {
  border: 1px solid var(--blue);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--white);
  box-shadow: 0 8px 24px rgba(26,126,251,.1);
  overflow: hidden;
}

.cp-panel[hidden] { display: none; }

/* Search inside panel */
.cp-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--bdr);
  background: #fafbff;
}

.cp-search-input {
  width: 100%;
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: inherit;
  font-size: .85rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--tr);
}

.cp-search-input:focus { border-color: var(--blue); }

/* List */
.cp-list {
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cp-list::-webkit-scrollbar { width: 5px; }
.cp-list::-webkit-scrollbar-track { background: #f5f5f5; }
.cp-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* Group separator */
.cp-group-sep {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 8px 14px 4px;
  background: #f9f9f9;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Country row */
.cp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background var(--tr);
}

.cp-row:last-child { border-bottom: none; }
.cp-row:hover { background: #f0f6ff; }

.cp-row-selected { background: #eef4ff !important; }
.cp-row-selected .cp-row-name { color: var(--blue); font-weight: 600; }

.cp-row-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.cp-row-name {
  font-size: .88rem;
  color: var(--text);
}

.cp-row-hint {
  font-size: .75rem;
  color: var(--muted);
  display: none;
}

/* Panel bottom hint */
.cp-panel-hint {
  font-size: .75rem;
  color: var(--muted);
  font-style: italic;
  padding: 8px 14px;
  border-top: 1px solid var(--bdr);
  background: #fafbff;
}

/* Progress bar */
.cp-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.cp-progress-bar-bg {
  flex: 1;
  height: 6px;
  background: #e8ecf0;
  border-radius: 99px;
  overflow: hidden;
}

.cp-progress-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
  transition: width .25s ease, background .25s ease;
}

.cp-progress-text {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

@media (max-width: 600px) {
  .cp-qty-row { flex-direction: column; align-items: flex-start; }
  .cp-qty-sel-wrap { flex: none; width: 100%; }
  .cp-list { max-height: 200px; }
}

/* ============================================================
   ORDER FORM — COMPREHENSIVE RESPONSIVE FIXES
   ============================================================ */

/* ── Tablet (481–768px) ── */
@media (max-width: 768px) {
  .o-main  { margin: 20px auto; padding: 0 12px; }
  .o-card  { padding: 28px 24px 36px; border-radius: 8px; }
  .o-title { font-size: 1.45rem; margin-bottom: 26px; }
}

/* ── Small phone (≤480px) ── */
@media (max-width: 480px) {
  .o-main  { margin: 12px auto; padding: 0 8px; }
  .o-card  { padding: 20px 14px 28px; border-radius: 6px; box-shadow: none; border: none; }
  .o-title { font-size: 1.25rem; margin-bottom: 20px; }
  .o-label { font-size: .82rem; }
  .o-input,
  .o-select-wrap select { padding: 10px 11px; font-size: .86rem; }
  .o-toggle { padding: 10px 14px; font-size: .82rem; }
  .o-pay    { padding: 9px 14px;  font-size: .82rem; }
  .o-total-row  { margin: 2px 0 16px; }
  .o-total-price { font-size: 1.15rem; }
  .o-invoice-note { font-size: .78rem; }
  body { padding-bottom: 72px; }
}

/* ── Device slots ── */
@media (max-width: 640px) {
  .o-dslot     { padding: 12px 14px 10px; }
  .o-dslot-hd  { font-size: .7rem; margin-bottom: 10px; }
  .o-device-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .o-device-chip-inner { padding: 10px 6px 8px; min-height: 58px; }
  .o-device-chip-icon  { font-size: 1.1rem; }
}

@media (max-width: 420px) {
  .o-device-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Channels picker ── */
@media (max-width: 480px) {
  .cp-input-box { min-height: 40px; padding: 6px 32px 6px 8px; }
  .cp-tag       { font-size: .72rem; padding: 2px 8px 2px 10px; max-width: 130px; }
  .cp-placeholder { font-size: .82rem; }
  .cp-list      { max-height: 180px; }
  .cp-row       { padding: 9px 10px; }
  .cp-row-name  { font-size: .82rem; }
  .cp-group-sep { font-size: .62rem; padding: 6px 10px 3px; }
  .cp-search-input { padding: 7px 10px; font-size: .82rem; }
  .cp-panel-hint { font-size: .7rem; padding: 6px 10px; }
  .cp-counter   { font-size: .72rem; margin-top: 6px; }
}

/* ── Success overlay ── */
@media (max-width: 480px) {
  .o-success-box  { padding: 28px 18px 24px; border-radius: 8px; }
  .o-success-box h2 { font-size: 1.1rem; }
  .o-success-box p  { font-size: .8rem; }
  .o-srow { padding: 7px 10px; font-size: .78rem; }
}

/* ── Sticky bar ── */
@media (max-width: 480px) {
  .o-sticky-bar   { padding: 10px 4%; }
  .o-btn-order    { padding: 12px 20px; font-size: .88rem; min-width: unset; }
}

/* ── Nav on order pages ── */
@media (max-width: 480px) {
  .o-nav          { padding: 0 4%; height: 56px; }
  .o-nav-logo svg { width: 28px; height: 28px; }
  .o-nav-brand    { font-size: 1rem; }
  .o-nav-back     { font-size: .76rem; }
}
