/* MediWay — additions for the Laravel pages running inside the Flutter WebView.
   Load AFTER styles.css (the original design file, unchanged). Nothing here changes the look of a designed
   screen; it only adapts the single-page prototype to one-screen-per-page and to the phone WebView. */

/* ---------- WebView: full screen, no desktop "phone frame", safe areas ---------- */
html, body { height: 100%; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
body.webview { padding: 0 !important; display: block; background: var(--bg); }
body.webview .app-shell { max-width: none; height: 100vh; height: 100dvh; border-radius: 0 !important; box-shadow: none; }
.app-shell .screen.active { padding-top: env(safe-area-inset-top, 0px); }
.app-shell .screen.active .topbar { top: env(safe-area-inset-top, 0px); }
.ar-screen.active { padding-top: 0 !important; }
.ar-screen .ar-topbar { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.ar-sheet { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.content { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.screen.with-tabbar .content { padding-bottom: 24px; }
input, button, select, textarea { font-size: 16px; }            /* iOS: no zoom on focus */
.search-bar input { font-size: 16px; }

/* ---------- links that are drawn as the prototype's buttons / rows / cells ---------- */
a.btn, a.list-item, a.menu-cell, a.option-card, a.tab-btn, a.icon-btn { color: inherit; text-decoration: none; }
a.btn-primary { color: #fff; }
a.btn-secondary { color: var(--blue); }
a.btn-ghost { color: var(--text-soft); }
a.btn-danger { color: #fff; }
a.list-item { box-sizing: border-box; }
.list-item[hidden] { display: none; }                         /* list filters (data-filter-list) hide rows */
form.inline { display: contents; }

/* ---------- radio option cards as real inputs (region / city / hospital / mobility / location method) ---------- */
label.option-card { position: relative; }
.option-card input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.option-card:has(input:checked) { border-color: var(--teal); background: #F3FDFC; }                 /* = .selected */
.option-card:has(input:checked) .radio { border-color: var(--teal); }
.option-card:has(input:checked) .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--teal); }
.option-card:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.option-card.disabled .badge-soon { margin-inline-start: auto; font-size: 11px; font-weight: 700; color: var(--text-soft);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 8px; }

/* ---------- form fields and validation (Log In / Sign Up / Patient Room) ---------- */
.text-field.is-invalid { border-color: var(--danger); background: #FFF8F8; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--danger); font-size: 12.5px; margin-top: 6px; line-height: 1.4; }
.field-error .icon { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.field-hint { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.pw-wrap { position: relative; }
.pw-wrap .text-field { padding-inline-end: 48px; }
.pw-toggle { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px;
  border: none; background: none; color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pw-toggle .icon { width: 19px; height: 19px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--text-soft); margin-top: 14px; }
.auth-switch a { color: var(--blue); font-weight: 600; text-decoration: none; }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--text-soft); margin-top: 14px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--teal); }

/* ---------- favorites: remove button on a row (class already in styles.css) ---------- */
.fav-item { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); }
.fav-item:last-child { border-bottom: none; }
.fav-item .list-item { border-bottom: none; flex: 1; min-width: 0; }

/* ---------- manual location: tappable floor plan ---------- */
.floor-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.floor-tabs::-webkit-scrollbar { display: none; }
.floor-tab { flex-shrink: 0; border: 1.5px solid var(--border); background: var(--white); color: var(--text-soft); border-radius: 999px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.floor-tab.active { border-color: var(--teal); color: var(--navy); background: #F3FDFC; }
#manual-map-box { display: flex; flex-direction: column; align-items: stretch; height: auto !important; padding: 8px; gap: 8px; }
.pick-map { position: relative; width: 100%; aspect-ratio: 113 / 102; border-radius: var(--radius-sm); background: #EEF3F2; overflow: hidden; touch-action: manipulation; }
.pick-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pick-caption { font-size: 12.5px; color: var(--text-soft); text-align: center; }
.pick-caption strong { color: var(--text); }
.node-select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md); background: var(--white); color: var(--text); }

/* ---------- route preview: floor switcher for multi-floor routes ---------- */
.route-floors { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); }
.route-floors .floor-tab { padding: 6px 10px; font-size: 12px; }
.route-floors .sep { color: #C4CFD8; }
.route-steps { margin-top: 12px; }
.route-steps .list-item { cursor: default; padding: 10px 0; }
.route-steps .row-icon { width: 34px; height: 34px; border-radius: 10px; }
.route-steps .row-icon .icon { width: 18px; height: 18px; }

/* ---------- AR: step progress + vertical step arrows ---------- */
.ar-progress { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.12); margin: 14px 0 0; overflow: hidden; }
.ar-progress i { display: block; height: 100%; width: 0; background: var(--teal); transition: width 0.4s ease; }
.ar-next { margin-top: 12px; font-size: 12.5px; color: rgba(255,255,255,0.6); display: flex; gap: 8px; align-items: center; }
.ar-next .icon { width: 16px; height: 16px; color: var(--teal); }
/* the icon is "arrowRight": left = 180°, right = 0°, straight on = -90° (pointing up the screen) */
.ar-arrow.turn-left .icon { transform: rotate(180deg); }
.ar-arrow.turn-right .icon { transform: rotate(0deg); }
.ar-arrow.straight .icon { transform: rotate(-90deg); }
.ar-arrow.up .icon { transform: rotate(-90deg); }
.ar-arrow .icon { width: 70px; height: 70px; transition: transform 0.3s ease; }

/* ---------- location: GPS not usable → start from the entrance / select manually ---------- */
.gps-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gps-actions .btn { width: auto; flex: 1 1 auto; }
#gps-result > div { min-width: 0; }

/* ---------- AR: chevrons on the floor (perspective), like a live-view path ---------- */
.ar-floor { position: absolute; left: 50%; bottom: 40px; width: 92%; height: 74%; z-index: 2; pointer-events: none;
  transform: translateX(-50%) perspective(520px) rotateX(56deg); transform-origin: 50% 100%; }
.ar-floor svg { width: 100%; height: 100%; overflow: visible; display: block; }
.ar-floor .chev { fill: none; stroke: #3BA8FF; stroke-width: 6.5; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(59,168,255,0.85)); opacity: 0.25; animation: mw-chev 1.3s linear infinite; }
@keyframes mw-chev { 0% { opacity: 0.2; } 35% { opacity: 1; } 70%, 100% { opacity: 0.2; } }
.ar-badge { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); width: 96px; height: 96px; border-radius: 28px; z-index: 2;
  background: rgba(11,37,69,0.72); color: var(--teal); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.ar-badge[hidden] { display: none; }
.ar-badge .icon { width: 52px; height: 52px; }
.ar-step-here.pulse { animation: mw-pulse 1.2s ease-in-out infinite; }
@keyframes mw-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(46,196,182,0.6); } 50% { box-shadow: 0 0 0 8px rgba(46,196,182,0); } }
@media (prefers-reduced-motion: reduce) { .ar-floor .chev { animation: none; opacity: 0.9; } }

/* ---------- AR: voice guidance (language / off) ---------- */
.ar-voice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; font-size: 13px; color: rgba(255,255,255,0.75); }
.ar-voice-row > span { display: inline-flex; align-items: center; gap: 6px; }
.ar-voice-row .icon { width: 16px; height: 16px; color: var(--teal); }
.ar-seg { display: inline-flex; background: rgba(255,255,255,0.08); border-radius: 999px; padding: 3px; gap: 2px; }
.ar-seg button { border: 0; background: none; color: rgba(255,255,255,0.75); font-size: 12.5px; font-weight: 700; padding: 6px 11px; border-radius: 999px; cursor: pointer; }
.ar-seg button.on { background: var(--teal); color: #06302B; }
#ar-voice[aria-pressed="false"] { opacity: 0.6; }

/* ---------- AR: start panel + walking controls (step counter, "I'm here") ---------- */
.ar-start h3 { margin: 0 0 6px; font-size: 16px; }
.ar-start p { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: rgba(255,255,255,0.7); }
.ar-walk { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12px; color: rgba(255,255,255,0.65); }
.ar-step-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(255,255,255,0.3); background: transparent; color: #fff;
  border-radius: 999px; padding: 8px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ar-step-btn .icon { width: 14px; height: 14px; }
.ar-step-btn[disabled] { opacity: 0.35; }
.ar-step-here { background: var(--teal); border-color: var(--teal); color: #06302B; }

/* ---------- messages in the middle of the screen (ملف التعديلات #8) ---------- */
.toast { top: 50%; bottom: auto; left: 24px; right: 24px; transform: translateY(-50%) scale(0.96); text-align: center;
  padding: 16px 18px; font-size: 14.5px; font-weight: 600; border-radius: 16px; box-shadow: 0 18px 48px rgba(11,37,69,0.35); }
.toast.show { transform: translateY(-50%) scale(1); }

/* ---------- "create an account first" sheet (guests saving favorites, ملف التعديلات #7 / #9) ---------- */
.mw-modal { position: absolute; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 24px;
  background: rgba(11,37,69,0.45); }
.mw-modal.show { display: flex; }
.mw-modal-box { width: 100%; max-width: 340px; background: var(--white); border-radius: 20px; padding: 22px 20px 18px; text-align: center;
  box-shadow: 0 24px 60px rgba(11,37,69,0.35); }
.mw-modal-box .empty-icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 50%; background: var(--light-teal); color: var(--navy);
  display: flex; align-items: center; justify-content: center; }
.mw-modal-box h3 { margin: 0 0 6px; font-size: 17px; }
.mw-modal-box p { margin: 0 0 16px; font-size: 13.5px; color: var(--text-soft); line-height: 1.5; }
.mw-modal-box .btn + .btn { margin-top: 10px; }

/* ---------- toasts come from the server (flash) ---------- */
/* taps go through the toast, as in the prototype (it often sits over the Next / Confirm button) */
.toast.show { pointer-events: none; }

/* ---------- loading state for buttons ---------- */
.btn.is-busy { opacity: 0.7; pointer-events: none; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; animation: splash-spin 0.8s linear infinite; }
.btn-secondary.is-busy::after { border-color: rgba(27,108,168,0.3); border-top-color: var(--blue); }
