/* ============================================================
   VIAZU — Drawer Menu & Mobile App CSS
   Diseño premium tipo Uber / DiDi / InDrive
   Mobile-first · iOS safe areas · Animaciones nativas
   ============================================================ */

/* ── Reset & Base Mobile ─────────────────────────────────── */
:root {
  --drawer-width:    320px;
  --drawer-bg:       #111111;
  --drawer-border:   rgba(255,255,255,.06);
  --drawer-header-h: 200px;
  --item-h:          52px;
  --section-color:   rgba(255,255,255,.30);
  --item-color:      rgba(255,255,255,.88);
  --item-hover:      rgba(255,255,255,.05);
  --item-active:     rgba(0,200,83,.10);
  --green:           #00C853;
  --red:             #FF3B30;
  --blue:            #0A84FF;
  --orange:          #FF9500;
  --yellow:          #FFCC00;
  --transition:      cubic-bezier(.32,.72,0,1);
  --radius:          16px;
  --safe-top:        env(safe-area-inset-top, 44px);
  --safe-bottom:     env(safe-area-inset-bottom, 20px);
}

/* ── Drawer Overlay ──────────────────────────────────────── */
#drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 398;
  background: rgba(0,0,0,.65);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s var(--transition);
}
#drawer-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Side Drawer Container ───────────────────────────────── */
#drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 399;
  width: min(var(--drawer-width), 88vw);
  background: var(--drawer-bg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s var(--transition);
  overflow: hidden;
  border-right: 1px solid var(--drawer-border);
  box-shadow: 4px 0 32px rgba(0,0,0,.6);
}
#drawer.open {
  transform: translateX(0);
}

/* ── Drawer Header (Profile Card) ────────────────────────── */
.drawer-header {
  position: relative;
  padding: calc(var(--safe-top) + 20px) 20px 20px;
  background:
    linear-gradient(160deg, rgba(0,200,83,.25) 0%, rgba(0,200,83,.05) 50%, transparent 100%),
    #0f1f0f;
  border-bottom: 1px solid var(--drawer-border);
  flex-shrink: 0;
}

/* Close button */
.drawer-close-btn {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.drawer-close-btn:active { background: rgba(255,255,255,.15); }

/* Avatar */
.drawer-avatar-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  margin-bottom: 12px;
}
.drawer-avatar-img {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00C853, #007E33);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #000;
  border: 2px solid rgba(0,200,83,.4);
  object-fit: cover;
}
.drawer-verified-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--drawer-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* User Info */
.drawer-user-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.2;
}
.drawer-user-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.drawer-stars {
  display: flex;
  gap: 2px;
}
.drawer-star {
  font-size: 13px;
  color: #FFCC00;
}
.drawer-rating-val {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
}
.drawer-trips {
  font-size: 12px;
  color: rgba(255,255,255,.45);
}
.drawer-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.drawer-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.drawer-badge--verified {
  background: rgba(0,200,83,.15);
  color: var(--green);
  border: 1px solid rgba(0,200,83,.25);
}
.drawer-badge--passenger {
  background: rgba(10,132,255,.12);
  color: #0A84FF;
  border: 1px solid rgba(10,132,255,.2);
}
.drawer-badge--driver {
  background: rgba(255,149,0,.12);
  color: #FF9500;
  border: 1px solid rgba(255,149,0,.2);
}
.drawer-badge--online {
  background: rgba(0,200,83,.15);
  color: var(--green);
  border: 1px solid rgba(0,200,83,.25);
}
.drawer-badge--offline {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.1);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-dot--online  { background: var(--green); }
.status-dot--offline { background: rgba(255,255,255,.4); }

/* Wallet quick balance in header */
.drawer-wallet-strip {
  margin-top: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-wallet-label { font-size: 11px; color: rgba(255,255,255,.5); }
.drawer-wallet-amount { font-size: 16px; font-weight: 800; color: var(--green); }
.drawer-wallet-btn {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: rgba(0,200,83,.12);
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}

/* ── Navigation Body ─────────────────────────────────────── */
.drawer-nav-body {
  flex: 1;
  min-height: 0; /* sin esto Safari no encoge el panel y empuja "Cerrar sesión" fuera del área visible */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px 0 0;
  /* Hide scrollbar */
  scrollbar-width: none;
}
.drawer-nav-body::-webkit-scrollbar { display: none; }

/* ── Section Groups ──────────────────────────────────────── */
.drawer-section-label {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--section-color);
}

/* ── Nav Item ────────────────────────────────────────────── */
.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  height: var(--item-h);
  cursor: pointer;
  text-decoration: none;
  color: var(--item-color);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: background .12s;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}
.drawer-item:active {
  background: var(--item-hover);
}
.drawer-item.active {
  background: var(--item-active);
  color: var(--green);
}
.drawer-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--green);
  border-radius: 0 3px 3px 0;
}

/* Icon */
.drawer-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
  transition: background .15s;
}
.drawer-item.active .drawer-item-icon {
  background: rgba(0,200,83,.15);
}
/* Icon color variants */
.drawer-item-icon--green  { background: rgba(0,200,83,.12);  color: var(--green);  }
.drawer-item-icon--blue   { background: rgba(10,132,255,.12); color: var(--blue);   }
.drawer-item-icon--orange { background: rgba(255,149,0,.12);  color: var(--orange); }
.drawer-item-icon--red    { background: rgba(255,59,48,.12);  color: var(--red);    }
.drawer-item-icon--yellow { background: rgba(255,204,0,.12);  color: var(--yellow); }
.drawer-item-icon--purple { background: rgba(175,82,222,.12); color: #AF52DE;       }

/* Label */
.drawer-item-label { flex: 1; line-height: 1; }

/* Arrow */
.drawer-item-arrow {
  font-size: 16px;
  color: rgba(255,255,255,.25);
  flex-shrink: 0;
}

/* Badge (count) */
.drawer-item-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* New badge */
.drawer-item-new {
  background: var(--green);
  color: #000;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* Divider */
.drawer-divider {
  height: 1px;
  background: var(--drawer-border);
  margin: 6px 0;
}

/* Toggle switch inside drawer */
.drawer-toggle-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.drawer-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  cursor: pointer;
}
.drawer-toggle input { opacity: 0; width: 0; height: 0; }
.drawer-toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(255,255,255,.15);
  transition: background .2s;
}
.drawer-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.drawer-toggle input:checked + .drawer-toggle-slider { background: var(--green); }
.drawer-toggle input:checked + .drawer-toggle-slider::before { transform: translateX(18px); }

/* ── Logout Button ───────────────────────────────────────── */
.drawer-logout-section {
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  flex-shrink: 0;
}
.drawer-logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,59,48,.08);
  border: 1px solid rgba(255,59,48,.15);
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.drawer-logout-btn:active { background: rgba(255,59,48,.15); }

/* ── Legal Footer ────────────────────────────────────────── */
.drawer-legal {
  padding: 10px 16px calc(var(--safe-bottom) + 10px);
  border-top: 1px solid var(--drawer-border);
  background: rgba(0,0,0,.3);
  flex-shrink: 0;
}
.drawer-legal-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  margin-bottom: 6px;
}
.drawer-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.drawer-legal-link {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  transition: color .15s;
}
.drawer-legal-link:active { color: rgba(255,255,255,.7); }
.drawer-legal-sep {
  color: rgba(255,255,255,.15);
  font-size: 11px;
  align-self: center;
}
.drawer-legal-dgii {
  width: 100%;
  margin-top: 5px;
  font-size: 10px;
  color: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Mobile App Global Fixes ─────────────────────────────── */
html, body {
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Touch target minimum 44px */
button, a, [role="button"] {
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.drawer-item-icon, .drawer-star, .drawer-legal-link {
  min-height: unset;
}

/* No text selection on UI elements */
.drawer-header, .drawer-nav-body, .drawer-logout-section, .drawer-legal {
  -webkit-user-select: none;
  user-select: none;
}

/* ── Pull-to-refresh indicator ───────────────────────────── */
.ptr-indicator {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: top .2s;
}
.ptr-indicator.visible { top: 16px; }

/* ── View Screen (full-screen overlay) ──────────────────── */
.view-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #0D0D0D;
  transform: translateX(100%);
  transition: transform .28s var(--transition);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.view-screen.open { transform: translateX(0); }

.view-screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--safe-top) + 8px) 16px 12px;
  background: #0D0D0D;
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: sticky;
  top: 0;
  z-index: 10;
}
.close-view {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.view-screen-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  flex: 1;
}
.view-screen-body {
  padding: 16px 16px calc(var(--safe-bottom) + 20px);
}

/* ── Section cards inside views ──────────────────────────── */
.info-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
}
.info-card-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  cursor: pointer;
}
.info-card-item:last-child { border-bottom: none; }
.info-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.info-card-text { flex: 1; }
.info-card-text strong { display: block; font-size: 14px; color: #fff; margin-bottom: 2px; }
.info-card-text span   { font-size: 12px; color: rgba(255,255,255,.45); }
.info-card-arrow { font-size: 16px; color: rgba(255,255,255,.25); }

/* ── Stat cards for earnings ─────────────────────────────── */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-box {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.stat-box-val  { font-size: 22px; font-weight: 800; color: var(--green); margin-bottom: 2px; }
.stat-box-lbl  { font-size: 11px; color: rgba(255,255,255,.4); }

/* ── Settings list ───────────────────────────────────────── */
.settings-group { margin-bottom: 16px; }
.settings-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 0 4px;
  margin-bottom: 6px;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 6px;
  cursor: pointer;
}
.settings-item-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.settings-item-info { flex: 1; }
.settings-item-info strong { display: block; font-size: 14px; color: #fff; }
.settings-item-info span   { font-size: 12px; color: rgba(255,255,255,.4); }
.settings-item-control { flex-shrink: 0; }

/* Dark mode toggle */
.toggle-sm {
  position: relative;
  width: 44px;
  height: 26px;
  display: block;
  cursor: pointer;
}
.toggle-sm input { opacity: 0; width: 0; height: 0; }
.toggle-sm-slider {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(255,255,255,.15);
  transition: background .2s;
}
.toggle-sm-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.toggle-sm input:checked + .toggle-sm-slider { background: var(--green); }
.toggle-sm input:checked + .toggle-sm-slider::before { transform: translateX(18px); }

/* ── SOS Button ──────────────────────────────────────────── */
.sos-card {
  background: rgba(255,59,48,.08);
  border: 1px solid rgba(255,59,48,.2);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.sos-card-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(255,59,48,.4);
  animation: sosPulse 2s infinite;
}
@keyframes sosPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,59,48,.4); }
  70%  { box-shadow: 0 0 0 16px rgba(255,59,48,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,59,48,0); }
}
.sos-card h3 { font-size: 16px; font-weight: 700; color: var(--red); margin-bottom: 4px; }
.sos-card p  { font-size: 12px; color: rgba(255,255,255,.5); }

/* ── Notification item ───────────────────────────────────── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  cursor: pointer;
}
.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 3px; }
.notif-body  { font-size: 12px; color: rgba(255,255,255,.55); line-height: 1.4; }
.notif-time  { font-size: 11px; color: rgba(255,255,255,.3); margin-top: 3px; }
.notif-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ── Skeleton loader ─────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg,
    rgba(255,255,255,.05) 25%,
    rgba(255,255,255,.10) 50%,
    rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ── Ripple on touch ─────────────────────────────────────── */
.drawer-item { overflow: hidden; position: relative; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  transform: scale(0);
  animation: rippleAnim .45s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(2.5); opacity: 0; }
}

/* ── Scroll snap for horizontal quick actions ────────────── */
.quick-actions-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 16px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.quick-actions-row::-webkit-scrollbar { display: none; }
.quick-action-chip {
  scroll-snap-align: start;
  flex-shrink: 0;
  background: rgba(0,200,83,.1);
  border: 1px solid rgba(0,200,83,.2);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── iOS safe area for pass-bottom-panel ────────────────── */
.pass-bottom-panel {
  padding-bottom: calc(var(--safe-bottom) + 20px) !important;
}

/* ── Light mode (when app uses light background) ─────────── */
@media (prefers-color-scheme: light) {
  /* Keep drawer dark even in light mode — matches Uber/DiDi */
  #drawer { background: #1a1a1a; }
}

/* ── Landscape phone ─────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  .drawer-header { padding-top: 12px; padding-bottom: 12px; }
  .drawer-avatar-wrap { width: 48px; height: 48px; margin-bottom: 8px; }
  .drawer-avatar-img { width: 48px; height: 48px; }
  --item-h: 44px;
}

/* ── Large phones / small tablets ────────────────────────── */
@media (min-width: 390px) {
  :root { --drawer-width: 340px; }
}
@media (min-width: 480px) {
  :root { --drawer-width: 360px; }
}
