/* ============================================
   COMMON.CSS - ESTILOS COMUNES MEJORADOS
   ============================================ */

/* 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: #24597f;
  margin-bottom: 20px;
  text-align: center;
}

h2 {
  font-size: 1.4em;
  font-weight: 600;
  color: #24597f;
  margin-bottom: 15px;
}

h3 {
  font-size: 1.1em;
  font-weight: 600;
  color: #24597f;
  margin-bottom: 10px;
}

/* HEADER PRINCIPAL - Barra superior fija */
header {
  background: linear-gradient(135deg, #24597f 0%, #1a4563 100%);
  color: #fff;
  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);
}

/* ============================================
   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, #24597f 0%, #1a4563 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.1) !important;
}

/* ============================================
   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, #24597f 0%, #1a4563 100%);
    color: #fff;
    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;
}


/* ============================================
   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, #24597f 0%, #1a4563 100%);
    color: #fff;
    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;
}
