/* =============================================================================
 * KTRefill — Airtime wizard theme
 *
 * TO RETHEME: change the variables in :root below. Nothing else needs editing.
 * Every colour in this file resolves to one of them.
 * ========================================================================== */

:root {
  /* Brand — sampled from buy-gift-card.php */
  --kt-bg:          #11072C;   /* page background, deepest purple           */
  --kt-bg-2:        #1D0E41;   /* radial glow behind the content            */
  --kt-surface:     #33203E;   /* pills, inactive chips                     */
  --kt-surface-2:   #241338;   /* raised panel on the dark background       */
  --kt-gold:        #F4D35E;   /* primary accent — active state, headings   */
  --kt-gold-dim:    #C9A94A;   /* gold at rest / borders                    */
  --kt-white:       #FFFFFF;   /* cards and inputs                          */
  --kt-ink:         #1A0B33;   /* text on white                             */
  --kt-ink-soft:    #6B6379;   /* secondary text on white                   */
  --kt-line:        #E7E3EE;   /* hairline on white                         */
  --kt-line-dark:   rgba(255,255,255,.12);  /* hairline on purple           */
  --kt-green:       #2FBF71;   /* valid / success                           */
  --kt-red:         #FF6B6B;   /* invalid / error                           */
  --kt-radius:      16px;
  --kt-radius-sm:   12px;
  --kt-font:        'Poppins', system-ui, -apple-system, sans-serif;
}

/* The `hidden` attribute is a UA default with very low specificity, so any
   class that sets `display` (e.g. .kt-grid { display:grid }) silently defeats
   it. This one line makes hidden actually hide. */
[hidden] { display: none !important; }

/* ── Page shell ─────────────────────────────────────────────────────────── */
.kt-page {
  /* 100vh is wrong on mobile: it measures the viewport WITHOUT the browser's
     collapsing toolbar, so the page jumps as the user scrolls. dvh tracks the
     real visible height; vh stays as the fallback for older browsers. */
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--kt-bg-2) 0%, var(--kt-bg) 60%),
    var(--kt-bg);
  font-family: var(--kt-font);
  color: var(--kt-white);
  /* The page uses viewport-fit=cover, so respect the notch and home indicator
     on iPhone X and later — otherwise content sits under them in landscape. */
  padding:
    max(48px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(80px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
.kt-wrap { max-width: 1140px; margin: 0 auto; }

.kt-h1 {
  font-size: 38px; font-weight: 700; line-height: 1.2;
  text-align: center; margin: 0 0 22px; color: var(--kt-white);
}
.kt-sub {
  text-align: center; color: rgba(255,255,255,.62);
  font-size: 15px; margin: -12px 0 26px;
}

/* ── Progress pills ─────────────────────────────────────────────────────── */
.kt-steps {
  display: flex; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin: 0 0 30px;
}
.kt-step {
  display: flex; align-items: center; gap: 9px;
  background: var(--kt-surface-2);
  border: 1px solid var(--kt-line-dark);
  border-radius: 999px; padding: 9px 18px 9px 9px;
  transition: border-color .2s, background .2s;
}
.kt-step-no {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.10);
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,.75);
}
.kt-step-label {
  font-size: 12px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: rgba(255,255,255,.5);
}
.kt-step.is-active {
  border-color: var(--kt-gold-dim);
  background: var(--kt-surface);
}
.kt-step.is-active .kt-step-label { color: var(--kt-gold); }
.kt-step.is-active .kt-step-no    { background: var(--kt-gold); color: var(--kt-ink); }
.kt-step.is-done .kt-step-no      { background: rgba(244,211,94,.25); color: var(--kt-gold); }

.kt-rule { height: 1px; background: var(--kt-line-dark); margin: 0 0 26px; }

/* ── White card that holds each step ────────────────────────────────────── */
.kt-card {
  background: var(--kt-white);
  border-radius: var(--kt-radius);
  padding: 30px 28px;
  color: var(--kt-ink);
}
.kt-card-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; color: var(--kt-ink); }
.kt-card-sub   { font-size: 14px; color: var(--kt-ink-soft); margin: 0 0 22px; }
.kt-label {
  font-size: 11px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--kt-ink-soft);
  display: block; margin: 0 0 8px;
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.kt-input, .kt-search {
  width: 100%; border: 1.5px solid var(--kt-line);
  border-radius: var(--kt-radius-sm); padding: 14px 16px;
  font-family: inherit; font-size: 15px; color: var(--kt-ink);
  background: #FAFAFA; outline: none; transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
}
.kt-input:focus, .kt-search:focus { border-color: var(--kt-gold-dim); background: #fff; }
.kt-input::placeholder, .kt-search::placeholder { color: #A9A3B5; }

/* Number spinners are unusable on touch */
.kt-input[type=number]::-webkit-outer-spin-button,
.kt-input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.kt-input[type=number] { -moz-appearance: textfield; }

.kt-phone-row {
  display: flex; border: 1.5px solid var(--kt-line);
  border-radius: var(--kt-radius-sm); overflow: hidden; background: #FAFAFA;
  transition: border-color .15s;
}
.kt-phone-row:focus-within { border-color: var(--kt-gold-dim); background: #fff; }
.kt-dial {
  padding: 14px 16px; background: #F1EEF7; color: var(--kt-ink);
  font-weight: 600; font-size: 15px; border-right: 1px solid var(--kt-line);
  white-space: nowrap;
}
.kt-phone-row .kt-input { border: 0; background: transparent; }

.kt-hint { font-size: 13px; color: var(--kt-ink-soft); margin: 8px 0 0; }
.kt-hint.is-good { color: var(--kt-green); font-weight: 600; }
.kt-hint.is-bad  { color: #D64545;        font-weight: 600; }

/* ── Country dropdown ───────────────────────────────────────────────────── */
.kt-select { position: relative; }
.kt-panel {
  position: absolute; z-index: 40; inset-inline: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--kt-line);
  border-radius: var(--kt-radius-sm); max-height: 300px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 12px 30px rgba(17,7,44,.16);
}
.kt-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; font-size: 15px;
  border-bottom: 1px solid var(--kt-line); color: var(--kt-ink);
}
.kt-opt:last-child { border-bottom: 0; }
.kt-opt:hover      { background: #F7F4FD; }
.kt-opt-empty      { padding: 18px 16px; color: var(--kt-ink-soft); font-size: 14px; text-align: center; }
.kt-country-input { position: relative; }
.kt-country-input .kt-search { padding-left: 52px; }
.kt-country-flag-selected {
  position: absolute; z-index: 1; top: 50%; left: 16px;
  width: 22px; height: 16px; transform: translateY(-50%);
}
.kt-country-flag-image {
  width: 22px;
  height: 16px;
  flex: 0 0 22px;
  object-fit: cover;
  display: block;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(26,11,51,.12);
}

/* ── Country flags ──────────────────────────────────────────────────────── */
.kt-country-flags {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--kt-line-dark);
  border-radius: var(--kt-radius);
  background: rgba(29, 14, 65, .72);
}
.kt-country-flags h2 {
  margin: 0 0 5px;
  color: var(--kt-white);
  font-size: 20px;
}
.kt-country-flags > p {
  margin: 0 0 18px;
  color: rgba(255,255,255,.62);
  font-size: 13px;
}
.kt-flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  max-height: 470px;
  overflow-y: auto;
  padding-right: 4px;
}
.kt-flag {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--kt-line-dark);
  border-radius: var(--kt-radius-sm);
  background: rgba(255,255,255,.06);
  color: var(--kt-white);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.kt-flag:hover, .kt-flag:focus-visible {
  border-color: var(--kt-gold-dim);
  background: rgba(244,211,94,.12);
  transform: translateY(-1px);
  outline: none;
}
.kt-flag.is-selected {
  border-color: var(--kt-gold);
  background: rgba(244,211,94,.18);
}
.kt-flag-image { width: 28px; height: 21px; flex: 0 0 28px; object-fit: cover; display: block; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.kt-flag-name { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

/* ── Operator rows ──────────────────────────────────────────────────────── */
.kt-op {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--kt-line); border-radius: var(--kt-radius-sm);
  padding: 14px 16px; margin: 0 0 10px; cursor: pointer;
  background: #fff; transition: border-color .15s, background .15s;
}
.kt-op:hover, .kt-op.is-selected { border-color: var(--kt-gold-dim); background: #FFFDF5; }
.kt-op-logo {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 10px;
  object-fit: contain; background: #F4F1FA; display: grid; place-items: center;
  font-size: 20px;
}
.kt-op-body { min-width: 0; }
.kt-op-name {
  font-size: 15px; font-weight: 600; color: var(--kt-ink);
  margin: 0 0 6px; overflow-wrap: anywhere;
}
.kt-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kt-tag {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; white-space: nowrap;
}
.kt-tag--direct { background: #E6F7EE; color: #1B7A48; }
.kt-tag--pin    { background: #FDF3D8; color: #8A6A12; }
.kt-tag--plans  { background: #EFE9FB; color: #5A3E9B; }

.kt-detected { font-size: 12px; color: var(--kt-ink-soft); margin: 0 0 12px; }

/* ── Plan + amount + type grids ─────────────────────────────────────────── */
.kt-grid       { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kt-grid--two  { grid-template-columns: repeat(2, 1fr); }
.kt-chip {
  border: 2px solid var(--kt-line); border-radius: var(--kt-radius-sm);
  background: #fff; padding: 14px 8px; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--kt-ink);
  transition: all .15s; text-align: center;
}
.kt-chip:hover, .kt-chip.is-selected {
  border-color: var(--kt-gold-dim); background: #FFFBEF;
}
.kt-chip-main { font-size: 17px; font-weight: 700; color: var(--kt-ink); display: block; }
.kt-chip-sub  { font-size: 11px; color: var(--kt-ink-soft); display: block; margin-top: 2px; }

.kt-type {
  border: 2px solid var(--kt-line); border-radius: var(--kt-radius-sm);
  background: #fff; padding: 22px 14px; cursor: pointer;
  font-family: inherit; text-align: center; transition: all .15s;
}
.kt-type:hover        { border-color: var(--kt-gold-dim); }
.kt-type.is-selected  { border-color: var(--kt-gold-dim); background: #FFFBEF; }
.kt-type-ico  { font-size: 26px; line-height: 1; }
.kt-type-name { font-size: 15px; font-weight: 700; color: var(--kt-ink); margin: 10px 0 5px; }
.kt-type-desc { font-size: 12.5px; color: var(--kt-ink-soft); line-height: 1.45; margin: 0; }

/* ── Summary + review ───────────────────────────────────────────────────── */
.kt-summary {
  border: 1px solid var(--kt-line); border-radius: var(--kt-radius-sm);
  overflow: hidden; margin: 0 0 20px;
}
.kt-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--kt-line); font-size: 14px;
}
.kt-row:last-child { border-bottom: 0; }
.kt-row dt, .kt-row .k { color: var(--kt-ink-soft); margin: 0; }
.kt-row dd, .kt-row .v {
  color: var(--kt-ink); font-weight: 600; margin: 0;
  text-align: right; overflow-wrap: anywhere;
}
.kt-row .v:has(.kt-summary-flag), .kt-row .v:has(.kt-summary-operator) {
  display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 6px;
  min-width: 0; white-space: nowrap; line-height: 1.2;
}
.kt-summary-flag { width: 22px; height: 16px; object-fit: cover; border-radius: 2px; }
.kt-summary-operator {
  width: 18px !important; height: 18px !important;
  max-width: 18px !important; max-height: 18px !important;
  flex: 0 0 18px; display: block; object-fit: contain;
  border-radius: 3px; background: #F4F1FA;
}
.kt-row .v--fee { color: #B4791A; }
.kt-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 16px; background: #F7F4FD; border-top: 2px solid var(--kt-gold-dim);
}
.kt-total .k { font-size: 16px; font-weight: 700; color: var(--kt-ink); }
.kt-total .v { font-size: 26px; font-weight: 800; color: var(--kt-ink); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.kt-actions { display: flex; gap: 12px; margin: 24px 0 0; }
.kt-btn {
  flex: 1; border-radius: 999px; padding: 16px 24px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 700;
  border: 0; transition: transform .12s, opacity .15s;
  -webkit-appearance: none; appearance: none;
}
.kt-btn:active { transform: scale(.985); }
.kt-btn:disabled { opacity: .6; cursor: not-allowed; }
.kt-btn--primary { background: var(--kt-gold); color: var(--kt-ink); }
.kt-btn--primary:hover:not(:disabled) { background: #FFE07A; }
.kt-btn--ghost {
  flex: 0 0 auto; background: transparent; color: var(--kt-ink-soft);
  border: 1.5px solid var(--kt-line);
}
.kt-btn--ghost:hover { border-color: var(--kt-ink-soft); color: var(--kt-ink); }

/* ── Status + trust ─────────────────────────────────────────────────────── */
.kt-status { margin: 16px 0 0; padding: 13px 16px; border-radius: var(--kt-radius-sm); font-size: 14px; }
.kt-status--error   { background: #FDECEC; color: #B93838; border: 1px solid #F5C6C6; }
.kt-status--success { background: #E9F9F0; color: #1B7A48; border: 1px solid #BFE9D2; }

.kt-trust {
  display: flex; justify-content: center; gap: 22px; flex-wrap: wrap;
  margin: 22px 0 0; font-size: 13px; color: rgba(255,255,255,.55);
}

.kt-loading { padding: 30px 16px; text-align: center; color: var(--kt-ink-soft); font-size: 14px; }
.kt-spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--kt-line); border-top-color: var(--kt-gold-dim);
  border-radius: 50%; animation: kt-spin .8s linear infinite;
}
@keyframes kt-spin { to { transform: rotate(360deg); } }

/* =============================================================================
   RESPONSIVE — iPhone, Android, iPad, laptop
   ========================================================================== */

/* iOS Safari zooms the page when a focused input is under 16px */
@media (max-width: 1024px) {
  .kt-input, .kt-search, select, textarea { font-size: 16px !important; }
}

/* Comfortable touch targets on any touch device */
@media (hover: none) and (pointer: coarse) {
  .kt-op    { min-height: 68px; }
  .kt-chip  { min-height: 54px; }
  .kt-btn   { min-height: 52px; }
  .kt-opt   { min-height: 48px; }
  .kt-type  { min-height: 120px; }
  .kt-op:hover, .kt-chip:hover, .kt-type:hover, .kt-opt:hover { background: #fff; }
}

/* Tablet — iPad portrait and landscape */
@media (min-width: 641px) and (max-width: 1024px) {
  .kt-wrap { max-width: 700px; }
  .kt-h1   { font-size: 32px; }
}

/* Phones */
@media (max-width: 640px) {
  .kt-page  {
    padding:
      max(26px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      max(60px, env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }
  .kt-h1    { font-size: 26px; }
  .kt-card  { padding: 22px 16px; border-radius: 14px; }
  .kt-card-title { font-size: 20px; }

  .kt-steps { gap: 6px; }
  .kt-step  { padding: 7px 12px 7px 7px; gap: 7px; }
  .kt-step-no    { width: 22px; height: 22px; font-size: 11px; }
  .kt-step-label { font-size: 9.5px; letter-spacing: .4px; }

  .kt-grid  { gap: 8px; }
  .kt-type  { padding: 16px 10px; }

  /* Stack the buttons full width so they're easy to reach with a thumb */
  .kt-actions { flex-direction: column-reverse; }
  .kt-btn     { width: 100%; flex: none; }

  .kt-trust   { gap: 12px; font-size: 11.5px; }
  .kt-panel   { max-height: 50vh; }
  .kt-total .v { font-size: 22px; }
}

/* Small phones — iPhone SE, older Android */
@media (max-width: 380px) {
  .kt-grid       { grid-template-columns: repeat(2, 1fr); }
  .kt-grid--two  { grid-template-columns: 1fr; }
  .kt-step-label { display: none; }        /* numbers alone still read clearly */
  .kt-step       { padding: 7px; }
}

/* Landscape phones — short viewport */
@media (max-height: 480px) and (orientation: landscape) {
  .kt-page  { padding-top: 16px; }
  .kt-panel { max-height: 40vh; }
}

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