/* ============================================================
   MARIACHI AGENDA — Estilos principales
   Paleta: Oscuro profundo · Oro cálido · Rojo mariachi
   ============================================================ */

:root {
  --bg:          #0A0A0A;
  --surface:     #161616;
  --surface-2:   #1F1F1F;
  --surface-3:   #262626;
  --gold:        #E8A320;
  --gold-light:  #F4C04E;
  --gold-dark:   #B07810;
  --red:         #C41E3A;
  --red-light:   #EF4444;
  --green:       #16A34A;
  --green-light: #22C55E;
  --yellow:      #CA8A04;
  --text:        #F4F4F0;
  --text-muted:  #888;
  --text-dim:    #444;
  --border:      #2A2A2A;
  --border-gold: #3A2A0A;
  --radius:      14px;
  --radius-sm:   9px;
  --radius-xs:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,.7);
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { font-size: 16px; -webkit-text-size-adjust: 100%; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: 82px;
  line-height: 1.55;
  max-width: 640px;
  margin: 0 auto;
}
a { color: var(--gold); }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* ─── Header de página ──────────────────────────────────── */
.page-header {
  padding: 18px 16px 14px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; flex: 1; }
.page-header .header-action {
  font-size: .8rem; color: var(--gold);
  text-decoration: none; font-weight: 600;
}
.content { padding: 16px; }

/* ─── Secciones ─────────────────────────────────────────── */
.section { margin-bottom: 24px; }
.section-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.section-header .label { flex: 1; }
.section-header a { font-size: .8rem; color: var(--gold); text-decoration: none; }
.label {
  font-size: .68rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
}

/* ─── Tarjetas de evento ────────────────────────────────── */
.event-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 14px 14px 18px;
  margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
  position: relative; overflow: hidden;
  text-decoration: none; color: inherit;
  transition: background .15s;
}
.event-card:active { background: var(--surface-2); }
.event-card::before {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--tipo-color, var(--gold));
  border-radius: 4px 0 0 4px;
}
.event-card .time-col { min-width: 52px; text-align: center; }
.event-card .time-start {
  font-size: 1.15rem; font-weight: 700; color: var(--text); line-height: 1.1;
}
.event-card .time-end { font-size: .68rem; color: var(--text-muted); }
.event-card .info-col { flex: 1; min-width: 0; }
.event-card .event-badge {
  display: inline-block; font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--tipo-color, var(--gold));
}
.event-card .event-client {
  font-size: .95rem; font-weight: 600; color: var(--text); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-card .event-location {
  font-size: .78rem; color: var(--text-muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 1;
  -webkit-box-orient: vertical; overflow: hidden;
}
.event-card .event-meta {
  display: flex; align-items: center; gap: 10px; margin-top: 7px;
  font-size: .73rem; color: var(--text-dim); flex-wrap: wrap;
}
.event-card .event-meta a { color: var(--gold); text-decoration: none; }
.event-card .event-actions { display: flex; gap: 6px; margin-top: 10px; }

/* Colores por tipo */
.tipo-serenata    { --tipo-color: #818CF8; }
.tipo-boda        { --tipo-color: #F9A8D4; }
.tipo-cumpleanos  { --tipo-color: #FCD34D; }
.tipo-quinceanera { --tipo-color: #C084FC; }
.tipo-corporativo { --tipo-color: #67E8F9; }
.tipo-bautizo     { --tipo-color: #86EFAC; }
.tipo-aniversario { --tipo-color: #FCA5A5; }
.tipo-graduacion  { --tipo-color: #6EE7B7; }
.tipo-otro        { --tipo-color: #E8A320; }

/* ─── Timeline visual (firma del diseño) ─────────────────── */
.timeline-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
}
.timeline-label { font-size: .65rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.timeline-track {
  position: relative; height: 36px;
  background: var(--surface-2); border-radius: 6px;
  overflow: hidden;
}
.timeline-event-block {
  position: absolute; top: 4px; bottom: 4px;
  border-radius: 4px; display: flex; align-items: center;
  padding: 0 6px; min-width: 3px; overflow: hidden;
}
.timeline-event-block span {
  font-size: .6rem; font-weight: 700; color: rgba(0,0,0,.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timeline-hours {
  display: flex; justify-content: space-between;
  padding: 4px 2px 0; 
}
.timeline-hours span { font-size: .62rem; color: var(--text-dim); }

/* ─── Alertas ───────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start;
  font-size: .88rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.alert-content h4 { font-size: .85rem; font-weight: 700; margin-bottom: 2px; }
.alert-content p { font-size: .8rem; line-height: 1.4; color: inherit; opacity: .85; }
.alert-danger  { background: rgba(196,30,58,.15);  border: 1px solid rgba(196,30,58,.35); color: #FCA5A5; }
.alert-warning { background: rgba(202,138,4,.15);  border: 1px solid rgba(202,138,4,.35); color: #FDE68A; }
.alert-success { background: rgba(22,163,74,.15);  border: 1px solid rgba(22,163,74,.35); color: #86EFAC; }
.alert-info    { background: rgba(232,163,32,.08); border: 1px solid var(--border-gold); color: var(--gold-light); }

/* ─── Formularios ───────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: .75rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 6px;
}
.form-label .req { color: var(--red-light); margin-left: 2px; }
.form-control {
  width: 100%; background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text); font-size: .95rem;
  appearance: none; -webkit-appearance: none; outline: none;
  transition: border-color .2s, background .2s;
}
.form-control:focus {
  border-color: var(--gold); background: var(--surface-3);
}
.form-control::placeholder { color: var(--text-dim); }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23888' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px; cursor: pointer;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: .73rem; color: var(--text-dim); margin-top: 4px; }
.form-section-title {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 8px 0 10px; border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ─── Conflicto/traslado inline ─────────────────────────── */
#conflicto-resultado, #traslado-resultado {
  margin: -4px 0 14px;
  display: none;
}

/* ─── Botones ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600; cursor: pointer; border: none;
  outline: none; text-decoration: none; transition: all .15s;
  white-space: nowrap; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.96); }
.btn-gold    { background: var(--gold); color: #000; }
.btn-gold:hover { background: var(--gold-light); }
.btn-ghost   { background: var(--surface-2); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger  { background: rgba(196,30,58,.12); color: #FCA5A5; border: 1px solid rgba(196,30,58,.25); }
.btn-danger:hover { background: rgba(196,30,58,.2); }
.btn-full    { width: 100%; }
.btn-sm      { padding: 7px 13px; font-size: .82rem; }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ─── Navegación inferior ───────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 640px; margin: 0 auto;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 9px 4px 11px;
  text-decoration: none; color: var(--text-muted);
  font-size: .62rem; font-weight: 600; gap: 2px; transition: color .15s;
}
.bottom-nav a.active { color: var(--gold); }
.nav-icon { font-size: 1.25rem; line-height: 1; }

/* ─── Login ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 28px 20px;
  padding-bottom: 28px;
}
.login-logo { font-size: 4.5rem; text-align: center; margin-bottom: 6px; line-height: 1; }
.login-name { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: 2px; }
.login-sub  { font-size: .85rem; color: var(--text-muted); text-align: center; margin-bottom: 36px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 22px;
  width: 100%; max-width: 360px;
}

/* ─── Calendario ────────────────────────────────────────── */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px; margin-bottom: 16px;
}
.cal-nav button {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 1rem; cursor: pointer;
}
.cal-nav h2 { font-size: 1rem; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-head {
  text-align: center; font-size: .65rem; font-weight: 700;
  color: var(--text-dim); padding: 6px 0; text-transform: uppercase; letter-spacing: .05em;
}
.cal-cell {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 5px 2px 2px; border-radius: 8px;
  cursor: pointer; position: relative; transition: background .15s;
  min-height: 0;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other  { opacity: .25; pointer-events: none; }
.cal-cell.today .cal-num {
  background: var(--gold); color: #000; border-radius: 50%;
}
.cal-num {
  font-size: .82rem; font-weight: 600;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.cal-dots { display: flex; gap: 2px; margin-top: 2px; flex-wrap: wrap; justify-content: center; max-width: 22px; }
.cal-dot  { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.cal-day-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-top: 16px;
  display: none;
}
.cal-day-panel.open { display: block; }
.cal-day-panel h3 { font-size: .9rem; margin-bottom: 12px; color: var(--gold); text-transform: capitalize; }

/* ─── Historial ─────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 6px; margin-bottom: 16px; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: .78rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.chip.active {
  background: rgba(232,163,32,.14); border-color: var(--gold); color: var(--gold);
}

/* ─── Configuración ─────────────────────────────────────── */
.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.set-row  {
  display: flex; align-items: center; padding: 13px 16px; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-icon { font-size: 1.1rem; width: 28px; text-align: center; }
.set-info { flex: 1; min-width: 0; }
.set-info .name { font-size: .9rem; font-weight: 600; }
.set-info .detail { font-size: .73rem; color: var(--text-muted); }
.member-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(232,163,32,.15); display: flex; align-items: center;
  justify-content: center; font-size: .8rem; font-weight: 700;
  color: var(--gold); flex-shrink: 0; border: 1px solid var(--border-gold);
}

/* ─── Empty / loading ───────────────────────────────────── */
.empty {
  text-align: center; padding: 50px 20px; color: var(--text-muted);
}
.empty .empty-icon { font-size: 3rem; margin-bottom: 10px; opacity: .45; }
.empty h3 { color: var(--text-muted); font-size: .95rem; margin-bottom: 5px; }
.empty p  { font-size: .82rem; }
.loading  {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 24px; color: var(--text-muted); font-size: .85rem;
}
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Traslado info ─────────────────────────────────────── */
.traslado-card {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 11px 14px; display: flex; align-items: center; gap: 10px; font-size: .84rem;
}
.traslado-card .t-icon { font-size: 1.1rem; }
.traslado-card strong { display: block; color: var(--text); font-size: .88rem; }
.traslado-card span   { color: var(--text-muted); font-size: .76rem; }

/* ─── Toasts ────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 420px; pointer-events: none;
}
.toast {
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; pointer-events: auto;
  animation: toastIn .28s ease-out; box-shadow: var(--shadow);
}
.toast-ok  { background: #14532D; border: 1px solid var(--green); color: #86EFAC; }
.toast-err { background: #7F1D1D; border: 1px solid var(--red); color: #FCA5A5; }
.toast-inf { background: #1A1200; border: 1px solid var(--gold-dark); color: var(--gold); }
@keyframes toastIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

/* ─── Utilidades ────────────────────────────────────────── */
.text-gold  { color: var(--gold); }
.text-red   { color: #FCA5A5; }
.text-green { color: var(--green-light); }
.text-muted { color: var(--text-muted); }
.divider    { height: 1px; background: var(--border); margin: 18px 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ─── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
