/* ==== Variables de marca y Bootstrap overrides ==== */
:root {
  --sf-blue: #6AC2BD;
  --sf-green: #063f81;
  --sf-light: #f0f0f0;
  --sf-dark: #2E3A46;
  --sf-orange: #FF8C42;

  --bs-body-bg: #fafbfc;
  --bs-body-color: var(--sf-dark);
  --bs-primary: var(--sf-blue);
  --bs-secondary: var(--sf-green);
  --bs-light: var(--sf-light);
  --bs-dark: var(--sf-dark);
}

/* ==== Base ==== */
body {
  font-family: 'Inter', sans-serif;
  color: var(--sf-dark);
  background: linear-gradient(135deg, #fafbfc 0%, #f0f4f8 100%);
  line-height: 1.6;
}

/* ==== Animaciones ==== */
@keyframes fadeInUp { from {opacity:0;transform:translateY(30px);} to {opacity:1;transform:translateY(0);} }
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-10px);} }
@keyframes shimmer { 0%{background-position:-1000px 0;} 100%{background-position:1000px 0;} }

/* ==== Navbar ==== */
.navbar {
  background: rgba(255, 255, 255, 0.9) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(106, 194, 189, 0.1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.navbar .nav-link { color: var(--sf-dark)!important; font-weight:500; padding:0.5rem 1rem!important; }
.navbar .nav-link:hover { color: var(--sf-blue)!important; }

/* ==== Cards genéricas ==== */
.card {
  border: none;
  border-radius: 1.25rem;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}
.card:hover { transform: translateY(-6px); box-shadow: 0 12px 36px rgba(0,0,0,0.1); }

/* ==== Formularios ==== */
.form-control,.form-select {
  border:2px solid #e9ecef;
  border-radius:0.75rem;
  padding:0.65rem 1rem;
  background:#fff;
}
.form-control:focus,.form-select:focus {
  border-color:var(--sf-blue);
  box-shadow:0 0 0 4px rgba(106,194,189,0.1);
}

/* ==== Tablas ==== */
.table-responsive {border-radius:1rem;overflow:hidden;box-shadow:0 4px 16px rgba(0,0,0,0.06);}
.table-light th {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
  color: var(--sf-dark) !important;
}

/* ==== Imagenes en tabla ==== */
.img-thumbnail {
  border:3px solid var(--sf-blue);
  border-radius:0.75rem;
  padding:0.25rem;
  background:#fff;
  transition:all 0.3s ease;
}
.img-thumbnail:hover {
  transform:scale(1.1);
  border-color:var(--sf-orange);
  box-shadow:0 6px 20px rgba(106,194,189,0.3);
}

/* ==== Badges ==== */
.badge { padding:0.5rem 1rem; border-radius:2rem; font-weight:600; font-size:0.8rem; }
.text-bg-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  box-shadow: 0 2px 8px rgba(40,167,69,0.3);
}
.text-bg-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
}

/* ==== Paginación ==== */
.pagination { gap:0.5rem; }
.page-item .page-link {
  border:none; border-radius:0.75rem; padding:0.65rem 1.25rem;
  color:var(--sf-green); font-weight:600; background:#fff;
  box-shadow:0 2px 8px rgba(0,0,0,0.08);
  transition:all 0.3s ease;
}
.page-item .page-link:hover {
  background:linear-gradient(135deg,var(--sf-blue) 0%,var(--sf-green) 100%);
  color:#fff; transform:translateY(-2px);
}

/* ==== Footer ==== */
footer {
  background: linear-gradient(135deg, var(--sf-dark) 0%, #1a2530 100%);
  color: rgba(255,255,255,0.8);
  padding:1.5rem 0;
  box-shadow:0 -4px 24px rgba(0,0,0,0.1);
}

/* ==== Scroll ==== */
::-webkit-scrollbar {width:10px;}
::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--sf-blue) 0%, var(--sf-green) 100%);
  border-radius:5px;
}

/* ==== GRADIENTES DE ESTADÍSTICAS ARREGLADOS ==== */
.stat-card {
  color: #ffffff !important;
  border: none;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}
.stat-card .card-body {
  background: transparent !important;
  color: #ffffff !important;
}
.stat-card .stat-icon {
  display:flex;
  align-items:center;
  justify-content:center;
  width:60px;
  height:60px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
}
.stat-card .stat-icon i { color:#fff !important; opacity:0.95; }
.stat-card p {
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  margin-bottom: .4rem;
}
.stat-card h3 {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  filter: brightness(1.05);
}

/* Gradientes actualizados (más vivos y con contraste) */
.bg-gradient-blue {
  background: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%) !important;
}
.bg-gradient-green {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%) !important;
}
.bg-gradient-orange {
  background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%) !important;
}
.bg-gradient-purple {
  background: linear-gradient(135deg, #9d50bb 0%, #6e48aa 100%) !important;
}

/* ==== Smart Fenix - Versión mejorada de las cards de estadísticas ==== */
.stat-card {
  border: none;
  border-radius: 1.25rem;
  color: #fff !important;
  overflow: hidden;
  position: relative;
  padding: 1.5rem 1.25rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  background-size: 200% 200%;
  animation: gradientFlow 10s ease infinite;
}
@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.stat-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  filter: brightness(1.08);
}
.stat-card .card-body {
  background: transparent !important;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card .stat-icon {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(3px);
}
.stat-card .stat-icon i {
  font-size: 2rem;
  color: #fff;
}
.stat-card p {
  margin-bottom: 0.35rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.9;
}
.stat-card h3 {
  font-weight: 700;
  font-size: 1.8rem;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
/* === Gradientes Smart Fenix === */
.bg-gradient-blue { background: linear-gradient(135deg, #0ABFBC 0%, #00A8C5 100%) !important; }
.bg-gradient-green { background: linear-gradient(135deg, #38EF7D 0%, #11998E 100%) !important; }
.bg-gradient-orange { background: linear-gradient(135deg, #F7971E 0%, #FFD200 100%) !important; }
.bg-gradient-purple { background: linear-gradient(135deg, #A770EF 0%, #FDB99B 100%) !important; }

/* === Panel deslizante (si lo usas) === */
.drawer-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--sf-blue);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(106, 194, 189, 0.3);
  z-index: 1050;
  transition: all 0.3s ease;
}
.drawer-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(106, 194, 189, 0.4);
}
.drawer-toggle .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--sf-orange);
  border: 2px solid white;
}
.drawer {
  position: fixed;
  bottom: 0;
  right: -400px;
  width: 400px;
  height: 80vh;
  background: white;
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: -5px 0 25px rgba(0,0,0,0.1);
  z-index: 1040;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { right: 0; }
.drawer-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  background: linear-gradient(135deg, #fafbfc 0%, #f0f4f8 100%);
  border-radius: 1.25rem 1.25rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-content { flex: 1; overflow-y: auto; padding: 1rem; }
.drawer-item {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.3s ease;
}
.drawer-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.drawer-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

/* === Modal personalizado === */
.modal-content {
  border: none;
  border-radius: 1.25rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
  border-bottom: 1px solid rgba(0,0,0,0.1);
  background: linear-gradient(135deg, #fafbfc 0%, #f0f4f8 100%);
  border-radius: 1.25rem 1.25rem 0 0;
  padding: 1rem 1.5rem;
}
.modal-body { padding: 1.5rem; }

/* Estilo para las filas de la tabla */
.preview-row {
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.preview-row:hover {
  background-color: rgba(106, 194, 189, 0.1);
}

/* Imagen en el modal */
#modalImage {
  width: 100%;
  border-radius: 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}
#modalImage:hover { transform: scale(1.02); }

/* Estilos de mensajes/cards */
.detection-card {
  position: fixed;
  right: 20px;
  max-width: 300px;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  z-index: 1040;
  cursor: pointer;
  animation: slideIn 0.3s ease forwards;
}
.detection-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}
.detection-card .card-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 1rem 1rem 0 0;
}
.detection-card .card-body { padding: 1rem; }
.detection-card .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.detection-card .close-btn:hover { background: rgba(0,0,0,0.7); }

/* Tooltip vista previa */
.preview-tooltip {
  position: absolute;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 1rem;
  z-index: 1030;
  max-width: 300px;
  display: none;
  pointer-events: none;
  animation: fadeIn 0.2s ease forwards;
}
.preview-tooltip img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Definiciones de términos en el modal */
.modal-body dt { color: var(--sf-dark); font-weight: 600; }
.modal-body dd { color: var(--sf-blue); margin-bottom: 0.75rem; }

/* ===================== */
/*   NUEVOS ESTILOS SF   */
/* ===================== */

/* Botones toggle coherentes con la marca */
.btn-toggle-sf {
  background: linear-gradient(135deg, var(--sf-blue) 0%, var(--sf-green) 100%);
  color: #fff;
  border: none;
  border-radius: 0.9rem;
  padding: 0.6rem 1rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-toggle-sf:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-toggle-sf:active { transform: translateY(0); }

/* Contenedor visual para colapsables */
.collapse-container {
  border-radius: 1rem;
  overflow: hidden;
}

/* Controles del modal de gráfico */
#chartControls .btn-range {
  font-weight: 600;
  border-radius: 0.7rem;
}
#chartControls .btn-range:focus { outline: none; }
#chartContainer {
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Mejoras responsivas tabla */
@media (max-width: 576px) {
  .table-responsive { box-shadow: none; border-radius: 0.5rem; }
  .stat-card h3 { font-size: 1.4rem; }
}
