/* almadinapolyclinic — appointment queue page */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --pink:   #ff7cb5;
  --peach:  #ffc56b;
  --sky:    #7cc8ff;
  --mint:   #8fe3c4;
  --lilac:  #c2a7ff;
  --sun:    #ffd93d;
  --ink:    #1b1740;
  --muted:  #6d6a85;
  --cream:  #fff5ec;
  --paper:  #fffaf4;
  --card:   #ffffff;
  --shadow: 0 20px 50px rgba(27, 23, 64, .10);
  --shadow-lg: 0 30px 80px rgba(27, 23, 64, .18);
  --grad: linear-gradient(135deg, #ff7cb5 0%, #c2a7ff 50%, #7cc8ff 100%);
  --grad-warm: linear-gradient(135deg, #ff7cb5 0%, #ffc56b 100%);
}

html, body { min-height: 100%; }
body {
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(255,124,181,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(124,200,255,.18), transparent 55%),
    radial-gradient(700px 400px at 50% 50%, rgba(194,167,255,.10), transparent 70%),
    var(--paper);
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: 'Baloo 2', sans-serif; line-height: 1.15; font-weight: 800; }
em { font-style: italic; color: var(--pink); }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

/* Nav */
.appt-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  max-width: 720px; margin: 0 auto;
}
.appt-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; font-family: 'Baloo 2', sans-serif; }
.appt-logo-bubble {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; font-size: 20px;
  background: var(--grad-warm); border-radius: 50%;
  box-shadow: 0 8px 18px rgba(255,124,181,.4);
}
.appt-logo-bubble.small { width: 34px; height: 34px; font-size: 18px; box-shadow: 0 4px 10px rgba(255,124,181,.3); }
.appt-logo-text em { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: normal; }

.appt-call {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: white;
  padding: 8px 14px; border-radius: 999px;
  font-weight: 800; font-size: 14px;
  box-shadow: 0 8px 20px rgba(27,23,64,.18);
  transition: transform .2s;
}
.appt-call:hover { transform: translateY(-2px); }

/* Main */
.appt-wrap {
  max-width: 560px;
  margin: 12px auto 40px;
  padding: 0 18px;
}

.appt-state {
  background: var(--card);
  border-radius: 28px;
  padding: 28px 24px 26px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(27,23,64,.05);
}

.appt-eyebrow {
  display: inline-block;
  background: var(--cream); color: var(--pink);
  padding: 6px 14px; border-radius: 999px;
  font-weight: 800; font-size: 13px; letter-spacing: .04em;
  margin-bottom: 14px;
}

.appt-state h1 {
  font-size: clamp(26px, 6vw, 34px);
  margin-bottom: 10px;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.appt-lead {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 22px;
}
.appt-lead strong { color: var(--ink); }

.appt-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 24px;
}
.appt-meta > div {
  background: var(--cream);
  padding: 12px 14px; border-radius: 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.appt-meta span { font-size: 12px; color: var(--muted); font-weight: 700; }
.appt-meta strong { font-family: 'Baloo 2', sans-serif; font-size: 15px; }

.appt-cta {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--grad-warm); color: white;
  padding: 18px 22px; border-radius: 999px; border: none;
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 19px;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(255,124,181,.4);
  transition: transform .15s, box-shadow .2s, filter .2s;
  -webkit-tap-highlight-color: transparent;
}
.appt-cta:hover { transform: translateY(-2px); box-shadow: 0 20px 48px rgba(255,124,181,.5); }
.appt-cta:active { transform: translateY(0) scale(.98); }
.appt-cta:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.appt-cta.secondary { background: var(--ink); box-shadow: 0 12px 28px rgba(27,23,64,.25); }

.appt-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: white; color: var(--ink);
  padding: 12px 18px; border-radius: 999px;
  border: 2px solid rgba(27,23,64,.08);
  font-weight: 800; font-size: 14px;
  cursor: pointer;
  transition: transform .15s, border-color .2s;
}
.appt-ghost:hover { transform: translateY(-2px); border-color: var(--pink); }
.appt-ghost.wa { background: #25D366; color: white; border-color: transparent; }
.appt-ghost.wa:hover { background: #1ebd5a; border-color: transparent; transform: translateY(-2px); }

.appt-tiny {
  margin-top: 14px;
  font-size: 12.5px; color: var(--muted); text-align: left;
}
.appt-tiny.center { text-align: center; margin-top: 18px; }
.appt-tiny a { color: var(--pink); font-weight: 700; }

/* Gate (no-scan / direct-URL) state */
.gate-emoji {
  font-size: 56px;
  margin-bottom: 6px;
  filter: drop-shadow(0 8px 18px rgba(255,124,181,.3));
}
#state-gate h1 {
  font-size: clamp(24px, 5.5vw, 30px);
  margin-bottom: 10px;
}

/* Loader */
.loader-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 30px 0; }
.loader {
  width: 56px; height: 56px; border-radius: 50%;
  border: 5px solid rgba(255,124,181,.18);
  border-top-color: var(--pink);
  animation: spin .9s linear infinite;
}
.loader-wrap p { font-weight: 700; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ticket */
.ticket {
  position: relative;
  background:
    radial-gradient(circle at 0 50%, transparent 12px, white 13px) left center / 100% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 12px, white 13px) right center / 100% 100% no-repeat,
    white;
  border-radius: 24px;
  padding: 22px 22px 24px;
  box-shadow: 0 24px 60px rgba(27,23,64,.12);
  border: 1px solid rgba(27,23,64,.05);
  overflow: hidden;
  animation: ticket-pop .6s cubic-bezier(.18,.89,.32,1.28) both;
}
@keyframes ticket-pop {
  0%   { opacity: 0; transform: scale(.85) translateY(20px); }
  60%  { transform: scale(1.03) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.ticket::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background: var(--grad-warm);
}

.ticket-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.ticket-brand { display: flex; align-items: center; gap: 10px; }
.ticket-brand strong { font-family: 'Baloo 2', sans-serif; font-size: 15px; display: block; }
.ticket-brand small { color: var(--muted); font-size: 11.5px; }
.ticket-badge {
  background: var(--cream); color: var(--pink);
  padding: 5px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  white-space: nowrap;
}

.ticket-divider {
  display: flex; gap: 6px; padding: 6px 0; margin: 4px -22px 18px;
  border-top: 1px dashed rgba(27,23,64,.18);
  border-bottom: 1px dashed rgba(27,23,64,.18);
  justify-content: space-around;
}
.ticket-divider span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(27,23,64,.12);
}

.ticket-num-wrap { text-align: center; padding: 8px 0 14px; }
.ticket-label {
  font-size: 13px; font-weight: 800;
  color: var(--muted); letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 6px;
}
.ticket-num {
  font-family: 'Baloo 2', sans-serif; font-weight: 800;
  font-size: clamp(96px, 26vw, 140px);
  line-height: 1;
  background: var(--grad-warm);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -.02em;
  filter: drop-shadow(0 12px 30px rgba(255,124,181,.3));
}
.ticket-sub {
  font-size: 14px; color: var(--muted); font-weight: 700;
  margin-top: 6px;
}
.ticket-when {
  margin-top: 12px; display: flex; flex-direction: column; gap: 6px;
}
.ticket-when .tw-row {
  background: linear-gradient(135deg, rgba(255,124,181,.12), rgba(255,197,107,.16));
  border-radius: 12px; padding: 10px 14px;
  font-size: 14.5px; font-weight: 700; color: var(--ink);
}
.ticket-when b { font-family: 'Baloo 2', sans-serif; }
.ticket-when .tw-date { display: block; font-weight: 600; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ticket-when .tw-turn { display: block; margin-top: 4px; font-weight: 800; font-size: 13px; color: #0a8f63; }
.ticket-when .tw-turn:empty { display: none; }
.ticket-headline {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 17px;
  margin-top: 16px; color: var(--ink);
}
.ticket-msg {
  font-size: 13.5px; color: var(--muted); font-weight: 600;
  margin-top: 6px; line-height: 1.55;
  background: var(--cream); border-radius: 12px; padding: 11px 14px;
}

/* Multiple-number layout (sibling family) */
.ticket-nums {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  padding: 4px 0 2px;
}
.num-pill {
  font-family: 'Baloo 2', sans-serif; font-weight: 800;
  font-size: clamp(38px, 12vw, 64px); line-height: 1;
  padding: 8px 18px;
  background: var(--grad-warm);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 18px rgba(255,124,181,.25));
}
.num-pill::before { content: ''; }

/* Add-another button — sits between ticket and action row */
.add-another {
  margin-top: 14px;
  display: flex !important;
  width: 100%;
  background: white; color: var(--pink);
  border: 2px dashed rgba(255,124,181,.5) !important;
  font-size: 15px;
}
.add-another:hover { border-style: solid !important; border-color: var(--pink) !important; background: var(--cream); }

.ticket-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 6px;
}
.ticket-info > div {
  background: var(--cream);
  padding: 10px 12px; border-radius: 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.ticket-info span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.ticket-info strong { font-family: 'Baloo 2', sans-serif; font-size: 13.5px; }

.ticket-note {
  margin-top: 14px;
  background: linear-gradient(135deg, rgba(255,217,61,.25), rgba(255,124,181,.18));
  padding: 12px 14px; border-radius: 14px;
  font-weight: 700; font-size: 13.5px; text-align: center;
}

.ticket-actions {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 16px;
}
.ticket-actions .appt-ghost {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
}

/* Error state */
.appt-error { text-align: center; padding: 18px 6px 6px; }
.error-emoji { font-size: 56px; margin-bottom: 10px; }
.appt-error h2 { font-size: 22px; margin-bottom: 8px; }
.appt-error p { color: var(--muted); margin-bottom: 18px; font-size: 14.5px; }

/* Latest count card */
.latest-card { text-align: center; padding: 12px 4px 6px; }
.latest-emoji { font-size: 48px; margin-bottom: 6px; }
.latest-label { font-weight: 800; color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }
.latest-num {
  font-family: 'Baloo 2', sans-serif; font-weight: 800;
  font-size: clamp(72px, 20vw, 110px); line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 10px;
}
.latest-card .appt-tiny { text-align: center; max-width: 320px; margin: 8px auto 16px; }

/* Footer */
.appt-foot {
  text-align: center; color: var(--muted);
  padding: 18px; font-size: 12.5px;
}

/* Form fields */
.appt-field { margin-bottom: 14px; text-align: left; }
.appt-field label {
  display: block; font-weight: 800; font-size: 13px;
  color: var(--muted); margin-bottom: 6px; letter-spacing: .02em;
}
.appt-field input, .appt-field select {
  width: 100%; padding: 14px 16px;
  border: 2px solid rgba(27,23,64,.1); border-radius: 16px;
  font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--ink); background: var(--paper);
  transition: border-color .2s, box-shadow .2s;
}
.appt-field input::placeholder { color: #b3b0c4; font-weight: 600; }
.appt-field input:focus, .appt-field select:focus {
  outline: none; border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255,124,181,.14);
}
.appt-err {
  color: #d6336c; font-weight: 700; font-size: 13.5px;
  background: #ffe8ee; padding: 10px 13px; border-radius: 12px;
  margin-bottom: 12px;
}

/* Live status block on the ticket */
.ticket-status {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 16px;
}
.ts-cell {
  background: var(--cream); padding: 12px 14px; border-radius: 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.ts-cell span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.ts-cell strong { font-family: 'Baloo 2', sans-serif; font-size: 22px; line-height: 1; }
.ts-eta {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(124,200,255,.22), rgba(143,227,196,.22));
  padding: 14px 16px; border-radius: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ts-eta span { font-size: 13px; font-weight: 800; color: var(--ink); }
.ts-eta strong { font-family: 'Baloo 2', sans-serif; font-size: 20px; color: var(--ink); text-align: right; }

/* Tiny screens */
@media (max-width: 380px) {
  .appt-meta, .ticket-info { grid-template-columns: 1fr; }
}

/* Print (in case anyone prints the ticket) */
@media print {
  body { background: white; }
  .appt-nav, .appt-foot, .ticket-actions, #lost-link { display: none !important; }
  .ticket { box-shadow: none; border: 1px solid #ccc; }
}
