/* =============================================================
   Wisender Food - Hoja de Estilos Unificada v2 (2026-03-04)
   Consolida: style.css + style_fix_tabla.css + style_fix_tabla_zindex.css
   Compatible con Tailwind CDN
   ============================================================= */

/* ---------- Variables de Diseño ---------- */
:root {
  --bg0: #020617;
  --bg1: #0b1221;
  --card: rgba(15, 23, 42, 0.65);
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --texto: #e2e8f0;
  --apagado: #94a3b8;
  --primario: #6366f1;
  --primario-2: #818cf8;
  --peligro: #ef4444;
  --exito: #22c55e;
  --sombra: 0 24px 70px rgba(0, 0, 0, 0.55);
  --radio: 26px;
  --radio-sm: 16px;
  --offset-topbar: 74px;
}

/* ---------- Base ---------- */
html, body { height: 100%; }

body {
  color: var(--texto);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Fondo degradado consistente en todas las páginas */
.app-bg {
  background:
    radial-gradient(1100px circle at 18% 8%,  rgba(99, 102, 241, 0.20), transparent 55%),
    radial-gradient(900px  circle at 85% 0%,  rgba(34, 197, 94,  0.12), transparent 52%),
    radial-gradient(700px  circle at 50% 110%, rgba(236, 72, 153, 0.07), transparent 55%),
    linear-gradient(180deg, var(--bg0), #000 140%) !important;
}

/* ---------- Barra de Navegación Superior ---------- */
.app-topbar {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(2, 6, 23, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.app-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 64px;
  gap: 1rem;
}

/* Logo / Marca */
.app-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;
}

.app-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-brand-name {
  font-size: 0.875rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Título central */
.app-topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.app-page-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--apagado);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Acciones del topbar */
.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Botones del topbar */
.app-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--apagado);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.app-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-color: var(--border-2);
}

.app-btn-primary {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.25);
}

.app-btn-primary:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
}

/* Pastilla de usuario */
.app-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Cards con Efecto Cristal ---------- */
.glass-card {
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- Inputs y Formularios ---------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
textarea,
select {
  background: rgba(15, 23, 42, 0.7) !important;
  color: #e2e8f0 !important;
}

input::placeholder,
textarea::placeholder {
  color: #475569 !important;
}

/* Checkbox personalizado */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 6px;
  border: 2px solid rgba(99, 102, 241, 0.4);
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.custom-checkbox:checked {
  background: var(--primario);
  border-color: var(--primario);
}

.custom-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.custom-checkbox:hover {
  border-color: var(--primario-2);
}

/* ---------- Modales ---------- */
.modal-blur {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Mostrar modal */
.modal-blur[style*="flex"] {
  display: flex !important;
}

/* ---------- Tablas Mejoradas con Cabecera Fija ---------- */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  position: relative;
}

/* Fijar cabecera sin que se superponga al tbody */
.table-wrap table {
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #0b1221;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Evita que tbody se dibuje encima del thead */
.table-wrap tbody {
  position: relative;
  z-index: 10;
}

/* Select de estado en la tabla */
.status-select {
  padding: 0.375rem 0.75rem;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.08);
  color: #818cf8;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-select:hover, .status-select:focus {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.15);
}

/* ---------- Barra de Desplazamiento Personalizada ---------- */
.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 999px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

/* ---------- Animaciones ---------- */
@keyframes aparecer {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animar-entrada {
  animation: aparecer 0.25s ease forwards;
}

/* ---------- Badges de Estado ---------- */
.badge-estado {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-nuevo       { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }
.badge-seguimiento { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.badge-aceptada    { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.badge-no-int      { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.badge-horario     { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.badge-cita        { background: rgba(168,85,247,0.15); color: #c084fc; border: 1px solid rgba(168,85,247,0.25); }

/* ---------- Tarjetas de KPI ---------- */
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  padding: 1.5rem 2rem;
  transition: border-color 0.2s ease;
}

.kpi-card:hover {
  border-color: var(--border-2);
}

/* ---------- Kanban ---------- */
.kanban-col {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  min-width: 240px;
  flex: 1;
}

.kanban-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  transition: all 0.15s ease;
  cursor: pointer;
}

.kanban-card:hover {
  border-color: var(--primario);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-1px);
}

/* ---------- Responsividad del Topbar ---------- */
@media (max-width: 640px) {
  .app-brand-name { display: none; }
  .app-user-pill  { display: none; }
  .app-page-title { max-width: 120px; font-size: 0.6rem; }
  .app-btn span   { display: none; }
}

/* ---------- Estados de Carga ---------- */
.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  border-top-color: #fff;
  animation: girar 0.6s linear infinite;
}

@keyframes girar {
  to { transform: rotate(360deg); }
}
