/* ==========================================================================
   SERVD. WEB SHELL, TOASTS, SHEETS & STEALTH RBAC CHECK-IN STYLES
   Adaptive 16:9 (Landscape/Desktop) & 9:16 (Portrait/Mobile) — No Fake Chassis
   ========================================================================== */

.servd-stage {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.servd-viewport {
  position: relative;
  width: min(1280px, calc(100vw - 32px), calc((100dvh - 32px) * 16 / 9));
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 24px;
  background: var(--ios-bg-grouped);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 24px 64px -16px rgba(0, 0, 0, 0.20),
    0 4px 16px -4px rgba(0, 0, 0, 0.08),
    0 0 0 0.5px rgba(60, 60, 67, 0.14);
}

/* Portrait / Mobile 9:16 True Edge-to-Edge */
@media (max-aspect-ratio: 1/1), (max-width: 720px) {
  .servd-stage {
    padding: 0;
  }

  .servd-viewport {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    aspect-ratio: 9 / 16;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Role Roots */
.role-root {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.role-root.active {
  display: flex;
}

/* Floating Viewport Toast Banner */
.viewport-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  width: min(420px, calc(100% - 28px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-radius: 16px;
  padding: 10px 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  z-index: 980;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translate(-50%, -165%);
  opacity: 0;
  transition: transform 0.38s var(--ios-spring), opacity 0.25s ease;
  pointer-events: none;
}

.viewport-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #1C1C1E;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.toast-body-wrap {
  flex: 1;
  min-width: 0;
}

.toast-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.toast-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ios-label-primary);
}

.toast-time {
  font-size: 10px;
  color: var(--ios-label-secondary);
}

.toast-message {
  font-size: 11.5px;
  color: var(--ios-label-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shared Controls & Badges */
.control-pill-group {
  display: inline-flex;
  background: rgba(118, 118, 128, 0.13);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.control-seg-btn {
  border: none;
  background: transparent;
  padding: 6px 10px;
  min-height: 34px;
  border-radius: 7.5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-label-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s var(--ios-spring);
  white-space: nowrap;
}

.control-seg-btn.active {
  background: #FFFFFF;
  color: var(--ios-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.09), 0 0.5px 1px rgba(0, 0, 0, 0.04);
}

.shell-action-btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 0.5px solid var(--ios-separator);
  background: #FFFFFF;
  color: var(--ios-label-primary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.15s var(--ios-spring), background-color 0.15s ease;
  white-space: nowrap;
}

.shell-action-btn:active {
  transform: scale(0.96);
}

.shell-action-btn.signout-btn {
  color: var(--ios-red);
  border-color: rgba(255, 59, 48, 0.25);
  background: rgba(255, 59, 48, 0.07);
}

.primary-cta {
  width: 100%;
  height: 46px;
  border-radius: 13px;
  border: none;
  background: var(--ios-label-primary);
  color: #FFFFFF;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.primary-cta.blue {
  background: var(--ios-blue);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.24);
}

.primary-cta.blue:active {
  background: var(--ios-blue-pressed);
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
}

.pill-green { background: var(--ios-green-tint); color: var(--ios-green-dark); }
.pill-blue { background: var(--ios-blue-tint); color: var(--ios-blue); }
.pill-orange { background: var(--ios-orange-tint); color: var(--ios-orange-dark); }
.pill-red { background: var(--ios-red-tint); color: var(--ios-red); }
.pill-indigo { background: var(--ios-indigo-tint); color: var(--ios-indigo); }
.pill-gray { background: var(--ios-fill-tertiary); color: var(--ios-label-secondary); }

/* FSSAI Diet Symbols */
.fssai-symbol {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #FFFFFF;
}

.fssai-symbol.veg {
  border: 1.5px solid var(--ios-green-dark);
}

.fssai-symbol.veg::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ios-green-dark);
}

.fssai-symbol.nonveg {
  border: 1.5px solid #C93400;
}

.fssai-symbol.nonveg::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 6px solid #C93400;
}

/* Native Toggle Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-switch-slider {
  position: absolute;
  inset: 0;
  background-color: rgba(120, 120, 128, 0.24);
  border-radius: 26px;
  transition: background-color 0.25s var(--ios-spring);
}

.ios-switch-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s var(--ios-spring);
}

.ios-switch input:checked + .ios-switch-slider {
  background-color: var(--ios-green);
}

.ios-switch input:checked + .ios-switch-slider::before {
  transform: translateX(18px);
}

/* Sheets & Modals (Responsive for both 9:16 bottom sheet & 16:9 centered sheet) */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s ease;
}

.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.apple-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(460px, 100%);
  background: var(--ios-bg-grouped);
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  z-index: 250;
  transform: translate(-50%, 104%);
  transition: transform 0.38s var(--ios-sheet-spring);
  max-height: 88%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.18);
}

.apple-sheet.open {
  transform: translate(-50%, 0);
}

@media (min-width: 721px) and (min-aspect-ratio: 1/1) {
  .apple-sheet {
    bottom: 50%;
    border-radius: 28px;
    transform: translate(-50%, 50%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s var(--ios-spring), opacity 0.24s ease;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  }

  .apple-sheet.open {
    transform: translate(-50%, 50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
}

.sheet-grabber {
  width: 36px;
  height: 4.5px;
  border-radius: 100px;
  background: rgba(60, 60, 67, 0.25);
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.sheet-header {
  padding: 6px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ios-label-primary);
}

.sheet-close-btn {
  border: none;
  background: var(--ios-fill-tertiary);
  color: var(--ios-label-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sheet-scroll-body {
  padding: 0 20px 26px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Quick Table Check-In & OTP Boxes */
.venue-pair-card {
  background: var(--ios-bg-elevated);
  border-radius: 14px;
  padding: 10px 14px;
  border: 0.5px solid var(--ios-separator-light);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.venue-badge-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ios-label-primary);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-input-wrap {
  height: 44px;
  padding: 0 12px;
  background: var(--ios-bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--ios-separator);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.mobile-prefix {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ios-label-secondary);
  padding-right: 10px;
  border-right: 1px solid var(--ios-separator);
}

.mobile-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--ios-label-primary);
  width: 100%;
  height: 100%;
}

.otp-compact-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 6px;
}

.otp-compact-box {
  width: 58px;
  height: 52px;
  border-radius: 13px;
  border: 1px solid var(--ios-separator);
  background: var(--ios-bg-elevated);
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ios-label-primary);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.otp-compact-box:focus {
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

@keyframes shakeAnim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.otp-compact-row.shake {
  animation: shakeAnim 0.4s ease;
}

.otp-compact-row.shake .otp-compact-box {
  border-color: var(--ios-red);
  color: var(--ios-red);
  background: rgba(255, 59, 48, 0.06);
}

.autofill-pill {
  background: var(--ios-bg-elevated);
  border: 0.5px solid var(--ios-separator);
  border-radius: 100px;
  padding: 6px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* Clean Scanner Preview Placeholder for Phase 2 before Phase 3 */
.scanner-stage-preview {
  flex: 1;
  background: #0A0A0C;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}
