/* =====================================================
   SIAPH - NAVBAR INSTITUCIONAL
   Dirección General de Profesiones
   Compatible: AdminLTE 2 / Bootstrap 3
===================================================== */

/* VARIABLES */
:root {
  --siaph-guinda: #641f32;
  --siaph-guinda-hover: #521829;
  --siaph-blanco: #ffffff;
  --siaph-gris: #f5f5f7;
  --siaph-texto: #30343b;
  --siaph-borde: #e9e9ed;
}

/* =====================================================
   1. HEADER PRINCIPAL
===================================================== */

.main-header.siaph-header {
  font-family: "Montserrat", Arial, sans-serif;
  background: var(--siaph-guinda);
  z-index: 1030;
}

.main-header.siaph-header .logo,
.main-header.siaph-header .navbar {
  background: var(--siaph-guinda) !important;
  border: none !important;
}

/* =====================================================
   2. LOGO SIAPH
===================================================== */

.main-header.siaph-header .logo {
  height: 60px;
  line-height: 60px;
  color: var(--siaph-blanco) !important;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s ease;
}

.main-header.siaph-header .logo:hover {
  background: var(--siaph-guinda-hover) !important;
}

.main-header.siaph-header .logo-mini,
.main-header.siaph-header .logo-lg {
  color: var(--siaph-blanco);
}

/* =====================================================
   3. NAVBAR SUPERIOR
===================================================== */

.main-header.siaph-header .navbar {
  min-height: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0;
}

/* Botón hamburguesa */

.main-header.siaph-header .sidebar-toggle {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 19px;
  color: var(--siaph-blanco) !important;
  transition: background 0.2s ease;
}

.main-header.siaph-header .sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* =====================================================
   4. TÍTULO DEL SISTEMA
===================================================== */

.siaph-navbar-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 0 15px;
  color: var(--siaph-blanco);
  line-height: 1.4;
}

.siaph-system-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--siaph-blanco);
}

.siaph-navbar-title small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
}

/* =====================================================
   5. MENÚ DERECHO
===================================================== */

.main-header.siaph-header .navbar-custom-menu {
  margin-left: auto;
  flex-shrink: 0;
}

.main-header.siaph-header .navbar-custom-menu > .navbar-nav {
  display: flex;
  align-items: center;
  margin: 0;
}

.main-header.siaph-header .navbar-custom-menu > .navbar-nav > li {
  position: relative;
  float: none;
}

.main-header.siaph-header .navbar-nav > li > a {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--siaph-blanco) !important;
  font-size: 12px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.main-header.siaph-header .navbar-nav > li > a:hover,
.main-header.siaph-header .navbar-nav > .open > a,
.main-header.siaph-header .navbar-nav > .open > a:hover,
.main-header.siaph-header .navbar-nav > .open > a:focus {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--siaph-blanco) !important;
}

.siaph-chevron {
  font-size: 11px;
  opacity: 0.8;
}

/* =====================================================
   6. AVATAR DEL USUARIO
===================================================== */

.siaph-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f1f3;
  color: var(--siaph-guinda);
  font-size: 16px;
}

.siaph-username {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* =====================================================
   7. MENÚS DESPLEGABLES
===================================================== */

.main-header.siaph-header .siaph-dropdown-menu,
.main-header.siaph-header .siaph-profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  min-width: 235px;
  margin-top: 0;
  padding: 7px 0;
  border: 1px solid var(--siaph-borde);
  border-radius: 8px;
  background: var(--siaph-blanco) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 1100;
}

.main-header.siaph-header .dropdown-menu > li > a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 17px;
  color: var(--siaph-texto) !important;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  transition: background 0.2s ease;
}

.main-header.siaph-header .dropdown-menu > li > a:hover {
  background: var(--siaph-gris) !important;
  color: var(--siaph-guinda) !important;
}

.main-header.siaph-header .dropdown-menu > li > a > i {
  width: 17px;
  min-width: 17px;
  text-align: center;
  color: var(--siaph-guinda);
}

.siaph-menu-heading {
  padding: 10px 17px;
  color: #858994;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* =====================================================
   8. PERFIL DE USUARIO
===================================================== */

.siaph-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  background: var(--siaph-blanco);
}

.siaph-profile-avatar {
  width: 43px;
  height: 43px;
  min-width: 43px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f1f3;
  color: var(--siaph-guinda);
  font-size: 20px;
}

.siaph-profile-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.siaph-profile-info strong {
  color: var(--siaph-texto);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.siaph-profile-info small {
  color: #888;
  font-size: 11px;
}

.siaph-profile-divider {
  height: 1px;
  margin: 4px 0;
  padding: 0;
  background: #ececec;
}

.main-header.siaph-header .dropdown-menu > li > a.siaph-logout,
.main-header.siaph-header .dropdown-menu > li > a.siaph-logout i {
  color: #c62828 !important;
}

.main-header.siaph-header .dropdown-menu > li > a.siaph-logout:hover {
  background: #fff1f1 !important;
}

/* =====================================================
   9. ESCRITORIO
===================================================== */

@media (min-width: 768px) {
  .main-header.siaph-header .logo {
    width: 230px;
  }

  .main-header.siaph-header .navbar {
    margin-left: 230px;
  }

  /* Ajuste para sidebar colapsado */
  .sidebar-collapse .main-header.siaph-header .logo {
    width: 50px;
  }

  .sidebar-collapse .main-header.siaph-header .navbar {
    margin-left: 50px;
  }

  .main-sidebar {
    padding-top: 60px !important;
  }
}

/* =====================================================
   10. TABLET Y PANTALLAS INTERMEDIAS
===================================================== */

@media (min-width: 768px) and (max-width: 991px) {
  .siaph-navbar-title {
    padding: 0 10px;
  }

  .siaph-system-name {
    font-size: 14px;
  }

  .siaph-username {
    max-width: 120px;
  }

  .main-header.siaph-header .navbar-nav > li > a {
    padding: 0 12px;
  }
}

/* =====================================================
   11. MÓVILES
   CORRECCIÓN: NAVBAR EN UNA SOLA FILA
===================================================== */

@media (max-width: 767px) {
  /* Contenedor principal */
  .main-header.siaph-header {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    height: 55px;
    min-height: 55px;
    background: var(--siaph-guinda);
  }

  /* Eliminar la fila superior independiente */
  .main-header.siaph-header .logo {
    position: relative;
    float: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto !important;
    min-width: 88px;
    max-width: 100px;
    height: 55px;
    line-height: normal;
    margin: 0;
    padding: 0 10px;
    font-size: 13px;
    text-align: center;
    background: transparent !important;
  }

  /* Logo completo en móvil */
  .main-header.siaph-header .logo .logo-lg {
    display: block !important;
    font-size: 13px;
    line-height: 1;
  }

  .main-header.siaph-header .logo .logo-mini {
    display: none !important;
  }

  /* Navbar a continuación del logo */
  .main-header.siaph-header .navbar {
    position: relative;
    float: none;
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 55px;
    min-height: 55px;
    margin: 0 !important;
    padding: 0;
    border: none;
  }

  /* Botón hamburguesa */
  .main-header.siaph-header .sidebar-toggle {
    position: relative;
    float: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 55px;
    padding: 0 10px;
    margin: 0;
    color: #fff !important;
  }

  /* Nombre del sistema */
  .main-header.siaph-header .siaph-navbar-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 5px;
    margin: 0;
  }

  .main-header.siaph-header .siaph-system-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Ocultar subtítulo en móvil */
  .main-header.siaph-header .siaph-navbar-title small {
    display: none;
  }

  /* Menú derecho */
  .main-header.siaph-header .navbar-custom-menu {
    position: relative;
    float: none;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .main-header.siaph-header .navbar-custom-menu > .navbar-nav {
    position: static;
    display: flex;
    align-items: center;
    flex-direction: row;
    margin: 0;
    padding: 0;
  }

  .main-header.siaph-header .navbar-custom-menu > .navbar-nav > li {
    position: relative;
    float: none;
  }

  .main-header.siaph-header .navbar-custom-menu > .navbar-nav > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 55px;
    padding: 0 10px;
    margin: 0;
    color: #fff !important;
  }

  /* Ocultar textos secundarios */
  .siaph-consultar-text,
  .siaph-chevron,
  .siaph-username {
    display: none !important;
  }

  /* Avatar compacto */
  .siaph-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 15px;
  }

  /* Dropdowns móviles */
  .main-header.siaph-header .siaph-dropdown-menu,
  .main-header.siaph-header .siaph-profile-menu {
    position: absolute !important;
    top: 100%;
    right: 0 !important;
    left: auto !important;
    width: 245px;
    min-width: 0;
    max-width: calc(100vw - 20px);
    margin: 0;
    padding: 7px 0;
    border-radius: 8px;
    background: #fff !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    z-index: 1100;
  }

  .main-header.siaph-header
    .navbar-custom-menu
    .navbar-nav
    > li
    > .dropdown-menu {
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
  }

  .main-header.siaph-header .dropdown-menu > li > a {
    color: var(--siaph-texto) !important;
    padding: 12px 15px;
  }

  .main-sidebar {
    padding-top: 55px !important;
  }
}

/* =====================================================
   12. CELULARES PEQUEÑOS
===================================================== */

@media (max-width: 375px) {
  .main-header.siaph-header .logo {
    min-width: 76px;
    max-width: 85px;
    padding: 0 5px;
  }

  .main-header.siaph-header .logo .logo-lg {
    font-size: 11px;
  }

  .main-header.siaph-header .sidebar-toggle {
    padding: 0 8px;
  }

  .main-header.siaph-header .siaph-system-name {
    font-size: 11px;
  }

  .main-header.siaph-header .navbar-custom-menu > .navbar-nav > li > a {
    padding: 0 7px;
  }

  .siaph-avatar {
    width: 27px;
    height: 27px;
    min-width: 27px;
  }
}
