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

:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background-color: #0f172a !important; /* Mismo color del header para el notch/Dynamic Island de iOS PWA */
}

body {
  min-height: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  background-color: #f1f5f9;
}

/* Safe Area Inset Support for Notch Phones (iPhone X/11/12/13/14/15/16, Androids) */
.safe-top {
  padding-top: max(10px, env(safe-area-inset-top));
}
.safe-bottom {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.safe-paddings {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Animations */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

.pulse-alert {
  animation: pulseGlow 2s infinite;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.22s ease-out forwards;
}

.animate-slide-up {
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Interactive Cards */
.interactive-card {
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.interactive-card:active {
  transform: scale(0.985);
}
@media (min-width: 640px) {
  .interactive-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  }
}

/* Modal Backdrops */
.modal-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Fullscreen on Mobile Phones */
@media (max-width: 639px) {
  .modal-mobile-fullscreen {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
}

/* Touch-friendly Minimum Tap Target */
.touch-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 639px) {
  .touch-target {
    min-height: 40px;
  }
}

/* Centrado y alineación perfecta de iconos Lucide y SVGs */
svg.lucide, [data-lucide] {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Alineación consistente en botones y pestañas */
.tab-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* Centrado exacto de pastillas, badges e insignias numéricas */
.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

/* Turnos de Horario: Selector rápido e interacción */
.shift-select-cell {
  transition: all 0.15s ease;
}
.shift-select-cell:hover {
  background-color: #f8fafc;
}

/* Estilos de Impresión Limpia (Para el tablón de la tienda) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  header, #btnBackToHub, #offlineBanner, .no-print, #toast, #detailModal, #historyModal, #employeeModal, #whatsappModal {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  #viewHub, #viewFaro, #viewTasks {
    display: none !important;
  }
  #viewSchedules {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .schedule-table-container {
    box-shadow: none !important;
    border: 1px solid #94a3b8 !important;
    border-radius: 0 !important;
  }
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  th, td {
    border: 1px solid #cbd5e1 !important;
    padding: 6px !important;
  }
  thead {
    background-color: #0f172a !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* ========================================================================= */
/* CONTROL ESTRICTO DE PÁGINAS Y VISTAS INDEPENDIENTES                       */
/* ========================================================================= */
.hidden,
[hidden],
#viewHub.hidden,
#viewFaro.hidden,
#viewSchedules.hidden,
#viewTasks.hidden {
  display: none !important;
}

#viewHub:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

#viewFaro:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 1rem !important;
}

#viewSchedules:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 1rem !important;
}

#viewTasks:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  gap: 1rem !important;
}

/* Encabezado Hero: Título proporcional en la parte superior y buena separación */
.hub-header-hero {
  text-align: center;
  width: 100%;
  margin-top: 0.75rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .hub-header-hero {
    margin-top: 1.25rem;
    margin-bottom: 3.5rem;
  }
}

@media (min-width: 1024px) {
  .hub-header-hero {
    margin-top: 1.5rem;
    margin-bottom: 4.25rem; /* ~68px de separación elegante con el buscador */
  }
}

.hub-hero-title {
  font-size: 1.85rem;
  line-height: 1.15;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (min-width: 640px) {
  .hub-hero-title {
    font-size: 2.25rem;
    line-height: 1.12;
  }
}

@media (min-width: 1024px) {
  .hub-hero-title {
    font-size: 2.75rem; /* ~44px */
    line-height: 1.1;
  }
}

@media (min-width: 1280px) {
  .hub-hero-title {
    font-size: 3.15rem; /* ~50px */
    line-height: 1.08;
  }
}

.hub-hero-subtitle {
  font-size: 1rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 0.85rem;
  margin-bottom: 0;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

@media (min-width: 640px) {
  .hub-hero-subtitle {
    font-size: 1.15rem;
    margin-top: 1.15rem;
  }
}

.hub-3col-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

@media (min-width: 1024px) {
  .hub-3col-layout {
    display: grid !important;
    grid-template-columns: 280px minmax(0, 1fr) 350px !important;
    gap: 2rem !important;
    align-items: start !important;
  }
}

@media (min-width: 1280px) {
  .hub-3col-layout {
    grid-template-columns: 300px minmax(0, 1fr) 380px !important;
    gap: 2.5rem !important;
  }
}

@media (min-width: 1536px) {
  .hub-3col-layout {
    grid-template-columns: 320px minmax(0, 1fr) 410px !important;
    gap: 3rem !important;
  }
}

.hub-col-left {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  width: 100%;
}

.hub-col-center {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 490px;
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
}

.hub-col-right {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  width: 100%;
}

.hub-center-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.04);
}

.hub-stat-card {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 0.85rem 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.hub-stat-card:hover {
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 8px 22px -4px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.hub-nav-button {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 0.95rem 1.2rem;
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  user-select: none;
}

.hub-nav-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px -4px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.hub-nav-button:active {
  transform: scale(0.985);
}

.hub-nav-button-disabled {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 0.95rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: not-allowed;
  user-select: none;
  opacity: 0.75;
}

.hub-widget-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.35rem 1.5rem;
  box-shadow: 0 4px 18px -3px rgba(15, 23, 42, 0.05);
}

.hub-watermark {
  opacity: 0.22;
  transition: opacity 0.3s ease;
  user-select: none;
  pointer-events: none;
}

/* Compatibilidad con vistas previas si se reutilizan clases */
.hub-illustration-box {
  width: 100%;
  height: 180px;
  border-radius: 0.85rem;
  overflow: hidden;
  position: relative;
  user-select: none;
  border: 1px solid rgba(203, 213, 225, 0.8);
}

/* ========================================================================= */
/* ESTILOS DE HORARIOS SEVEN SEVEN (Sev333)                                 */
/* ========================================================================= */
.shift-selector {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 0.6rem;
  padding: 0.4rem 0.35rem;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #1e293b;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  outline: none;
  max-width: 130px;
}

.shift-selector:hover {
  border-color: #94a3b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shift-selector:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.shift-selector optgroup {
  font-weight: 800;
  color: #0f172a;
  background-color: #f8fafc;
  padding: 4px 2px;
}

.shift-selector option {
  font-weight: 600;
  color: #334155;
  background-color: #ffffff;
  padding: 3px 6px;
}

/* Insignias de reducción y horas */
.badge-reduction-ok {
  background-color: #ccfbf1;
  color: #0f766e;
  border: 1px solid #5eead4;
}

.badge-reduction-pending {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}
