/* Shared glass design system for customer, dashboard and admin pages. */

:root {
  --bg: #0a0c1d;
  --glass: rgba(255, 255, 255, 0.075);
  --glass-strong: rgba(255, 255, 255, 0.13);
  --glass-solid: rgba(24, 26, 52, 0.78);
  --stroke: rgba(255, 255, 255, 0.14);
  --stroke-strong: rgba(255, 255, 255, 0.28);
  --text: #f4f6ff;
  --muted: rgba(228, 232, 255, 0.62);
  --faint: rgba(228, 232, 255, 0.38);
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --grad: linear-gradient(135deg, #a855f7 0%, #6366f1 48%, #06b6d4 100%);
  --grad-soft: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(6, 182, 212, 0.25));
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --glow: 0 10px 30px rgba(99, 102, 241, 0.45);
  --blur: saturate(170%) blur(22px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- animated background ---------- */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(1100px 700px at 0% -10%, #1e1b4b 0%, transparent 60%),
    radial-gradient(900px 700px at 110% 20%, #083344 0%, transparent 55%),
    radial-gradient(800px 600px at 50% 120%, #3b0764 0%, transparent 60%),
    var(--bg);
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5;
  animation: drift 20s var(--ease) infinite alternate;
}
.blob.b1 { width: 360px; height: 360px; background: #7c3aed; top: -100px; left: -80px; }
.blob.b2 { width: 300px; height: 300px; background: #0891b2; top: 35%; right: -110px; animation-delay: -7s; }
.blob.b3 { width: 280px; height: 280px; background: #db2777; bottom: -90px; left: 15%; opacity: 0.35; animation-delay: -13s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, 70px) scale(1.12); }
  100% { transform: translate(-40px, 30px) scale(0.94); }
}

/* ---------- glass surfaces ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 15px;
  font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform 0.15s var(--ease), opacity 0.2s, background 0.2s, box-shadow 0.2s;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.btn-ghost { background: var(--glass-strong); border: 1px solid var(--stroke); }
.btn-ok { background: linear-gradient(135deg, #10b981, #34d399); color: #052e1f; box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35); }
.btn-danger { background: rgba(251, 113, 133, 0.14); color: #fecdd3; border: 1px solid rgba(251, 113, 133, 0.35); }
.btn-sm { height: 38px; padding: 0 14px; border-radius: 12px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto;
  display: inline-grid; place-items: center; font-size: 18px;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  transition: transform 0.15s var(--ease), background 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label, .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.input {
  width: 100%; height: 50px; padding: 0 15px; border-radius: 15px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke);
  outline: none; font-size: 16px; /* 16px stops iOS zooming on focus */
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: rgba(139, 92, 246, 0.9); background: rgba(255, 255, 255, 0.1); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18); }
textarea.input { height: auto; min-height: 84px; padding: 13px 15px; resize: vertical; line-height: 1.45; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}
select.input option { background: #1a1c38; color: var(--text); }

/* pill choice (radio-like) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  min-height: 42px; padding: 0 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke);
  font-weight: 600; font-size: 14px; color: var(--muted);
  transition: background 0.25s var(--ease), color 0.25s, box-shadow 0.25s, transform 0.2s var(--spring), border-color 0.25s;
}
.choice:active { transform: scale(0.94); }
.choice.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }

/* stepper */
.stepper {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 15px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke);
}
.stepper button {
  width: 38px; height: 38px; border-radius: 11px; font-size: 20px; font-weight: 700; line-height: 1;
  background: var(--glass-strong); transition: transform 0.15s var(--spring);
}
.stepper button:active { transform: scale(0.88); }
.stepper output { min-width: 32px; text-align: center; font-weight: 800; font-size: 16px; }
.stepper.sm button { width: 30px; height: 30px; font-size: 17px; border-radius: 9px; }
.stepper.sm output { min-width: 26px; font-size: 14px; }

/* toggle switch */
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 48px; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.16); transition: background 0.25s; }
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--spring);
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ---------- bottom sheet (centered modal on wide screens) ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(4, 5, 18, 0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity 0.35s var(--ease);
}
.backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; flex-direction: column; max-height: 92vh; max-height: 92dvh;
  border-radius: 30px 30px 0 0; background: var(--glass-solid);
  border: 1px solid var(--stroke-strong); border-bottom: 0;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(105%); visibility: hidden;
  transition: transform 0.5s var(--ease), visibility 0s linear 0.5s;
  padding-bottom: var(--safe-b);
}
.sheet.open { transform: translateY(0); visibility: visible; transition: transform 0.5s var(--ease), visibility 0s; }
.sheet.dragging { transition: none; }
.sheet-head { flex: 0 0 auto; padding: 10px 20px 4px; touch-action: none; }
.grab { width: 44px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.3); margin: 0 auto 10px; }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-title h2 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 12px 20px 20px; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: 0 0 auto; padding: 12px 20px 16px; border-top: 1px solid var(--stroke); background: rgba(10, 12, 29, 0.25); }

@media (min-width: 760px) {
  .sheet {
    left: 50%; right: auto; top: 50%; bottom: auto; width: min(560px, 92vw); max-height: 88vh;
    border-radius: 28px; border-bottom: 1px solid var(--stroke-strong); padding-bottom: 0;
    transform: translate(-50%, -46%) scale(0.96); opacity: 0;
    transition: transform 0.35s var(--ease), opacity 0.25s, visibility 0s linear 0.35s;
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; transition: transform 0.35s var(--ease), opacity 0.25s, visibility 0s; }
  .sheet .grab { display: none; }
  .sheet-head { padding-top: 18px; }
  .sheet-foot { border-radius: 0 0 28px 28px; }
}

/* stagger children in when a sheet opens */
.sheet.open .stagger > * { animation: rise 0.55s var(--ease) both; }
.sheet.open .stagger > *:nth-child(1) { animation-delay: 0.05s; }
.sheet.open .stagger > *:nth-child(2) { animation-delay: 0.1s; }
.sheet.open .stagger > *:nth-child(3) { animation-delay: 0.15s; }
.sheet.open .stagger > *:nth-child(4) { animation-delay: 0.2s; }
.sheet.open .stagger > *:nth-child(5) { animation-delay: 0.25s; }
.sheet.open .stagger > *:nth-child(n+6) { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(14px + var(--safe-t)); z-index: 100;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 14px;
  background: rgba(24, 26, 52, 0.85); border: 1px solid var(--stroke-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  transform: translate(-50%, calc(-100% - 30px)); transition: transform 0.45s var(--spring);
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { border-color: rgba(251, 113, 133, 0.55); }
.toast.ok { border-color: rgba(52, 211, 153, 0.55); }

/* ---------- login screens ---------- */
.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 32px 26px; border-radius: 30px; text-align: center; animation: rise 0.6s var(--ease) both; }
.login-card .logo {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center;
  font-size: 38px; background: var(--grad); box-shadow: var(--glow);
}
.login-card h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.pin-input { text-align: center; font-size: 26px; letter-spacing: 0.4em; font-weight: 800; height: 62px; margin-bottom: 14px; }
.shake { animation: shake 0.45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
