/* ============================================================
   SISTEMA DE CONTROL DE TURNOS — Estilos Premium & Empresarial
   ============================================================ */

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

:root {
  /* Paleta de Colores Moderna (HSL) */
  --primary-brand:  #1e3a8a; /* Deep Slate Blue */
  --primary-accent: #3b82f6; /* Modern Blue */
  --primary-glow:   rgba(59, 130, 246, 0.15);
  
  --azul-osc:    #1e3a8a;
  --azul-med:    #3b82f6;
  --azul-clar:   #dbeafe;
  
  --verde-osc:   #065f46;
  --verde-clar:  #d1fae5;
  
  --naranja-osc: #c2410c;
  --naranja-clar:#ffedd5;
  
  --rojo:        #991b1b;
  --rojo-clar:   #fee2e2;
  
  --amarillo:    #d97706;
  --amarillo-cl: #fef3c7;
  
  --gris-osc:    #4b5563;
  --gris:        #cbd5e1;
  --gris-clar:   #f8fafc;
  --blanco:      #ffffff;
  
  --sidebar-w:   265px;
  --header-h:    64px;
  --radius:      12px;
  --radius-sm:   6px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
  --shadow:      0 4px 20px -2px rgba(0,0,0,0.06), 0 2px 8px -1px rgba(0,0,0,0.03);
  --shadow-lg:   0 12px 30px -4px rgba(0,0,0,0.08), 0 4px 16px -2px rgba(0,0,0,0.04);
  --transition:  all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f1f5f9;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--azul-med); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--azul-osc); text-decoration: none; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(30, 58, 138, 0.95) 0%, rgba(15, 23, 42, 1) 90%);
  padding: 20px;
}
.login-card {
  background: var(--blanco);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: var(--transition);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo h1 { font-size: 26px; color: var(--primary-brand); font-weight: 800; letter-spacing: -0.5px; }
.login-logo p  { color: var(--gris-osc); font-size: 14px; margin-top: 6px; }
.login-logo .icon { font-size: 52px; margin-bottom: 12px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1)); }

/* ── LAYOUT PRINCIPAL ──────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a; /* Slate 900 */
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition);
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid #1e293b;
}
.sidebar-brand h2 { font-size: 16px; font-weight: 800; color: var(--blanco); letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px; }
.sidebar-brand small { font-size: 11px; color: #64748b; font-weight: 500; display: block; margin-top: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section { padding: 12px 12px 6px; font-size: 11px; text-transform: uppercase;
               letter-spacing: 1.2px; color: #475569; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  cursor: pointer; border-radius: 8px;
  transition: var(--transition);
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 3px;
}
.nav-item:hover { background: #1e293b; color: var(--blanco); text-decoration: none; }
.nav-item.active { background: var(--primary-accent); color: var(--blanco); font-weight: 600; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25); }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid #1e293b;
  background: #090d16;
}
.sidebar-user { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--azul-med) 0%, var(--primary-brand) 100%);
  color: var(--blanco);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}
.sidebar-user-info strong { display: block; font-size: 13.5px; color: var(--blanco); }
.sidebar-user-info span { color: #64748b; font-size: 11px; text-transform: capitalize; font-weight: 500; }

/* Main content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.topbar {
  height: var(--header-h);
  background: var(--blanco);
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--azul-osc); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* Page content */
.page-content { padding: 32px; flex: 1; }
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 24px; font-weight: 800; color: var(--azul-osc); letter-spacing: -0.5px; }
.page-header p  { color: var(--gris-osc); margin-top: 4px; font-size: 14px; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--blanco);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 24px;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
  padding: 18px 24px;
  background: var(--blanco);
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--azul-osc); }
.card-body { padding: 24px; }

/* ── STAT CARDS ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--blanco);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px;
  border-left: 5px solid var(--azul-med);
  border-top: 1px solid rgba(0,0,0,0.02);
  border-bottom: 1px solid rgba(0,0,0,0.02);
  border-right: 1px solid rgba(0,0,0,0.02);
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.green  { border-left-color: var(--verde-osc); }
.stat-card.orange { border-left-color: var(--naranja-osc); }
.stat-card.red    { border-left-color: var(--rojo); }
.stat-icon { font-size: 32px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05)); }
.stat-info strong { font-size: 30px; font-weight: 800; color: var(--azul-osc); display: block; line-height: 1.1; }
.stat-info span   { display: block; font-size: 12.5px; color: var(--gris-osc); margin-top: 4px; font-weight: 500; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 13px; color: #334155; }
.form-control {
  width: 100%; padding: 10px 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px; font-size: 14px;
  transition: var(--transition);
  background: var(--blanco);
  color: #1e293b;
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--azul-med);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-hint { font-size: 11px; color: var(--gris-osc); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--rojo); margin-top: 4px; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}
.btn:hover { text-decoration: none; filter: brightness(.95); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--azul-med);  color: var(--blanco); }
.btn-success   { background: var(--verde-osc); color: var(--blanco); }
.btn-danger    { background: var(--rojo);      color: var(--blanco); }
.btn-warning   { background: var(--amarillo);  color: var(--blanco); }
.btn-secondary { background: #e2e8f0;          color: #334155; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-icon { padding: 8px 11px; }

/* ── TABLES ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: #1e293b; color: var(--blanco);
  padding: 14px 18px; text-align: left;
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .8px;
  white-space: nowrap;
  border-bottom: 2px solid #0f172a;
}
tbody tr { border-bottom: 1px solid #f1f5f9; transition: var(--transition); }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 13px 18px; vertical-align: middle; color: #334155; }
.td-actions { display: flex; gap: 8px; align-items: center; }

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.badge-admin      { background: #1e293b;            color: var(--blanco); }
.badge-supervisor { background: var(--azul-med);    color: var(--blanco); }
.badge-operador   { background: #e2e8f0;            color: #334155; }
.badge-activo     { background: var(--verde-clar);  color: var(--verde-osc); }
.badge-inactivo   { background: var(--rojo-clar);   color: var(--rojo); }
.badge-P          { background: var(--verde-clar);  color: var(--verde-osc); }
.badge-S          { background: #DAEEF3;            color: #0070C0; }

/* ── TURNOS TABLE (horizontal) ─────────────────────────────── */
.turnos-wrap { overflow-x: auto; max-height: 72vh; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: var(--radius); }
.turnos-table { border-collapse: collapse; font-size: 11.5px; }
.turnos-table th, .turnos-table td { border: 1px solid #e2e8f0; }
.turnos-table .th-fixed {
  position: sticky; left: 0; z-index: 10;
  background: #1e293b; color: var(--blanco);
  padding: 10px 14px; white-space: nowrap; min-width: 180px;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}
.turnos-table .th-mes {
  background: #1e293b; color: var(--blanco);
  padding: 8px; text-align: center; font-size: 11px; font-weight: 700;
}
.turnos-table .th-mes.alt { background: var(--primary-brand); }
.turnos-table .th-dia {
  background: #334155; color: var(--blanco);
  padding: 6px 4px; text-align: center; min-width: 34px; font-size: 11px; font-weight: 600;
}
.turnos-table .th-dia.weekend { background: #475569; }
.turnos-table .th-sem {
  background: #f8fafc; color: var(--gris-osc);
  padding: 4px; text-align: center; font-size: 9.5px; font-weight: 600;
}
.turnos-table .th-sem.weekend { background: #fef2f2; color: var(--rojo); }
.turnos-table .td-nombre {
  position: sticky; left: 0; z-index: 5;
  background: var(--blanco); padding: 8px 14px;
  white-space: nowrap; font-weight: 600;
  border-right: 2.5px solid var(--azul-med);
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}
.turnos-table .td-estado {
  text-align: center; padding: 6px 4px;
  cursor: pointer; min-width: 34px;
  font-size: 11px; font-weight: 700;
  transition: var(--transition);
}
.turnos-table .td-estado:hover { filter: brightness(.88); transform: scale(1.05); z-index:2; }

/* ── PUESTOS TABLE ─────────────────────────────────────────── */
.puestos-wrap { overflow-x: auto; max-height: 72vh; overflow-y: auto; }
.puestos-table { border-collapse: collapse; font-size: 11px; }
.puestos-table .th-puesto-d { background: var(--verde-osc);   color: var(--blanco); padding: 8px 12px; white-space: nowrap; }
.puestos-table .th-puesto-n { background: var(--naranja-osc); color: var(--blanco); padding: 8px 12px; white-space: nowrap; }
.puestos-table .td-asignado-d { background: var(--verde-clar);  padding: 6px 10px; font-size: 11px; white-space: nowrap; }
.puestos-table .td-asignado-n { background: var(--naranja-clar);padding: 6px 10px; font-size: 11px; white-space: nowrap; }
.puestos-table .td-sin { background: var(--rojo-clar); color: var(--rojo); font-weight: 700; font-size: 10px; }

/* ── MODALS ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  display: block; position: relative; height: auto;
  background: var(--blanco); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 92%; max-width: 540px; max-height: 88vh;
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,0.05);
  transform: translateY(-25px); transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 22px 28px; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 18px; font-weight: 700; color: var(--azul-osc); }
.modal-body   { padding: 28px; }
.modal-footer { padding: 18px 28px; border-top: 1px solid #f1f5f9; display: flex; gap: 12px; justify-content: flex-end; }
.btn-close { background: none; border: none; font-size: 26px; cursor: pointer; color: #94a3b8; line-height: 1; transition: var(--transition); }
.btn-close:hover { color: var(--rojo); }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
  padding: 14px 20px; border-radius: 8px;
  margin-bottom: 20px; font-size: 14px;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}
.alert-success { background: var(--verde-clar); color: var(--verde-osc); border-color: #a7f3d0; }
.alert-error   { background: var(--rojo-clar);  color: var(--rojo);      border-color: #fecaca; }
.alert-info    { background: var(--azul-clar);  color: var(--azul-osc);  border-color: #bfdbfe; }
.alert-warning { background: var(--amarillo-cl);color: #92400e;          border-color: #fde68a; }

/* ── SEARCH / FILTERS ─────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--blanco); border: 1.5px solid #cbd5e1;
  border-radius: 8px; padding: 8px 16px; flex: 1; max-width: 320px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--azul-med);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.search-box input { border: none; outline: none; width: 100%; font-size: 13.5px; background: transparent; font-family: inherit; }

/* ── DASHBOARD ─────────────────────────────────────────────── */
.date-selector {
  display: flex; align-items: center; gap: 14px;
  background: var(--blanco); border-radius: var(--radius);
  padding: 16px 24px; box-shadow: var(--shadow); margin-bottom: 24px;
  border: 1px solid rgba(0,0,0,0.03);
}
.date-selector label { font-weight: 700; color: var(--azul-osc); font-size: 14px; }
.date-selector input[type=date] { padding: 8px 14px; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 14px; font-family: inherit; transition: var(--transition); }
.date-selector input[type=date]:focus { outline: none; border-color: var(--azul-med); }

/* ── RESPONSIVE ────────────────────────────────────────────── */
.hamburger { display: none; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--azul-osc); }
@media (max-width: 768px) {
  .hamburger { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 18px; }
  .topbar { padding: 0 18px; }
}

/* ── UTILITIES ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: #64748b; }
.mt-1 { margin-top: 10px; }  .mt-2 { margin-top: 18px; } .mt-3 { margin-top: 28px; }
.mb-1 { margin-bottom: 10px; }.mb-2 { margin-bottom: 18px; }.mb-3 { margin-bottom: 28px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; border: 1.5px solid rgba(0,0,0,0.15); }
.spinner { border: 3px solid #f1f5f9; border-top-color: var(--azul-med); border-radius: 50%; width: 32px; height: 32px; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 9999; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
