/* ========== BASE ========== */
html {
  overflow-y: scroll;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: 16rem; /* w-64 */
  min-height: 100%; /* Ocupa todo el alto disponible */
  transition: width 0.3s ease;
  padding-top: 24px; /* separa del navbar */
  padding-bottom: 16px; /* espacio inferior opcional */
  overflow-x: hidden; /* evita scroll horizontal */
}

.sidebar.collapsed {
  width: 5rem;
}

/* Ajuste de los links cuando se colapsa */
.sidebar.collapsed .module-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* Ocultar textos y títulos en colapsado */
/* Transiciones suaves para textos y títulos del sidebar */
.sidebar-text,
.sidebar-title {
  transition: opacity 0.3s, width 0.3s, padding 0.3s;
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .sidebar-title {
  opacity: 0;
  width: 0;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow: hidden;
  white-space: nowrap;
}

#sidebar.w-16 .sidebar-text {
  display: none;
}

/* Íconos siempre visibles */
.module-link i {
  font-size: 1.2rem;
  min-width: 1.5rem;
  text-align: center;
}

.hidden {
  display: none;
}

/* ========== CONTENIDO PRINCIPAL ========== */
.content-area {
  flex: 1; /* el contenido ocupa todo el espacio restante */
  transition: all 0.3s ease;
  min-width: 0; /* evita que el contenido se desplace al colapsar */
}

/* ========== FOOTER ========== */
footer {
  margin-top: 0; /* Pegado al contenido/sidebar */
}

/* ========== MAPA ========== */
.map-container {
  height: 400px;
}

/* ========== NOTIFICACIONES Y ESTADOS ========== */
.notification-badge {
  top: 0.25rem;
  right: 0.25rem;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

.priority-high {
  @apply bg-red-100 text-red-800 border-red-300;
}

.priority-medium {
  @apply bg-yellow-100 text-yellow-800 border-yellow-300;
}

.priority-low {
  @apply bg-green-100 text-green-800 border-green-300;
}

.status-pending {
  @apply bg-gray-100 text-gray-800 border-gray-300;
}

.status-in-progress {
  @apply bg-blue-100 text-blue-800 border-blue-300;
}

.status-completed {
  @apply bg-emerald-100 text-emerald-800 border-emerald-300;
}

/* ========== TOAST NOTIFICATIONS ========== */
#toast-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
  color: white;
  font-size: 0.875rem;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease-in-out;
}

.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast-exito {
  background: #22c55e; /* Verde Tailwind */
}

.toast-error {
  background: #ef4444; /* Rojo Tailwind */
}

.toast-info {
  background: #3b82f6; /* Azul Tailwind */
}

.toast-icon {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
}

/* Tema oscuro opcional */
@media (prefers-color-scheme: dark) {
  .toast-exito {
    background: #16a34a;
  }
  .toast-error {
    background: #dc2626;
  }
  .toast-info {
    background: #2563eb;
  }
}

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 40;
  display: none;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  z-index: 50;
  display: none;
  width: 90%;
  max-width: 600px;
}

.modal.active,
.modal-backdrop.active {
  display: block;
}

/* ========== CALENDARIO ========== */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

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

.calendar-day {
  border: 1px solid #e2e8f0;
  min-height: 80px;
  padding: 4px;
}

.calendar-day-header {
  text-align: center;
  padding: 8px 0;
  font-weight: bold;
}

.calendar-event {
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-bottom: 2px;
  cursor: pointer;
}

/* ========== SPINNER DE CARGA ========== */
.spinner {
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-left-color: #3498db;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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