/* ============================================
   COMMON.CSS - ESTILOS COMUNES MEJORADOS
   ============================================ */
@import url('variables.css');
@import url('components.css');


/* RESET Y TIPOGRAF├ìA CONSISTENTE */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
li {
  margin: 0;
  padding: 0;
}

/* TIPOGRAF├ìA CONSISTENTE PARA TODAS LAS P├üGINAS */
body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  background: #f9fafb;
  color: #333;
}

/* ESTILOS CONSISTENTES PARA T├ìTULOS */
h1 {
  font-size: 1.8em;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 20px;
  text-align: center;
}

h2 {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 15px;
}

h3 {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 10px;
}

/* HEADER PRINCIPAL - Barra superior fija */
header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-inverse);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-sizing: border-box;
  height: 60px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* LOGO del header */
.header-img {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

/* CONTENEDOR DE NAVEGACI├ôN */
.navbar {
  display: flex;
  align-items: center;
}

/* BOT├ôN HAMBURGUESA - MEJORADO */
.menu-toggle {
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s ease;
  position: relative;
}

.menu-toggle:hover {
  transform: scale(1.1);
}

.menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Animaci├│n cuando el sidebar est├í abierto */
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* CONTENEDOR PRINCIPAL - Ajuste para header fijo */
main {
  padding-top: 80px;
  padding-left: 20px;
  padding-right: 20px;
  min-height: calc(100vh - 80px);
}

.permiso-denegado {
  display: none !important;
}

/* ============================================
   SIDEBAR - ESTILOS MODERNOS
   ============================================ */

/* Overlay del sidebar */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar moderno */
.sidebar {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1002;
  padding-top: 70px;
  overflow-y: auto;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
  right: 0;
}

/* Header del sidebar */
.sidebar-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-title {
  color: white;
  font-size: 1.2em;
  font-weight: 600;
}

/* Bot├│n cerrar sidebar */
.close-sidebar {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-sidebar:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

/* Navegaci├│n del sidebar */
.sidebar-nav {
  padding: 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  color: white;
  padding: 16px 20px;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 16px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.sidebar-nav a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: #4CAF50;
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.sidebar-nav a:hover::before,
.sidebar-nav a.active::before {
  transform: scaleY(1);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  padding-left: 24px;
}

.sidebar-nav a i {
  margin-right: 12px;
  font-size: 1.2em;
  width: 20px;
  text-align: center;
}

/* Secci├│n de logout en el sidebar */
.sidebar-logout {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 0;
}

.sidebar-logout a {
  color: #ff6b6b !important;
}

.sidebar-logout a:hover {
  background: rgba(255, 107, 107, 0.12) !important;
}

/* ============================================
   FOOTER UNIVERSAL
   ============================================ */
.footer {
  text-align: center;
  padding: 15px;
  background: var(--primary-color);
  color: white;
  margin-top: 40px;
  width: 100%;
  box-sizing: border-box;
}

.footer p {
  margin: 0;
}

.footer a {
  color: #a4e5bb;
  text-decoration: none;
  font-weight: bold;
  margin-left: 5px;
  transition: opacity 0.3s ease;
}

.footer a:hover {
  text-decoration: underline;
  opacity: 0.8;
}

/* ============================================
   POPUP DE ACCESO DENEGADO
   ============================================ */

.popup-acceso-denegado {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.popup-acceso-denegado .contenido {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.popup-acceso-denegado .icono {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.popup-acceso-denegado h3 {
  color: #d32f2f;
  margin-bottom: 1rem;
}

.popup-acceso-denegado p {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.btn-volver {
  background: #1976d2;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.btn-volver:hover {
  background: #1565c0;
}

/* ELIMINAR PUNTOS NEGROS en listas de navegación */
.navbar ul,
.nav-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ============================================
   SUBMENUS DEL SIDEBAR
   ============================================ */

.submenu-group {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.submenu-header {
  display: flex;
  align-items: center;
  color: white;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 15px;
}

.submenu-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.submenu-header i {
  margin-right: 12px;
  font-size: 1.2em;
  width: 20px;
  text-align: center;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.submenu-group.active .submenu-arrow {
  transform: rotate(180deg);
}

.submenu-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.1);
}

.submenu-group.active .submenu-items {
  max-height: 300px;
}

.submenu-items li {
  border-bottom: none;
}

.submenu-items a {
  padding-left: 48px !important;
  font-size: 14px;
  opacity: 0.9;
  border-left: 3px solid transparent;
}

.submenu-items a:hover {
  border-left-color: #4CAF50;
  opacity: 1;
}

.submenu-items i {
  font-size: 1.1em;
}

/* ESTILOS PARA HEADER PÚBLICO CON MENÚ HAMBURGUESA */
header.header {
  /* Asegurar que el header tenga los estilos del common.css */
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-inverse);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  height: 60px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Asegurar que el botón hamburguesa se vea bien en header público */
header.header .menu-toggle {
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.3s ease;
  position: relative;
  margin-right: 15px;
}

header.header .menu-toggle:hover {
  transform: scale(1.1);
}

header.header .menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Ajustar el logo en header público cuando tiene hamburguesa */
header.header .header-img {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

/* Info del usuario en header público */
#userInfo {
  margin-left: auto;
  margin-right: 15px;
}

#userInfo span {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
}


/* ============================================
   RESPONSIVE - TABLETS Y MÓVILES
   ============================================ */

@media (max-width: 1024px) {

  /* Tablet */
  .menu-toggle {
    display: flex !important;
  }

  /* Asegurar que el header sea responsive */
  header {
    padding: 10px 15px;
  }

  .header-img {
    height: 35px;
  }

  /* Ajustar main para tablets */
  main {
    padding-top: 70px;
    padding-left: 15px;
    padding-right: 15px;
  }
}

@media (max-width: 768px) {

  /* Móviles y tablets pequeñas */
  body {
    font-size: 13px;
  }

  h1 {
    font-size: 1.6em;
  }

  h2 {
    font-size: 1.3em;
  }

  header {
    height: 55px;
    padding: 8px 15px;
  }

  .header-img {
    height: 32px;
  }

  main {
    padding-top: 65px;
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Sidebar más ancho en móviles */
  .sidebar,
  .sidebar-principal {
    width: 280px;
  }
}

@media (max-width: 480px) {

  /* Móviles pequeños */
  .sidebar,
  .sidebar-principal {
    width: 100%;
    right: -100%;
  }

  .sidebar.active,
  .sidebar-principal.active {
    right: 0;
  }
}

/* Asegurar que el botón hamburguesa siempre sea visible en móviles */
@media (max-width: 1024px) {
  .menu-toggle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Ocultar otros elementos de navegación en móviles */
  .navbar-desktop {
    display: none !important;
  }
}


/************************************************************
   SIDEBAR UNIFICADO Y MODERNO (Cenuve)
 ************************************************************/

/* == OVERLAY == */
.sidebar-overlay {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  height: calc(100vh - 60px);
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  display: none;
  transition: opacity 0.3s ease;
  z-index: 1001;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* == SIDEBAR == */
.sidebar {
  position: fixed;
  top: 60px;
  right: -300px;
  width: 280px;
  height: calc(100vh - 60px);
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-inverse);
  padding-top: 60px;
  overflow-y: auto;
  z-index: 1002;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.35);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.active {
  right: 0;
}

/* == HEADER DEL SIDEBAR == */
.sidebar-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-title {
  font-size: 1.2em;
  font-weight: 600;
  color: white;
}

.close-sidebar {
  background: none;
  border: none;
  font-size: 28px;
  color: white;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background 0.3s ease, transform 0.3s ease;
}

.close-sidebar:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(90deg);
}

/* == NAVEGACIÓN == */
.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/*** MENÚ PADRE ***/
.menu-padre {
  user-select: none;
}

.submenu-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: white;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.3s ease;
}

.submenu-header:hover {
  background: rgba(255, 255, 255, 0.10);
}

.submenu-header i {
  margin-right: 12px;
  font-style: normal;
}

.submenu-arrow {
  margin-left: auto;
  transition: transform 0.3s ease;
}

/* == SUBMENÚ CERRADO == */
.submenu {
  list-style: none;
  padding-left: 10px;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  transition: max-height .35s ease;
}

/* == SUBMENÚ ABIERTO == */
.menu-padre.open .submenu {
  max-height: 500px;
}

.menu-padre.open .submenu-arrow {
  transform: rotate(180deg);
}

/* == ITEMS DEL SUBMENÚ == */
.submenu li a {
  display: flex;
  align-items: center;
  padding: 12px 26px;
  font-size: 14px;
  color: #e8e8e8;
  text-decoration: none;
  transition: background 0.25s ease;
}

.submenu li a i {
  margin-right: 10px;
}

.submenu li a:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* == LOGOUT == */
.sidebar-logout {
  padding: 10px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 20px;
}

.sidebar-logout a {
  color: #ff8989 !important;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.sidebar-logout a i {
  margin-right: 10px;
}

.sidebar-logout a:hover {
  background: rgba(255, 107, 107, 0.12) !important;
}
/* Botones de acción especial */
.btn-danger-outline {
    background: transparent !important;
    border: 1px solid #dc3545 !important;
    color: #dc3545 !important;
    padding: 8px 15px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.btn-danger-outline:hover {
    background: #dc3545 !important;
    color: white !important;
}
/* ==========================================================
   CENTRO DE AYUDA GLOBAL (BOMIBLLA 💡 o CÍRCULO ❓)
   ========================================================== */

/* Botón de Ayuda (Estilo Bombilla 💡) */
.btn-help-action {
    background: transparent;
    border: none;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    filter: grayscale(0.2);
}

.btn-help-action:hover {
    filter: grayscale(0);
    transform: scale(1.2);
    background: rgba(0,0,0,0.05);
}

/* Botón de Ayuda (Estilo Círculo ❓) */
.btn-help-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #24597f;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-help-circle:hover {
    background: #1a4563;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Forzar expansión del GlobalModal específicamente para la ayuda */
.modal:has(.help-modal-content) .modal-content {
    max-width: 1400px !important;
    width: 95% !important;
}

/* Estructura del Contenido de Ayuda */
.help-modal-content {
    font-family: inherit;
    color: #333;
    width: 100%;
}

.help-flex-row {
    display: flex;
    gap: 30px;
    align-items: stretch;
    width: 100%;
}

.help-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-section {
    padding: 15px;
    background: #f8faff;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
    height: 100%;
}

.help-section h3 {
    margin-top: 0;
    color: #24597f;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #eef2f7;
    padding-bottom: 8px;
}

/* Semáforo de Estados / Boxes Informativos */
.help-summary-status {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-box {
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bg-verde { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.bg-amarillo { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.bg-rojo { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Atajos / Tips */
.help-shortcut {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: white;
    border-radius: 10px;
    font-size: 0.95rem;
    border-left: 5px solid #3498db;
    margin-bottom: 5px;
}

.help-shortcut .key-icon {
    font-size: 1.5rem;
    background: #f0f4f8;
    padding: 6px;
    border-radius: 8px;
    min-width: 45px;
    text-align: center;
}

/* Cuadrícula de Iconos/Botones */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #edf2f7;
    transition: all 0.2s ease;
}

.help-item:hover {
    transform: translateY(-2px);
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.help-item-icon {
    font-size: 1.6rem;
    min-width: 40px;
    text-align: center;
}

.help-item-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Responsividad */
@media (max-width: 900px) {
    .help-flex-row {
        flex-direction: column;
    }
    .modal:has(.help-modal-content) .modal-content {
        width: 95% !important;
    }
}

@media (max-width: 600px) {
    .help-grid { grid-template-columns: 1fr; }
}
/* ============================================
   BOT ASESOR IA - ESTILOS GLOBALES
   ============================================ */
.ai-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    animation: slideUpAi 0.3s ease-out;
}

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

.ai-chat-header {
    background: var(--primary-color, #24597f);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-close-chat {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-close-chat:hover { opacity: 1; }

.ai-chat-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ai-message {
    padding: 10px 12px; /* Reducido de 12px 16px */
    border-radius: 15px;
    font-size: 0.9rem;
    max-width: 85%;
    line-height: 1.4;
}

.ai-message ul, .ai-message ol {
    margin: 5px 0;
    padding-left: 20px; /* Reducido para evitar el "tab" grande */
}

.ai-message li {
    margin-bottom: 3px;
}

.ai-message.system {
    background: #e2e8f0;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-message.user {
    background: var(--primary-color, #24597f);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.ai-chat-footer input {
    border-radius: 20px;
}

.ai-chat-footer button {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ai-typing {
    font-style: italic;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 5px;
}
