/* ==============================
   ALFA-LAC - Manual de Identidad
   Variables y Configuración Base
============================== */

/* Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Paleta Cromática ALFA-LAC */
  --lfa-azul-claro: #D2E8FF;
  --lfa-crema: #F7F3EA;
  --lfa-azul-principal: #5886E8;
  --lfa-azul-hover: #4672d4;
  --lfa-azul-oscuro: #0a1955;
  
  /* Colores de texto */
  --texto-oscuro: #1f1f1f;
  --texto-gris: #6c757d;
  --texto-sobre-azul: #ffffff;
  
  /* Otros */
  --borde-suave: #e5e5e5;
  --blanco: #ffffff;
  --sombra-suave: 0 4px 20px rgba(88, 134, 232, 0.15);
  --sombra-card: 0 2px 12px rgba(0, 0, 0, 0.08);
  
  /* Transiciones */
  --transicion: all 0.3s ease;
}

/* ==============================
   BASE
============================== */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  background: var(--lfa-crema);
  color: var(--texto-oscuro);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==============================
   TIPOGRAFÍA
============================== */

/* Títulos - Poppins ExtraBold */
h1, h2, h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  color: var(--lfa-azul-oscuro);
  letter-spacing: -0.5px;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

/* Subtítulos - Poppins Medium */
h4, h5, h6 {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  color: var(--lfa-azul-oscuro);
}

/* Textos destacados */
.text-destacado {
  font-weight: 500;
}

/* Textos normales - Poppins Light */
p, span, li, td, th, label {
  font-weight: 300;
}

/* ==============================
   HEADER / NAVBAR
============================== */
.navbar {
  background-color: var(--lfa-crema) !important;
  padding: 0.8rem 2rem;
  border-bottom: none;
  margin-bottom: 0 !important;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--lfa-azul-oscuro) !important;
  text-decoration: none;
  transition: var(--transicion);
}

.navbar-brand:hover {
  opacity: 0.85;
}

.navbar-brand img {
  height: 45px;
  width: auto;
}

.navbar-brand-text {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--lfa-azul-principal);
  letter-spacing: -0.5px;
}

.navbar-underline {
  position: sticky;
  top: 60px;
  z-index: 1029;
  height: 4px;
  background: linear-gradient(90deg, var(--lfa-azul-principal) 0%, var(--lfa-azul-claro) 100%);
  width: 100%;
}

.nav-link {
  color: var(--lfa-azul-oscuro) !important;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem !important;
  border-radius: 6px;
  transition: var(--transicion);
  position: relative;
}

.nav-link:hover {
  color: var(--lfa-azul-principal) !important;
  background-color: var(--lfa-azul-claro);
}

.nav-link.active {
  color: var(--lfa-azul-principal) !important;
  background-color: var(--lfa-azul-claro);
}

.navbar-toggler {
  border-color: var(--lfa-azul-principal);
  padding: 0.4rem 0.6rem;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%235886E8' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ==============================
   CONTENEDORES
============================== */
.container {
  max-width: 480px;
  background-color: var(--blanco);
  padding: 2.5rem 2rem;
  border-radius: 16px;
  box-shadow: var(--sombra-card);
  border: 1px solid var(--borde-suave);
}

.custom-width-container {
  max-width: 900px;
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

/* Contenedor de página con fondo decorativo */
.page-wrapper {
  min-height: calc(100vh - 70px);
  padding: 2rem 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(88, 134, 232, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(210, 232, 255, 0.5) 0%, transparent 50%),
    var(--lfa-crema);
}

/* Hero section */
.hero-section {
  background: linear-gradient(135deg, var(--lfa-azul-principal) 0%, #3d6fd1 100%);
  color: var(--blanco);
  padding: 3rem 2rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: var(--sombra-suave);
}

.hero-section h1,
.hero-section h2 {
  color: var(--blanco);
}

/* ==============================
   CARDS
============================== */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--sombra-card);
  transition: var(--transicion);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sombra-suave);
}

.card-header {
  background-color: var(--lfa-azul-principal);
  color: var(--blanco);
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-bottom: none;
}

.card-body {
  padding: 1.5rem;
}

.card-body h5 {
  color: var(--lfa-azul-oscuro);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ==============================
   FORMULARIOS
============================== */
.form-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--lfa-azul-oscuro);
  margin-bottom: 0.5rem;
}

.form-control {
  border-radius: 8px;
  border: 2px solid var(--borde-suave);
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-weight: 300;
  transition: var(--transicion);
  background-color: var(--blanco);
}

.form-control:focus {
  border-color: var(--lfa-azul-principal);
  box-shadow: 0 0 0 3px rgba(88, 134, 232, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: #adb5bd;
  font-weight: 300;
}

/* ==============================
   BOTONES
============================== */
.btn {
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  transition: var(--transicion);
  border: 2px solid transparent;
}

/* Botón principal */
.btn-primary {
  background-color: var(--lfa-azul-principal);
  border-color: var(--lfa-azul-principal);
  color: var(--blanco);
}

.btn-primary:hover {
  background-color: var(--lfa-azul-hover);
  border-color: var(--lfa-azul-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 134, 232, 0.4);
}

/* Botón secundario */
.btn-secondary {
  background-color: var(--lfa-crema);
  border-color: var(--lfa-azul-principal);
  color: var(--lfa-azul-principal);
}

.btn-secondary:hover {
  background-color: var(--lfa-azul-claro);
  border-color: var(--lfa-azul-principal);
  color: var(--lfa-azul-oscuro);
}

/* Botón outline */
.btn-outline-primary {
  background-color: transparent;
  border-color: var(--lfa-azul-principal);
  color: var(--lfa-azul-principal);
}

.btn-outline-primary:hover {
  background-color: var(--lfa-azul-principal);
  color: var(--blanco);
}

/* Botón success */
.btn-success {
  background-color: #28a745;
  border-color: #28a745;
}

.btn-success:hover {
  background-color: #218838;
  border-color: #218838;
  transform: translateY(-2px);
}

/* Botón danger */
.btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover {
  background-color: #c82333;
  transform: translateY(-2px);
}

/* Botón warning */
.btn-warning {
  background-color: #ffc107;
  border-color: #ffc107;
  color: var(--texto-oscuro);
}

.btn-warning:hover {
  background-color: #e0a800;
  transform: translateY(-2px);
}

/* Botón like */
.btn-outline-danger {
  border-color: #dc3545;
  color: #dc3545;
  background: transparent;
}

.btn-outline-danger:hover {
  background-color: #dc3545;
  color: var(--blanco);
}

/* Anchos de botón */
.btn-block {
  width: 100%;
}

/* ==============================
   ALERTAS
============================== */
.alert {
  max-width: 480px;
  margin: 0 auto 1.5rem auto;
  font-size: 0.9rem;
  border-radius: 10px;
  border: none;
  font-weight: 400;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
}

.alert-info {
  background-color: var(--lfa-azul-claro);
  color: var(--lfa-azul-oscuro);
}

/* ==============================
   TABLAS
============================== */
.table {
  font-weight: 300;
  border-radius: 12px;
  overflow: hidden;
}

.table thead th {
  background-color: var(--lfa-azul-principal);
  color: var(--blanco);
  font-weight: 600;
  border: none;
  padding: 1rem;
}

.table tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-color: var(--borde-suave);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(210, 232, 255, 0.3);
}

.table-hover tbody tr:hover {
  background-color: var(--lfa-azul-claro);
}

.table-container {
  max-height: 500px;
  overflow-y: auto;
  overflow-x: auto;
  max-width: 95%;
  margin-left: auto;
  margin-right: auto;
  border-radius: 12px;
  box-shadow: var(--sombra-card);
  background: var(--blanco);
}

.table-container table {
  min-width: 1800px;
  margin-bottom: 0;
}

.table-container th {
  position: sticky;
  top: 0;
  background: var(--lfa-azul-principal) !important;
  z-index: 2;
}

/* ==============================
   BUSCADOR
============================== */
#searchInput {
  max-width: 95%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  border-radius: 50px;
  padding: 0.8rem 1.5rem;
  border: 2px solid var(--lfa-azul-principal);
  font-size: 1rem;
}

#searchInput:focus {
  box-shadow: 0 0 0 4px rgba(88, 134, 232, 0.2);
}

/* ==============================
   COMENTARIOS
============================== */
.comments-list {
  max-height: 350px;
  overflow-y: auto;
  border: 1px solid var(--borde-suave);
  padding: 1rem;
  background-color: var(--blanco);
  border-radius: 12px;
}

.comment {
  padding: 1rem;
  border-bottom: 1px solid var(--borde-suave);
  background: var(--lfa-crema);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.comment:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.comment-author {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--lfa-azul-oscuro);
}

.comment-text {
  font-size: 0.9rem;
  margin: 0.4rem 0;
  font-weight: 300;
}

.comment-date {
  font-size: 0.75rem;
  color: var(--texto-gris);
}

.comments-list::-webkit-scrollbar {
  width: 6px;
}

.comments-list::-webkit-scrollbar-thumb {
  background-color: var(--lfa-azul-principal);
  border-radius: 4px;
}

.comments-list::-webkit-scrollbar-track {
  background-color: var(--lfa-azul-claro);
}

/* ==============================
   LINKS
============================== */
a {
  color: var(--lfa-azul-principal);
  text-decoration: none;
  transition: var(--transicion);
}

a:hover {
  color: var(--lfa-azul-hover);
  text-decoration: underline;
}

/* ==============================
   TÍTULO DE PÁGINA
============================== */
.page-title {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.page-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--lfa-azul-principal), var(--lfa-azul-claro));
  margin: 0.75rem auto 0;
  border-radius: 2px;
}

/* ==============================
   SCROLL GENERAL
============================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--lfa-crema);
}

::-webkit-scrollbar-thumb {
  background: var(--lfa-azul-principal);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--lfa-azul-hover);
}

/* ==============================
   UTILIDADES
============================== */
.bg-lfa-azul {
  background-color: var(--lfa-azul-principal) !important;
}

.bg-lfa-claro {
  background-color: var(--lfa-azul-claro) !important;
}

.bg-lfa-crema {
  background-color: var(--lfa-crema) !important;
}

.text-lfa-azul {
  color: var(--lfa-azul-principal) !important;
}

.text-lfa-oscuro {
  color: var(--lfa-azul-oscuro) !important;
}

/* ==============================
   FOOTER
============================== */
.footer {
  background-color: var(--lfa-azul-oscuro);
  color: var(--blanco);
  padding: 2rem;
  margin-top: auto;
}

.footer a {
  color: var(--lfa-azul-claro);
}

.footer a:hover {
  color: var(--blanco);
}

/* ==============================
   ANIMACIONES
============================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* ==============================
   RESPONSIVE
============================== */

/* Fix: menú mobile como overlay para evitar temblor de contenido */
@media (max-width: 991.98px) {
  .navbar .container-fluid {
    position: relative;
  }

  .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--lfa-crema);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 12px 12px;
    padding: 0.5rem 1rem 1rem;
    z-index: 1050;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .navbar {
    padding: 0.6rem 1rem;
  }
  
  .container {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .custom-width-container {
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .table-container {
    max-width: 100%;
    border-radius: 8px;
  }
  
  #searchInput {
    max-width: 100%;
    margin: 0 1rem 1rem 1rem;
  }
}

/* ==============================
   VALIDACIÓN DE FORMULARIOS
============================== */
.is-invalid {
  border-color: #dc3545 !important;
}

.is-valid {
  border-color: #28a745 !important;
}

.invalid-feedback {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.25rem;
  font-weight: 400;
}

/* ==============================
   BADGE / ETIQUETAS
============================== */
.badge {
  font-weight: 500;
  padding: 0.4em 0.8em;
  border-radius: 6px;
}

.badge.bg-primary {
  background-color: var(--lfa-azul-principal) !important;
}

/* ==============================
   QR CODE
============================== */
.qr-container {
  text-align: center;
  padding: 2rem;
  background: var(--blanco);
  border-radius: 16px;
  box-shadow: var(--sombra-card);
}

.qr-container img {
  max-width: 200px;
  border-radius: 8px;
}

img.qr-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
}

/* ==============================
   ADMIN PANEL
============================== */
.scroll-table {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 8px;
}

/* Admin cards override */
.card-header.bg-primary {
  background-color: var(--lfa-azul-principal) !important;
}

.card-header.bg-secondary {
  background-color: var(--lfa-azul-oscuro) !important;
}

/* ==============================
   SISTEMA DE NOTIFICACIONES TOAST
============================== */

/* Contenedor de toasts */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - 40px);
}

/* Toast individual */
.toast-notification {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: var(--blanco);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  pointer-events: all;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--lfa-azul-principal);
}

.toast-notification.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-notification.removing {
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.3s ease-in;
}

/* Icono del toast */
.toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
}

/* Contenido */
.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-message {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--texto-oscuro);
  line-height: 1.5;
  word-wrap: break-word;
}

/* Botón cerrar */
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--texto-gris);
  opacity: 0.6;
  transition: all 0.2s ease;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

/* Barra de progreso */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  animation: toast-progress linear forwards;
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* Tipos de toast */

/* Success */
.toast-success {
  border-left-color: #28a745;
}

.toast-success .toast-icon {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}

.toast-success .toast-progress-bar {
  background: linear-gradient(90deg, #28a745, #20c997);
}

/* Error */
.toast-error {
  border-left-color: #dc3545;
}

.toast-error .toast-icon {
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

.toast-error .toast-progress-bar {
  background: linear-gradient(90deg, #dc3545, #e74c3c);
}

/* Warning */
.toast-warning {
  border-left-color: #ffc107;
}

.toast-warning .toast-icon {
  background: rgba(255, 193, 7, 0.15);
  color: #d39e00;
}

.toast-warning .toast-progress-bar {
  background: linear-gradient(90deg, #ffc107, #fd7e14);
}

/* Info */
.toast-info {
  border-left-color: var(--lfa-azul-principal);
}

.toast-info .toast-icon {
  background: rgba(88, 134, 232, 0.12);
  color: var(--lfa-azul-principal);
}

.toast-info .toast-progress-bar {
  background: linear-gradient(90deg, var(--lfa-azul-principal), var(--lfa-azul-claro));
}

/* ==============================
   DIÁLOGO DE CONFIRMACIÓN
============================== */

.confirm-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 25, 85, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.confirm-dialog-overlay.show {
  opacity: 1;
  visibility: visible;
}

.confirm-dialog {
  background: var(--blanco);
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.confirm-dialog-overlay.show .confirm-dialog {
  transform: scale(1) translateY(0);
}

.confirm-dialog-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: pulse-icon 2s infinite;
}

@keyframes pulse-icon {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.confirm-dialog-title {
  font-weight: 700;
  color: var(--lfa-azul-oscuro);
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.confirm-dialog-message {
  color: var(--texto-gris);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.confirm-dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-dialog-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
  border: 2px solid transparent;
}

.confirm-dialog-btn.cancel {
  background: var(--lfa-crema);
  color: var(--texto-oscuro);
  border-color: var(--borde-suave);
}

.confirm-dialog-btn.cancel:hover {
  background: var(--borde-suave);
}

.confirm-dialog-btn.confirm {
  background: var(--lfa-azul-principal);
  color: var(--blanco);
}

.confirm-dialog-btn.confirm:hover {
  background: var(--lfa-azul-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 134, 232, 0.4);
}

.confirm-dialog-btn.confirm.danger {
  background: #dc3545;
}

.confirm-dialog-btn.confirm.danger:hover {
  background: #c82333;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Responsive para toasts */
@media (max-width: 576px) {
  #toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
  }
  
  .toast-notification {
    padding: 14px 16px;
  }
  
  .confirm-dialog {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .confirm-dialog-buttons {
    flex-direction: column;
  }
  
  .confirm-dialog-btn {
    width: 100%;
  }
}