/* ==========================================================================
   Ride Access Pass (RAP) Screen Recreation
   Exact 1:1 Pixel-Accurate Recreation
   ========================================================================== */

:root {
  --rap-royal-blue: #2300ea;
  --rap-dark-blue: #1600a0;
  --rap-navy-deep: #0e0066;
  --rap-electric-1: #4e12ff;
  --rap-electric-2: #3c00f5;
  --rap-electric-3: #5819ff;
  --rap-cream-bg: #FAF4EB;
  --rap-badge-ivory: #FFFDF4;
  /* Original vibrant golden yellow matching reference photo */
  --rap-yellow-tag: #FEDC3D;
  --rap-text-dark: #121212;

  --rap-btn-cream: #FAF4EB;
  --rap-btn-text: #1900aa;

  --screen-width: 393px;
  --screen-height: 852px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Ensure Safari status bar and top overscroll are ALWAYS dark blue */
html {
  width: 100%;
  height: 100%;
  background-color: #1b00b8 !important;
  color: #ffffff;
}

body {
  width: 100%;
  height: 100%;
  background-color: #1b00b8;
  font-family: 'Plus Jakarta Sans', 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  color: #ffffff;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Desktop & Mobile Viewport Wrapper
   -------------------------------------------------------------------------- */
.device-viewport {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1c1f2b 0%, #090a0f 100%);
  padding: 0;
  position: relative;
}

/* --------------------------------------------------------------------------
   The Phone Screen (NO ROUNDED OUTER CORNERS - Extends to edges)
   -------------------------------------------------------------------------- */
.phone-screen {
  width: 100%;
  max-width: var(--screen-width);
  height: 100vh;
  height: 100dvh;
  max-height: var(--screen-height);
  background-color: var(--rap-cream-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0 !important;
  margin: 0 auto;
}

@media (min-width: 769px) {
  .phone-screen {
    height: 96vh;
    max-height: 844px;
    border-radius: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   Mobile Devices: 100% Fullscreen Edge-to-Edge
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {

  html,
  body {
    height: 100%;
    min-height: 100%;
    overflow-y: auto;
    background-color: #1b00b8 !important;
  }

  .device-viewport {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    background: #1b00b8 !important;
    align-items: flex-start;
    padding: 0 !important;
    overflow-y: auto;
  }

  .phone-screen {
    max-width: 100%;
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    border-radius: 0 !important;
    box-shadow: none;
    padding: 0 !important;
    margin: 0;
    overflow: visible;
    background-color: #1b00b8 !important;
  }

  .rap-content {
    overflow: visible !important;
    padding: 0 !important;
    background-color: var(--rap-cream-bg);
  }

  .ios-status-bar {
    display: none !important;
  }

  .ios-home-bar {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   iOS Status Bar & Dynamic Island (Toggleable)
   -------------------------------------------------------------------------- */
.ios-status-bar {
  width: 100%;
  height: 48px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  color: #ffffff;
  pointer-events: none;
}

.ios-status-bar.hidden-bar {
  display: none !important;
}

.status-left {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.3px;
  width: 54px;
  margin-top: 2px;
}

.dynamic-island {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 8px;
  height: 30px;
  background-color: #000000;
  border-radius: 20px;
  padding: 2px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.island-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.island-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.island-team-icon {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #ffffff;
}

.crest-svg {
  width: 100%;
  height: 100%;
}

.island-center-camera {
  width: 8px;
  height: 8px;
  background-color: #090912;
  border-radius: 50%;
  box-shadow: inset 0 0 3px rgba(0, 80, 200, 0.4);
}

.island-right {
  display: flex;
  align-items: center;
}

.island-match-time {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 65px;
  justify-content: flex-end;
  margin-top: 2px;
}

.status-icon {
  display: inline-block;
}

.battery-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
}

.battery-percent {
  font-size: 10px;
  font-weight: 700;
  margin-right: 1px;
}

.battery-body {
  width: 19px;
  height: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  padding: 1px;
  display: flex;
  align-items: center;
}

.battery-level {
  height: 100%;
  background-color: #ffffff;
  border-radius: 1px;
}

.battery-nipple {
  width: 1.5px;
  height: 3px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 0 1px 1px 0;
}

/* --------------------------------------------------------------------------
   RAP Content Area
   -------------------------------------------------------------------------- */
.rap-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--rap-cream-bg);
  position: relative;
  overflow: hidden;
  padding: 0 !important;
  margin: 0;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Scrollable Middle Cards Area (Secondary Info Box + Validation Box)
   -------------------------------------------------------------------------- */
.cards-scroll-area {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-y: contain;
}

.cards-scroll-area::-webkit-scrollbar {
  display: none;
}

/* --------------------------------------------------------------------------
   TOP CARD: Extends to the very tippy top of the screen (0px gap)
   -------------------------------------------------------------------------- */
.top-card {
  position: relative;
  width: 100%;
  flex: 0 0 auto;
  margin: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: max(48px, calc(10px + env(safe-area-inset-top, 0px)));
  padding-bottom: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  background-color: #1b00b8;
}

/* Upward extension pseudo-element to guarantee zero white gap in Safari */
.top-card::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 500px;
  background-color: #1b00b8;
  z-index: 1;
}

.top-card-svg-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  pointer-events: none;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
}

.top-header-text {
  position: relative;
  z-index: 5;
  width: 100%;
  padding-left: 20px;
  padding-right: 20px;
  margin-top: 4px;
  margin-bottom: 8px;
  text-align: left;
}

.rap-title {
  font-size: 22.5px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.rap-ride-name {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-top: 2px;
  letter-spacing: -0.2px;
  cursor: pointer;
  display: inline-block;
  transition: opacity 0.2s ease;
}

.rap-ride-name:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   User Pass Badge Card (Cream Card with Photo and Lighter Yellow Tag)
   -------------------------------------------------------------------------- */
.user-pass-badge {
  position: relative;
  z-index: 5;
  width: 160px;
  background-color: var(--rap-badge-ivory);
  border-radius: 18px;
  padding: 10px 10px 11px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.15);
  margin: 4px 0;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.user-pass-badge:hover {
  transform: translateY(-2px);
}

.badge-photo-wrapper {
  width: 140px;
  height: 126px;
  border-radius: 11px;
  overflow: hidden;
  background-color: #d8d8d8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Lighter Yellow Tag Banner */
.badge-tag-banner {
  width: 100%;
  height: 33px;
  margin-top: 8px;
  background-color: var(--rap-yellow-tag);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #000000;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   BOX 1: Secondary Companion & Queue Info Card (Compact Size - Height ~58px)
   -------------------------------------------------------------------------- */
.party-info-card {
  position: relative;
  z-index: 5;
  margin: 8px 14px 4px 14px;
  background-color: var(--rap-royal-blue);
  border-radius: 20px;
  height: 58px;
  min-height: 58px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 14px rgba(36, 0, 232, 0.28);
  flex-shrink: 0;
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.party-info-card:active {
  transform: scale(0.98);
}

.party-guests-line {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.party-queue-line {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 2px;
  letter-spacing: 0.1px;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   BOX 2: Validation Successful (BIGGER, DOMINANT PROMINENT CARD)
   -------------------------------------------------------------------------- */
.validation-card {
  position: relative;
  z-index: 5;
  margin: 6px 14px 10px 14px;
  background-color: var(--rap-royal-blue);
  border-radius: 24px;
  height: 246px;
  min-height: 246px;
  padding: 18px 18px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  box-shadow: 0 6px 20px rgba(36, 0, 232, 0.35);
  flex-shrink: 0;
  scroll-snap-align: end;
}

.validation-title {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.checkmark-circle {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  animation: pulseCheck 3s infinite ease-in-out;
}

@keyframes pulseCheck {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }
}

.checkmark-svg {
  width: 50px;
  height: 50px;
}

.checkmark-path {
  stroke: var(--rap-royal-blue);
  stroke-dasharray: 60;
  stroke-dashoffset: 0;
  animation: drawCheck 1.2s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes drawCheck {
  0% {
    stroke-dashoffset: 60;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.1px;
}

.timer-countdown {
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   BOX 3: I'm Done Riding Button (EXTENDS TO THE VERY BOTTOM OF SCREEN)
   -------------------------------------------------------------------------- */
.bottom-card {
  position: relative;
  z-index: 10;
  margin: 0 !important;
  width: 100% !important;
  background-color: var(--rap-royal-blue);
  border-top-left-radius: 26px !important;
  border-top-right-radius: 26px !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  /* Extends all the way down to the bottom of the viewport/display */
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 16px)) 14px !important;
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -3px 14px rgba(36, 0, 232, 0.28);
  margin-bottom: 0 !important;
}

/* Downward extension pseudo-element to guarantee zero white gap at bottom in Safari */
.bottom-card::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 500px;
  background-color: var(--rap-royal-blue);
  z-index: 1;
}

.done-riding-btn {
  width: 100%;
  max-width: 365px;
  height: 48px;
  border-radius: 9999px;
  background-color: var(--rap-btn-cream);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--rap-btn-text);
  letter-spacing: -0.2px;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.done-riding-btn:hover {
  background-color: #ffffff;
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.done-riding-btn:active {
  transform: scale(0.97);
  background-color: #ede5da;
}

/* --------------------------------------------------------------------------
   iOS Home Bar Indicator (Placed over the bottom card)
   -------------------------------------------------------------------------- */
.ios-home-bar {
  width: 100%;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: 2px;
  left: 0;
  z-index: 60;
  pointer-events: none;
}

.home-indicator {
  width: 135px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   Floating Controls Toolbar (Discreetly placed + Can be hidden completely)
   -------------------------------------------------------------------------- */
.floating-controls {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1000;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.floating-controls.completely-hidden {
  display: none !important;
}

.control-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(18, 20, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, background 0.2s ease;
}

.control-toggle-btn:hover {
  transform: scale(1.08);
  background: rgba(30, 34, 50, 0.95);
}

.controls-panel {
  position: absolute;
  bottom: 48px;
  right: 0;
  width: 295px;
  background: rgba(18, 22, 36, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.controls-panel.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.95);
  pointer-events: none;
}

.controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.controls-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.close-panel-btn {
  background: transparent;
  border: none;
  color: #a0a5b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.close-panel-btn:hover {
  color: #ffffff;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-group label {
  font-size: 12px;
  font-weight: 600;
  color: #b0b8d0;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="file"] {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}

.control-group select option {
  background-color: #1a1e2e;
  color: #ffffff;
}

.timer-btn-row {
  display: flex;
  gap: 5px;
}

.chip-btn {
  flex: 1;
  padding: 5px 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn.active,
.chip-btn:hover {
  background: var(--rap-royal-blue);
  border-color: #6a3aff;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #d0d6eb;
}

.action-btn {
  width: 100%;
  padding: 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hide-settings-btn {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.4);
  color: #ff6961;
  margin-top: 4px;
}

.hide-settings-btn:hover {
  background: rgba(255, 59, 48, 0.35);
  color: #ffffff;
}

.settings-hint {
  font-size: 11px;
  color: #9aa2bc;
  text-align: center;
  margin-top: 4px;
  line-height: 1.35;
  display: block;
}

/* --------------------------------------------------------------------------
   Toast Message for Feedback
   -------------------------------------------------------------------------- */
.toast-message {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(20, 24, 38, 0.94);
  backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

.toast-message.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}