/* ============================================================
   MUBI — style.css  v3  (diseño unificado oscuro)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Instrument+Sans:wght@400;500;600&display=swap');

:root {
  --bg:      #0d0d0d;
  --surface: #161616;
  --card:    #1e1e1e;
  --border:  #2a2a2a;
  --border2: #333;
  --text:    #f0ede8;
  --muted:   #6b6864;
  --subtle:  #3a3835;
  --orange:  #ff5c1a;
  --orange2: #ff7a3d;
  --green:   #22c55e;
  --red:     #ef4444;
  --blue:    #3b82f6;
  --yellow:  #f59e0b;
  --r:  10px;
  --r2: 16px;
  --fh: 'Space Grotesk', sans-serif;
  --fb: 'Instrument Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--fb);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 16px 48px;
}

.container { width: 100%; max-width: 460px; padding-top: 64px; }
.admin-container { max-width: 580px; }

/* TOPBAR */
.btn-logout {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); padding: 7px 14px;
  border-radius: 20px; font-family: var(--fb); font-size: .78rem;
  font-weight: 500; cursor: pointer; transition: color .2s, border-color .2s;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* HEADINGS */
h1 { font-family: var(--fh); font-size: 1.45rem; font-weight: 700; letter-spacing: -.3px; margin-bottom: 18px; }
h2 { font-family: var(--fh); font-size: 1.05rem; font-weight: 600; margin-bottom: 12px; }
h3 { font-family: var(--fb); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
label { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; margin-top: 12px; }
label:first-child { margin-top: 0; }

/* INPUTS */
input, select, textarea {
  width: 100%; padding: 12px 14px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r); font-family: var(--fb); font-size: .95rem;
  color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 10px; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,92,26,.1);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6864' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer;
}
select option { background: var(--card); }
input[type="color"] { padding: 4px 6px; height: 44px; cursor: pointer; }

/* BUTTONS */
button {
  width: 100%; padding: 13px 20px; background: var(--orange); color: #fff;
  border: none; border-radius: var(--r); font-family: var(--fh); font-size: .9rem;
  font-weight: 600; cursor: pointer; transition: opacity .2s, transform .15s;
  margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 7px;
}
button:hover:not(:disabled) { opacity: .85; transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .32; cursor: not-allowed; transform: none; }
.btn-dark    { background: var(--text); color: var(--bg); }
.btn-ghost   { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border2); color: var(--text); }
.btn-danger  { background: var(--red); }
.btn-success { background: var(--green); }

/* CARD */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r2); padding: 18px; margin-bottom: 12px; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* WALLET */
.wallet-card {
  background: linear-gradient(135deg, #1c1c1c 0%, #111 100%);
  border: 1px solid var(--border2); border-radius: var(--r2);
  padding: 20px; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
  position: relative; overflow: hidden;
}
.wallet-card::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,92,26,.18) 0%, transparent 70%);
  pointer-events: none;
}
.wallet-label { font-size: .7rem; color: var(--muted); font-weight: 500; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.wallet-amount { font-family: var(--fh); font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.wallet-card.blue-card {
  background: linear-gradient(135deg, #151d2e 0%, #0d1420 100%);
  border-color: #1e2d45;
}
.wallet-card.blue-card::before { background: radial-gradient(circle, rgba(59,130,246,.2) 0%, transparent 70%); }
.wallet-card.blue-card .wallet-amount { color: #93c5fd; }

/* TOASTS */
#toast-container {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: 90%; max-width: 360px;
}
.toast {
  padding: 11px 20px; border-radius: 50px; font-family: var(--fb); font-size: .84rem;
  font-weight: 500; color: #fff; opacity: 0; transform: translateY(10px);
  animation: toastIn .28s ease forwards, toastOut .28s ease 3.2s forwards;
  pointer-events: none; width: 100%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.toast.success { background: #16532d; border: 1px solid #22c55e44; }
.toast.error   { background: #5a1a1a; border: 1px solid #ef444444; }
.toast.info    { background: #1e3a5f; border: 1px solid #3b82f644; }
.toast.warning { background: #4a3000; border: 1px solid #f59e0b44; }
@keyframes toastIn  { to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to { opacity:0; transform:translateY(10px); } }

/* SPINNER */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.2); border-top-color: #fff;
  border-radius: 50%; animation: spin .65s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* PANEL ESTADO */
#panel-estado-viaje { display: none; border-radius: var(--r2); overflow: hidden; margin-bottom: 14px; border: 1px solid var(--border); }
.estado-header { padding: 14px 18px; font-family: var(--fh); font-weight: 600; font-size: .9rem; color: #fff; display: flex; align-items: center; gap: 10px; }
.estado-header.buscando   { background: #252525; }
.estado-header.en_curso   { background: #1a2f52; }
.estado-header.completado { background: #14472a; }
.estado-header.cancelado  { background: #4a1515; }
.estado-body { padding: 13px 18px; background: var(--card); font-size: .85rem; color: var(--muted); line-height: 1.6; }
.pulso { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); flex-shrink: 0; animation: pulsar 1.4s infinite; }
@keyframes pulsar { 0%,100% { transform:scale(1); opacity:1; } 50% { transform:scale(1.7); opacity:.3; } }

/* VIAJE CARD */
.viaje-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r2); margin-bottom: 10px; overflow: hidden; }
.viaje-card-header { background: var(--surface); padding: 9px 14px; font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.viaje-card-body { padding: 14px; }
.viaje-card-body p { margin-bottom: 7px; font-size: .88rem; color: var(--text); }
.viaje-card-body p:last-of-type { margin-bottom: 10px; }
.viaje-card-body strong { color: var(--muted); font-weight: 500; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 600; }
.badge-wallet   { background: rgba(59,130,246,.12); color: #60a5fa; border: 1px solid rgba(59,130,246,.2); }
.badge-efectivo { background: rgba(34,197,94,.12);  color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.badge-estado   { font-size: .7rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.badge-completado { background: rgba(34,197,94,.12);   color: #4ade80; }
.badge-cancelado  { background: rgba(239,68,68,.12);   color: #f87171; }
.badge-pendiente  { background: rgba(107,114,128,.12); color: #9ca3af; }
.badge-en_curso   { background: rgba(59,130,246,.12);  color: #60a5fa; }

/* RETIRO ROW */
.retiro-row { display: flex; gap: 8px; align-items: flex-end; }
.retiro-row input { margin-bottom: 0; flex: 1; }
.retiro-row button { width: auto; padding: 12px 18px; margin-bottom: 0; flex-shrink: 0; }

/* RETO BAR */
.reto-bar-wrap { background: rgba(255,255,255,.08); border-radius: 4px; height: 5px; margin: 6px 0 2px; overflow: hidden; }
.reto-bar-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange2)); border-radius: 4px; transition: width .6s ease; }

/* VIAJE ACTIVO */
#viaje-activo { background: var(--card); border: 1px solid #1e3a5f; border-radius: var(--r2); padding: 18px; margin-bottom: 14px; }
#viaje-activo h2 { color: #60a5fa; font-family: var(--fh); text-align: left; margin-bottom: 14px; font-size: 1rem; }
#precio-total-preview { text-align: center; font-family: var(--fh); font-size: 1.3rem; font-weight: 700; color: var(--orange); margin: 8px 0 14px; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 1000; justify-content: center; align-items: flex-end; backdrop-filter: blur(6px); }
.modal-overlay.activo { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border2); width: 100%; max-width: 460px; border-radius: 20px 20px 0 0; padding: 28px 24px 40px; animation: slideUp .3s cubic-bezier(.16,1,.3,1); position: relative; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h3 { font-family: var(--fh); font-size: 1.1rem; text-align: center; margin-bottom: 6px; }
.modal-sub { text-align: center; color: var(--muted); font-size: .84rem; margin-bottom: 20px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: var(--card); border: 1px solid var(--border); color: var(--muted); border-radius: 50%; width: 30px; height: 30px; padding: 0; font-size: .95rem; cursor: pointer; margin: 0; display: flex; align-items: center; justify-content: center; transition: color .2s; }
.modal-close:hover { color: var(--text); }

/* ESTRELLAS */
.star-selector { display: flex; justify-content: center; gap: 8px; margin: 14px 0 18px; }
.star-selector span { font-size: 2rem; cursor: pointer; transition: transform .15s; filter: grayscale(1) brightness(.4); opacity: .5; }
.star-selector span.activa { filter: none; opacity: 1; transform: scale(1.15); }
.star-selector span:hover  { transform: scale(1.2); filter: none; opacity: .8; }

/* HISTORIAL */
.historial-toggle { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--border); margin-top: 20px; cursor: pointer; font-family: var(--fh); font-size: .88rem; font-weight: 600; color: var(--muted); transition: color .2s; }
.historial-toggle:hover { color: var(--text); }
.historial-toggle .chevron { font-size: .8rem; transition: transform .25s; }
.historial-toggle.abierto .chevron { transform: rotate(180deg); }
.historial-lista { display: none; }
.historial-lista.visible { display: block; }
.historial-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 15px; margin-bottom: 8px; font-size: .85rem; }
.historial-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.historial-item-ruta { color: var(--muted); line-height: 1.6; margin-bottom: 8px; font-size: .82rem; }
.historial-item-footer { display: flex; justify-content: space-between; align-items: center; font-size: .77rem; color: var(--muted); }
.btn-calificar { background: none; border: 1px solid rgba(245,158,11,.3); color: var(--yellow); border-radius: 20px; padding: 3px 10px; font-family: var(--fb); font-size: .72rem; width: auto; margin: 0; cursor: pointer; transition: background .2s; }
.btn-calificar:hover { background: rgba(245,158,11,.08); }
.historial-paginacion { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.historial-paginacion button { background: var(--card); border: 1px solid var(--border); color: var(--muted); width: auto; padding: 7px 18px; font-family: var(--fb); font-size: .82rem; border-radius: 20px; margin: 0; }
.historial-paginacion button:hover:not(:disabled) { border-color: var(--border2); color: var(--text); }

/* RECARGA */
#caja-recarga { background: var(--card); border: 1px solid var(--border); border-radius: var(--r2); padding: 16px; margin-bottom: 14px; }
#caja-recarga h3 { font-family: var(--fh); font-size: .9rem; color: var(--text); margin-bottom: 12px; text-transform: none; letter-spacing: 0; }

/* REFERIDO */
.referido-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; font-size: .83rem; color: var(--muted); }
.referido-code { font-family: var(--fh); font-weight: 700; color: var(--orange); font-size: .95rem; letter-spacing: .5px; }

/* BANNER */
#banner-publicidad { display: none; padding: 11px 16px; border-radius: var(--r); margin-bottom: 14px; text-align: center; font-family: var(--fh); font-size: .85rem; font-weight: 600; }

/* FORM VIAJE */
#form-solicitud { background: var(--card); border: 1px solid var(--border); border-radius: var(--r2); padding: 20px; margin-bottom: 14px; }
#form-solicitud h1 { text-align: left; font-size: 1.2rem; margin-bottom: 16px; }
#acciones-activas { margin-bottom: 14px; }

/* ADMIN STATS */
.seccion-stats { margin-bottom: 20px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 14px; text-align: center; }
.stat-valor { font-family: var(--fh); font-size: 1.65rem; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: .68rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.stat-card.verde .stat-valor   { color: var(--green); }
.stat-card.rojo  .stat-valor   { color: var(--red); }
.stat-card.negro .stat-valor   { color: var(--text); }
.tabla-stats { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tabla-stats thead tr { border-bottom: 1px solid var(--border); }
.tabla-stats th { padding: 10px 14px; text-align: left; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.tabla-stats td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.tabla-stats tr:last-child td { border-bottom: none; }
.bar-chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: .78rem; }
.bar-chart-label { width: 46px; color: var(--muted); text-align: right; flex-shrink: 0; font-size: .72rem; }
.bar-chart-bar { flex: 1; background: var(--border); border-radius: 3px; height: 8px; overflow: hidden; }
.bar-chart-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange2)); border-radius: 3px; transition: width .7s ease; }
.bar-chart-val { width: 24px; color: var(--text); font-weight: 600; text-align: right; }

/* OP CARDS ADMIN */
.op-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.op-card-info { flex: 1; min-width: 0; }
.op-card-info b { font-family: var(--fh); font-size: 1.05rem; color: var(--text); display: block; margin-bottom: 3px; }
.op-card-info small { font-size: .75rem; color: var(--muted); display: block; line-height: 1.6; }
.btn-group { display: flex; gap: 7px; }
.btn-group button { width: 36px; height: 36px; padding: 0; margin: 0; border-radius: 8px; font-size: .9rem; flex-shrink: 0; }
.btn-group .btn-ok  { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.2); }
.btn-group .btn-ok:hover:not(:disabled) { background: rgba(34,197,94,.22); }
.btn-group .btn-no  { background: rgba(239,68,68,.12);  color: var(--red);   border: 1px solid rgba(239,68,68,.2); }
.btn-group .btn-no:hover:not(:disabled) { background: rgba(239,68,68,.22); }

/* CFG GRID */
.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cfg-field { margin-bottom: 0; }
.cfg-field label { margin-top: 0; margin-bottom: 4px; }
.cfg-field input { margin-bottom: 0; }

.empty-state { text-align: center; padding: 24px 16px; color: var(--muted); font-size: .84rem; }
.empty-icon { font-size: 1.8rem; margin-bottom: 8px; display: block; opacity: .4; }

@media (max-width: 500px) {
  body { padding: 0 12px 48px; }
  .container { padding-top: 56px; }
  .wallet-amount { font-size: 1.5rem; }
}