/* /public_html/assets/css/rides.css — MA Ayacucho (Producción)
   - Sin dependencias externas ni inline styles (CSP estricta)
   - Mobile-first, accesible, consistente con mapa.css
*/

/* --------- Variables de tema --------- */
:root{
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;           /* gris muy claro */
  --text: #0f172a;                /* slate-900 */
  --muted: #64748b;               /* slate-500 */
  --border: #e2e8f0;              /* slate-200 */
  --brand: #0ea5e9;               /* cyan-500 */
  --brand-ink: #022c3a;           /* contraste sobre brand */
  --ok: #16a34a;                  /* verde */
  --warn: #f59e0b;                /* ámbar */
  --danger: #ef4444;              /* rojo */
  --shadow: 0 8px 24px rgba(0,0,0,.12);
}

@media (prefers-color-scheme: dark){
  :root{
    --bg: #0b1220;
    --surface: #0f172a;
    --surface-2: #0b1220;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2937;
    --brand: #22d3ee;            /* cyan-400 */
    --brand-ink: #042229;
    --shadow: 0 12px 30px rgba(0,0,0,.35);
  }
}

/* --------- Base / resets --------- */
*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html{ color-scheme: light dark; }
body{
  margin: 0;
  font: 400 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

img,svg{ display:block; max-width:100%; }
a{ color: var(--brand); text-underline-offset: 2px; }
:focus-visible{ outline: 2px solid var(--brand); outline-offset: 2px; }

.hidden{ display:none !important; }
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* --------- Contenedores de página (index.html) --------- */
.rides-container{
  width: min(960px, 92vw);
  margin: 20px auto;
  padding: 12px;
}

.rides-header{
  display:flex; align-items:center; gap:12px;
  margin-bottom: 12px;
}
.rides-header h1{ font-size: 22px; margin: 0; }
.rides-header .meta{ color: var(--muted); font-size: 14px; }

/* --------- Botones --------- */
.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer; user-select: none;
}
.btn--primary{ background: var(--brand); color:#fff; border-color: transparent; }
.btn--danger{ background: var(--danger); color:#fff; border-color: transparent; }
.btn--ghost{ background: transparent; }
.btn[disabled]{ opacity:.6; cursor:not-allowed; }
.btn .spinner{
  width: 16px; height: 16px; border:2px solid currentColor;
  border-bottom-color: transparent; border-radius: 50%;
  display:inline-block; vertical-align: middle;
  animation: spin 1s linear infinite;
}

/* --------- Chips / badges --------- */
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding: 4px 8px; border-radius: 9999px;
  border: 1px solid var(--border); font-size: 12px;
  background: var(--surface); color: var(--text);
}
.chip--ok{ border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); color: var(--ok); }
.chip--warn{ border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); color: var(--warn); }
.chip--danger{ border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); color: var(--danger); }

/* --------- Panel de estado flotante (inyectado por ui-rides.js) --------- */
.status-panel{
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  z-index: 1100;
  max-width: min(720px, 94vw);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  display: none; /* visible cuando .is-visible */
  gap: 12px; align-items: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
@media (prefers-color-scheme: dark){
  .status-panel{ background: rgba(17,24,39,.85); }
}
.status-panel.is-visible{ display: flex; }
.status-panel__title{ font-weight: 700; font-size: 15px; }
.status-panel__meta{ color: var(--muted); font-size: 13px; }

/* --------- FAB principal "Pedir MA" --------- */
.fab{
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1100;
}
.fab button{
  display: inline-flex; align-items:center; gap:8px;
  padding: 10px 14px; border-radius: 9999px;
  border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600;
  box-shadow: var(--shadow);
}
.fab button[disabled]{ opacity:.6; cursor: not-allowed; }

/* --------- FAB secundario opcional --------- */
.fab-mini{
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 1100;
}
.fab-mini button{
  width:44px; height:44px; border-radius:12px;
  display:grid; place-items:center;
  border:1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* --------- Toast / avisos --------- */
.toast{
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 1200;
  display: none; /* visible con .is-visible */
  padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text); font-weight: 500;
}
.toast.is-visible{ display: inline-block; }

/* --------- Banner offline --------- */
.offline-banner{
  position: fixed; inset: auto 0 0 0;
  background: var(--danger); color: #fff;
  text-align: center; font-size: 13px; padding: 8px 10px;
  z-index: 1200; display: none;
}
.offline .offline-banner{ display: block; }

/* --------- Listado y tarjetas (opcional: historial de rides) --------- */
.ride-list{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 12px 0 24px;
}
@media (min-width: 640px){
  .ride-list{ grid-template-columns: 1fr 1fr; }
}
.ride-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid; gap: 6px;
}
.ride-card__head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.ride-card__title{ font-weight: 700; }
.ride-card__meta{ color: var(--muted); font-size: 13px; }
.ride-card__body{ font-size: 14px; }
.ride-card__actions{ display:flex; flex-wrap:wrap; gap:8px; margin-top: 6px; }

/* --------- Utilidades --------- */
.card{
  background: var(--surface); border:1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px;
}
.center{ display:grid; place-items:center; }
.space{ flex:1; }

@keyframes spin{ to{ transform: rotate(360deg); } }

/* --------- Compatibilidad iOS notch --------- */
.safe-top{ padding-top: env(safe-area-inset-top); }
.safe-right{ padding-right: env(safe-area-inset-right); }
.safe-bottom{ padding-bottom: env(safe-area-inset-bottom); }
.safe-left{ padding-left: env(safe-area-inset-left); }

/* --------- Modo impresión (oculta elementos flotantes) --------- */
@media print{
  .status-panel, .fab, .fab-mini, .toast, .offline-banner{ display:none !important; }
  .rides-container{ width: auto; margin: 0; padding: 0; }
}
