@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=DM+Sans:wght@400;500;600&display=swap");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #014dab;
  --blue-dark: #013a82;
  --blue-light: #e7f6ff;
  --blue-mid: #d0e8f8;
  --blue-dim: rgba(1,77,171,0.08);
  --blue-glow: rgba(1,77,171,0.2);
  --text: #0f172a;
  --text2: #364151;
  --text3: #7a8fa6;
  --border: #d1dae5;
  --bg: #f0f6ff;
  --white: #ffffff;
  --surface: #ffffff;
  --surface2: #f8faff;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #d97706;
  --yellow-bg: #fef3c7;
  --purple: #7c3aed;
  --purple-bg: #ede9fe;
  --gray: #6b7280;
  --gray-bg: #f3f4f6;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(1,77,171,0.08);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── LOGIN ─── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #0a6fd4 100%);
  position: relative;
  overflow: hidden;
}

#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='40' cy='40' r='30'/%3E%3C/g%3E%3C/svg%3E");
}

.login-box {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  text-align: center;
}

.login-logo { font-size: 3rem; display: block; margin-bottom: 12px; }

.login-box h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.login-box h1 span { color: var(--blue); }
.login-sub { color: var(--text3); font-size: 0.88rem; margin-bottom: 28px; }

.login-field { margin-bottom: 12px; }

.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
  background: white;
}

.btn-login {
  width: 100%;
  padding: 13px;
  margin-top: 8px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 4px 14px var(--blue-glow);
}

.btn-login:hover { background: var(--blue-dark); }
.btn-login:active { transform: scale(0.98); }

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

/* ─── LAYOUT ─── */
#panel { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
  box-shadow: 2px 0 12px rgba(1,77,171,0.06);
}

.sidebar-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--blue);
  padding: 0 8px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { color: var(--text); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text3);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item:hover { background: var(--blue-light); color: var(--blue); }

.nav-item.active {
  background: var(--blue-dim);
  color: var(--blue);
  font-weight: 600;
  border: 1px solid var(--blue-mid);
}

.nav-icon { font-size: 1rem; }

.btn-logout-sidebar {
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text3);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.btn-logout-sidebar:hover { border-color: #ef4444; color: #ef4444; }

.main-wrap { margin-left: 220px; flex: 1; display: flex; flex-direction: column; }

/* ─── TOPBAR ─── */
.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(1,77,171,0.06);
}

.topbar-left h2 { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.topbar-fecha { font-size: 0.8rem; color: var(--text3); margin-top: 2px; display: block; text-transform: capitalize; }

.btn-refresh {
  padding: 8px 16px;
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: 8px;
  color: var(--blue);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-refresh:hover { background: var(--blue-mid); }

/* ─── CONTENT ─── */
.content { padding: 32px; flex: 1; }
.seccion { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── STATS ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-label { font-size: 0.75rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-value { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; }
.stat-value.blue { color: var(--blue); }
.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.purple { color: var(--purple); }

/* ─── TABLA ─── */
.tabla-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tabla-wrap table { width: 100%; border-collapse: collapse; }

.tabla-wrap th {
  padding: 12px 16px;
  background: var(--surface2);
  color: var(--text3);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.tabla-wrap td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f4fa;
  font-size: 0.92rem;
  vertical-align: middle;
}

.tabla-wrap tr:last-child td { border-bottom: none; }
.tabla-wrap tr:hover td { background: #fafcff; }

.hora-chip {
  background: var(--blue-dim);
  border: 1px solid var(--blue-mid);
  color: var(--blue);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-block;
  font-family: 'Outfit', sans-serif;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

.badge.pendiente { background: var(--yellow-bg); color: var(--yellow); border: 1px solid #fde68a; }
.badge.pendiente::before { background: var(--yellow); }
.badge.preparando { background: var(--blue-light); color: var(--blue); border: 1px solid var(--blue-mid); }
.badge.preparando::before { background: var(--blue); animation: pulse 1.5s infinite; }
.badge.lista { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.badge.lista::before { background: var(--green); }
.badge.recogida { background: var(--gray-bg); color: var(--gray); border: 1px solid #e5e7eb; }
.badge.recogida::before { background: var(--gray); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.btns-estado { display: flex; gap: 6px; }

.btn-estado {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-estado:hover { background: var(--blue); border-color: var(--blue); color: white; }

/* ─── CALENDARIO ─── */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.cal-mes-titulo { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 700; text-transform: capitalize; }

.cal-nav {
  width: 34px; height: 34px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}

.cal-nav:hover { background: var(--blue-light); border-color: var(--blue-mid); color: var(--blue); }

.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.cal-grid-header span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text3);
  padding: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  border: 1px solid transparent;
  padding: 4px;
  min-height: 52px;
}

.cal-day:hover:not(.vacio):not(.cerrado) { background: var(--blue-light); }
.cal-day.vacio { cursor: default; }
.cal-day.cerrado { opacity: 0.25; cursor: not-allowed; }
.cal-day.hoy { border-color: var(--blue); }
.cal-day.hoy .cal-day-num { color: var(--blue); font-weight: 700; }
.cal-day.seleccionado { background: var(--blue) !important; border-color: var(--blue); }
.cal-day.seleccionado .cal-day-num { color: white !important; font-weight: 700; }

.cal-day-num { font-size: 0.88rem; font-weight: 500; color: var(--text2); }

.cal-dot-row { display: flex; gap: 2px; margin-top: 3px; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--blue); opacity: 0.7; }
.cal-count { font-size: 0.62rem; color: var(--blue); font-weight: 700; margin-top: 1px; }

.cal-detalle {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}

.cal-detalle-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-detalle-header h3 { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; text-transform: capitalize; }

.cal-detalle-header button {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.9rem;
}

/* ─── TIMELINE ─── */
.timeline-controls { margin-bottom: 24px; display: flex; gap: 12px; align-items: center; }
.timeline-controls label { color: var(--text2); font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 8px; }

.timeline-controls input[type="date"] {
  padding: 8px 12px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.timeline-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 200px;
  box-shadow: var(--shadow);
}

.timeline-empty { text-align: center; color: var(--text3); padding: 48px 0; font-size: 0.95rem; }

.timeline-lane { display: flex; flex-direction: column; }

.tl-item {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 12px 0;
  position: relative;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: 51px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.tl-item:first-child::before { top: 50%; }
.tl-item:last-child::before { bottom: 50%; }

.tl-hora { width: 50px; text-align: right; font-family: 'Outfit', sans-serif; font-size: 0.88rem; font-weight: 700; color: var(--blue); padding-top: 8px; flex-shrink: 0; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--blue); border: 3px solid var(--bg); flex-shrink: 0; margin-top: 11px; position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--blue-mid); }

.tl-card {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tl-info .tl-pizza { font-weight: 600; font-size: 0.95rem; }
.tl-info .tl-cliente { font-size: 0.82rem; color: var(--text3); margin-top: 2px; }

/* UTILS */
.oculto { display: none !important; }
.tabla-vacia { text-align: center; color: var(--text3); padding: 48px; font-size: 0.95rem; }
