/* --- IMPORTACIÓN DE FUENTE UBUNTU --- */
@import url('https://granatlas.proyectoatlas.mx/bg.php');
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@300;400;500;700&display=swap');

/* VARIABLES */
:root {
  --header-color: #43718c;
  --header-background-image: none;
  --color-background-primary: #ffffffdb;
  --color-background-primary-content:  rgba(255, 255, 255, 0.5)b;
  --color-text-primary: rgb(51 51 51);
  --color-text-primary-content: rgb(51 51 51);
  --color-contrasted-elements: #43718c;
  --color-contrasted-elements-light: #c3dceb;
  --color-contrasted-text: white;
  --color-dark-gray-elements: rgb(51 51 51);
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(255, 255, 255, 0.3);
  --accent: #007AFF;
  --text-main: #1d1d1f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* --- CORRECCIÓN DE ESTRUCTURA BASE --- */
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Ubuntu', sans-serif;
/*background-color: #f5f5f7; */
}

/* BODY */
body {
  padding-top: 0px !important;
  display: flex;
  flex-direction: column;
  background-color: var(--color-background-primary);
  font-size: 16px; /* Establece una base para rem */
  background-size:       cover !important;
  background-position:   center center !important;
  background-attachment: fixed !important;
  background-repeat:     no-repeat !important;
  transition: background-image 0.8s ease-in-out;
}

/* Overlay sutil para legibilidad */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    z-index: 0;
    pointer-events: none;
}

/* BUTTONS (Refinado) */
button.btn, a.btn, input.btn, label.btn {
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  background-color: #ffffff;
  color: #1d1d1f;
  border-radius: 18px !important;
  padding: 0.5rem 1rem; /* ~8px 16px - usa rem */
  font-weight: 500;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  display: inline-block;
  text-align: center;
  text-shadow: none !important;
  line-height: 1.4; /* Mejora legibilidad */
}

/* --- Estado Foco (Anillo de selección azul Apple) --- */
button.btn:focus, a.btn:focus, input.btn:focus {
  outline: 3px solid rgba(0, 122, 255, 0.4) !important;
  outline-offset: 1px;
  background-color: #f5f5f7;
}

/* --- Estado Activo (Efecto de clic / presionado) --- */
button.btn:active, button.btn.active,
a.btn:active, a.btn.active,
input.btn:active, input.btn.active {
  transform: scale(0.96); /* ¡Magia! El botón se hace 4% más pequeño al presionar */
  background-color: var(--color-contrasted-elements) !important;
  box-shadow: none !important; /* Pierde la sombra porque está "hundido" */
}

/* =========================================
   REPARACIÓN DE ÍCONOS Y BOTONES APPLE
========================================= */

/* 1. PROTECCIÓN DEL SPRITE: 
   Esta regla asegura que NADA borre la imagen del sprite en los íconos */
.icon, .navbar .navbar-inner .icon {    
    display: inline-block !important;    
    height: 25px;
    margin: 5px 0 5px 0;
    line-height: 20px;
    vertical-align: middle;    
    align-items: center;
    flex-direction: row;
}

/* 2. BOTONES BASE (Sin 'none !important' en background-image) */
button.btn, a.btn, input.btn, label.btn {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    padding: 6px 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    text-shadow: none !important;
}

/* 3. TIPOS DE BOTONES (Corregidos para no heredar el 'none') */

/* --- Primary --- */
.btn.btn-primary, .btn.btn-primary:focus {
    background-color: var(--color-contrasted-elements) !important;
    background-image: unset; /* Sin !important aquí para que el hijo .icon pueda tener su propia imagen */
    color: var(--color-contrasted-elements-light) !important;
    border-color: transparent !important;
}

/* --- Info --- */
.btn.btn-info, .btn.btn-info:focus {
    background-color: #5AC8FA !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* --- Success --- */
.btn.btn-success, .btn.btn-success:focus {
    background-color: #34C759 !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* --- Warning --- */
.btn.btn-warning, .btn.btn-warning:focus {
    background-color: #FF9500 !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* --- Danger --- */
.btn.btn-danger, .btn.btn-danger:focus {
    background-color: #FF3B30 !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

/* 4. COMPORTAMIENTO DEL ÍCONO DENTRO DE BOTONES DE COLOR */
/* Cuando el botón es de color (azul, verde, etc), el ícono debe verse blanco */
.btn-primary .icon, 
.btn-success .icon, 
.btn-danger .icon, 
.btn-warning .icon, 
.btn-info .icon {
    filter: brightness(0) invert(1) !important; /* Convierte el ícono del sprite en blanco puro */
}

.btn:hover .icon {
    transform: scale(1.1);
    filter: grayscale(0) opacity(1);
}


/* =========================================
   DROP-DOWN LISTS - MACOS AESTHETIC
========================================= */

/* --- 1. El Panel Contenedor (Efecto Cristal y Sombras) --- */
.dropdown-menu {
  background-color: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(25px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
  padding: 0.375rem !important; /* ~6px */
  min-width: 200px; /* Un poco más ancho */
}

.dropdown-menu > li > a {
  border-radius: 6px !important;
  padding: 0.5rem 1rem !important; /* Consistente con botones */
  color: #1d1d1f !important;
  font-weight: 500;
  transition: background-color 0.1s ease-in-out; /* Transición más específica */
  margin-bottom: 2px;
}


/* Evitar margen en el último elemento */
.dropdown-menu > li:last-child > a {
  margin-bottom: 0;
}

/* --- 3. Estado Hover / Foco (Azul Apple) --- */
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus,
.dropdown-submenu:hover > a,
.dropdown-submenu:focus > a {
  /*background-image: none !important;*/
  background-color: #007AFF !important; /* Azul característico de selección */
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.2);
}

/* --- 4. Submenús (Si existen) --- */
.dropdown-submenu > .dropdown-menu {
  border-radius: 12px !important;
  margin-top: -6px; /* Alinear exactamente con la opción padre */
  margin-left: 2px; /* Separación del menú principal */
}

/* --- 5. El Botón Disparador cuando está abierto --- */
/* Cuando das clic para abrir el menú, el botón debe verse "presionado" */
.btn-group.open .btn.dropdown-toggle {
  background-color: #e5e5ea !important; /* Gris oscuro para hundimiento */
  color: #1d1d1f !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.08) !important; /* Sombra interna realza la profundidad */
  border-color: rgba(0,0,0,0.1) !important;
}

/* Pequeña línea divisoria dentro del menú (si la usas) */
.dropdown-menu .divider {
  background-color: rgba(0, 0, 0, 0.08) !important;
  border-bottom: none !important;
  margin: 6px 0 !important;
}

/* FORMS */

/* Form submit button container */
div.jforms-submit-buttons {
  padding: 5px;
  padding-top: 20px;
  background: none;
  border: none;
}

/* Form submit buttons */
div.jforms-submit-buttons.form-actions .btn{
  transition: none;
  border: 1px solid transparent;
  box-shadow: none;
  text-shadow: none;
}

div.jforms-submit-buttons.form-actions .btn:hover,
div.jforms-submit-buttons.form-actions .btn:focus
{
  filter: brightness(0.95);
  color: black;
}

div.jforms-submit-buttons.form-actions .btn.jforms-ctrl-reset {
  background-color: lightgrey;
}

div.jforms-submit-buttons.form-actions #jforms_view_edition__submit_cancel {
  background-color: #fd8c62;
}

div.jforms-submit-buttons.form-actions #jforms_view_edition__submit_submit {
  background-color: #aedb6a;
}

/* HEADER */

#header {
  height: 90px !important;
  position: fixed;
  top: 0px;
  left: 5px;
  right: 5px;
  z-index: 2000;
  background: var(--glass-bg) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border) !important;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: block;
  align-items: center;
  padding: 0 20px;
  color:var(--header-color)
}

@media (max-width: 768px) { /* Ajuste para móviles */
  #header {
    top: 5px;
    left: 5px;
    right: 5px;
    border-radius: 10px;
    padding: 0 10px;
  }
  #title h1 {
    font-size: 1.4rem !important;
  }
  #title h2 {
    display: none; /* Oculta el subtítulo en móviles para ahorrar espacio */
  }
}

#headermenu {
position: sticky !important; /* Cambiado de absolute a relative para entrar en el flex */
top: auto !important;
right: auto !important;
margin-left: auto; /* Empuja el menú a la derecha */
background: transparent !important;
}

#logo {
  float : left;
  height : 85px;
  min-width: 60px;
  margin : 5px 20px;
  background : url('img/logo.png') no-repeat;
  background-size: contain;
  background-position:center;
}

#title {
display: block;
margin-top: 0px;
margin-bottom: 0px;
align-items: baseline; /* Alinea h1 y h2 por su línea base de texto */
top: 50%;
transform: translateY(-60%);
background: none !important;
}
#title h1 {
display: inline-block;
font-size: 1.8rem !important;
font-weight: 700 !important;
color: var(--text-main) !important;
margin: 0 !important;
letter-spacing: -0.5px;
}

#title h2 {
font-size: 1.1 rem !important;
font-weight: 400 !important;
color: #86868b !important;
text-shadow:none !important;
-webkit-text-stroke:none !important;
font-weight: none !important;
margin: 0 10px 0 10px !important;
display: inline-block;
}

#headermenu .navbar-search {
margin-top: 0px;
height: 30px;
width: 260px;
}

/* =========================================
   NAVBAR NAVIGATION & ICON MODERNIZATION
========================================= */

/* --- Estilo de los Enlaces de Navegación --- */
.navbar .nav > li > a {
    color: var(--text-secondary) !important; /* Color gris suave tipo Mac */
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px; /* Espacio entre ícono y texto */
    text-shadow: none !important;
}

/* --- Estados Hover y Activo --- */
.navbar .nav .active > a,
.navbar .nav > li > a:focus,
.navbar .nav > li > a:hover {
    background-color: rgba(0, 122, 255, 0.1) !important; /* Fondo azul sutil */
    color: var(--accent) !important; /* Texto azul Apple */
    border-radius: 18px;
}

/* --- Dropdowns en la Navegación --- */
.navbar .nav li.dropdown.open > .dropdown-toggle,
.navbar .nav li.dropdown.active > .dropdown-toggle,
.navbar .nav li.dropdown.open.active > .dropdown-toggle {
    color: var(--accent) !important;
    background-color: rgba(0, 122, 255, 0.1) !important;
    border-radius: 8px 8px 0 0; /* Solo esquinas superiores si el menú abre abajo */
}

/* Flecha del Dropdown (Triangulito) */
.navbar .nav > li > .dropdown-menu::after {
    border-bottom: 6px solid var(--glass-bg) !important;
}

/* --- MODERNIZACIÓN DEL SPRITE DE ÍCONOS --- */
.navbar .navbar-inner .icon {
    background-image: url("images/sprite_20_tools.png") !important;
    filter: opacity(0.6); /* Los hace ver minimalistas y grises */
    transition: all 0.2s ease;
    transform: scale(0.9); /* Un poco más pequeños para verse más finos */
}

/* Efecto al pasar el mouse sobre el link: El ícono recupera color y brilla */
.navbar .nav li a:hover .icon,
.navbar .nav li.active a .icon,
.navbar .nav li.open a .icon {
    filter: opacity(1) drop-shadow(0 0 2px rgba(0,122,255,0.5));
    transform: scale(1.05);
}

/* --- COORDENADAS ORIGINALES (Mantenidas para funcionalidad) --- */

/* Dashboard */
.navbar .nav .dashboard-item .icon { background-position: -1040px 0; }
.navbar .nav .dashboard-item a:hover .icon,
.navbar .nav .dashboard-item.active a .icon { background-position: -1013px 0; }

/* Login */
.navbar .nav .login .icon { background-position: -234px 0; }
.navbar .nav .login a:hover .icon,
.navbar .nav .login.active a .icon { background-position: -210px 0; }

/* Registered */
.navbar .nav .registered .icon { background-position: -825px 0; }
.navbar .nav .registered a:hover .icon,
.navbar .nav .registered.active a .icon { background-position: -800px 0; }

/* User */
.navbar .nav .user .icon { background-position: -609px 0; }
.navbar .nav .user a:hover .icon,
.navbar .nav .user.active a .icon,
.navbar .nav .user.open a .icon { background-position: -582px 0; }

/* Home */
.navbar .nav .home .icon { background-position: -28px 0; }
.navbar .nav .home a:hover .icon,
.navbar .nav .home.active a .icon { background-position: 0 0; }

/* Lizmap necesita que el contenedor #content tenga altura
para renderizar el mapa. Aquí lo forzamos a ocupar el resto de la pantalla.
*/
#content {
top:95px;  
flex: 1;
display: flex;
flex-direction: column;
position: relative;
z-index: 1;
}

.lizmap-map-container, #map {
flex: 1;
width: 100% !important;
height: 100% !important;
min-height: calc(100vh - 110px); /* Asegura visibilidad */
}

/* En la administración, el contenido debe poder desplazarse.
*/
#main-content {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: white;
border-radius: 18px;
box-shadow: 0 4px 20px rgba(0,0,0,0.05);
overflow-y: auto; /* Permite scroll interno si es necesario */
}
