/* /coupon.css — Apple-ish, mobile-first form UI
   Focus: centered layout, large tap targets, clean radios, stacked inputs. */

/* ===== Design tokens ===== */
:root{
  --bg:#0b0b0c;
  --surface:rgba(255,255,255,0.06);
  --card:rgba(255,255,255,0.12);
  --border:rgba(255,255,255,0.16);
  --text:#fff;
  --text-dim:rgba(255,255,255,0.76);
  --accent:#0a84ff;
  --radius:16px;
  --radius-sm:12px;
  --pad:20px;
  --pad-lg:28px;
  --gap:16px;
  --gap-lg:22px;
  --max:840px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

@media (prefers-color-scheme: light){
  :root{
    --bg:#f5f5f7; --surface:rgba(0,0,0,.04); --card:rgba(255,255,255,.9);
    --border:rgba(0,0,0,.12); --text:#1d1d1f; --text-dim:rgba(0,0,0,.66);
    --shadow:0 10px 30px rgba(0,0,0,.1);
  }
}

/* ===== Base ===== */
*,
*::before,
*::after{box-sizing:border-box}

html,body{height:100%;margin:0}
body{
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, var(--surface), transparent 60%), var(--bg);
  -webkit-tap-highlight-color: transparent;
}

/* ===== Layout centering ===== */
.ap-shell{
  min-height:100vh;
  display:grid;
  place-items:start center;  /* centered horizontally by default */
  padding: clamp(12px, 3vw, 24px);
}

@media (min-height:700px){
  .ap-shell{ place-items:center } /* vertically center on taller screens */
}

.ap-main{
  width:100%;
  max-width:var(--max);
  display:grid;
  gap:var(--gap-lg);
}

.ap-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  backdrop-filter:saturate(160%) blur(14px);
  -webkit-backdrop-filter:saturate(160%) blur(14px);
  padding: clamp(16px, 3.4vw, var(--pad-lg));
}

.ap-muted{opacity:.96}

/* ===== Type ===== */
.ap-title{
  margin:0 0 8px 0;
  font-weight:700;
  letter-spacing:-.02em;
  font-size: clamp(20px, 3.2vw, 28px);
}
.ap-sub{
  margin:0 0 16px 0;
  color:var(--text-dim);
  font-size: clamp(14px, 2.6vw, 16px);
}

/* ===== Forms ===== */
.ap-form{ display:grid; gap:var(--gap-lg) }
.ap-fieldset{ border:0; margin:0; padding:0; display:grid; gap:12px }
.ap-legend{ font-weight:600; margin-bottom:4px }

.ap-field{ display:grid; gap:8px }
.ap-label{ font-weight:600; font-size:.95rem }

.ap-input,
.ap-select,
.ap-textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  background: rgba(0,0,0,.22);
  color:var(--text);
  padding: 14px 16px;
  font: inherit;
  line-height: 1.2;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

@media (prefers-color-scheme: light){
  .ap-input,.ap-select,.ap-textarea{ background:rgba(255,255,255,.8) }
}

.ap-input:focus,
.ap-select:focus,
.ap-textarea:focus{
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

.ap-textarea{ min-height: 200px; resize: vertical }

/* iOS select clean-up without breaking desktop */
.ap-select{
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* ===== Radio controls: large, tappable, accessible ===== */
.ap-radio{
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.08);
  cursor: pointer;
  user-select: none;
}

@media (prefers-color-scheme: light){
  .ap-radio{ background: rgba(0,0,0,.04) }
}

/* hide native circle but keep it accessible */
.ap-radio > input[type="radio"]{
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

/* custom circle */
.ap-radio > span{
  display: block;
  color: var(--text);
  font-size: 1rem;
}
.ap-radio > span::before{
  content: "";
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  display: inline-block;
  vertical-align: -3px;
  margin-right: 10px;
  background: transparent;
  box-shadow: inset 0 0 0 6px transparent;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

/* checked state */
.ap-radio > input[type="radio"]:checked + span::before{
  border-color: var(--accent);
  box-shadow: inset 0 0 0 6px var(--accent);
}

/* focus-visible ring */
.ap-radio > input[type="radio"]:focus-visible + span::before{
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 2px;
}

/* hover hint */
.ap-radio:hover{ border-color: var(--border) }

/* ===== Actions ===== */
.ap-actions{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.ap-actions-right{ justify-content: flex-end }
.ap-actions-stack{ flex-direction: column; align-items: stretch }

.ap-btn{
  appearance: none;
  border:1px solid var(--border);
  background: rgba(255,255,255,.07);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease, border-color .15s ease;
  min-width: 44px;
  min-height: 44px; /* touch target */
}
.ap-btn:hover{ transform: translateY(-1px) }
.ap-btn:active{ transform: translateY(0) }

.ap-btn-primary{
  border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 90%, #fff 0%), var(--accent));
  color: #fff;
}
.ap-btn-ghost{ background: transparent }

/* Full-width buttons on narrow phones */
@media (max-width: 520px){
  .ap-actions .ap-btn{ width: 100% }
}

/* ===== Preview block ===== */
.ap-preview{ display: grid; gap: var(--gap); padding-block: 4px }
.ap-divider{ height:1px; background: var(--border); margin: 16px 0 }

/* ===== Iframe box ===== */
.ap-iframe{
  display:block;
  width:100%;
  border:1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.1);
}

/* ===== Motion respect ===== */
@media (prefers-reduced-motion: reduce){
  .ap-btn,.ap-input,.ap-select,.ap-textarea{ transition: none }
}
