* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --ubes-main-color: #D9006C;
  --ubes-hover-color: #B8005A;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto; /* Permite el scroll vertical */
  font-family: 'Roboto', sans-serif;
  background-color: #ffffff;
}

/* --- Cambiando los colores de los elementos --- */
/* Logo del Navbar */
/* --- Cambiando los colores de los elementos --- */

/* Logo del Navbar y Menú Hamburguesa en tema UBES */
body.theme-ubes nav .logo,
body.theme-ubes nav .hamburger {
  color: #ffffff; /* <-- Cambia a 'white' o el color que desees */
}

body.theme-ubes nav {
  background-color: var(--ubes-main-color);
}

/* Línea separadora amarilla */
body.theme-ubes .yellow-line {
  background-color: var(--ubes-main-color);
}

/* Borde del botón del sitio web */
body.theme-ubes .website {
  border-color: var(--ubes-main-color);
}

/* Botones principales (selfie, guardar contraseña, etc.) */
body.theme-ubes #startSelfieBtn,
body.theme-ubes #pwdSubmitBtn,
body.theme-ubes .button-group button,
body.theme-ubes #savePositionButton {
  background-color: var(--ubes-main-color);
}

/* Hover de los botones principales */
body.theme-ubes #startSelfieBtn:hover,
body.theme-ubes #pwdSubmitBtn:hover,
body.theme-ubes .button-group button:hover,
body.theme-ubes #savePositionButton:hover {
  background-color: var(--ubes-hover-color);
}

/* Separador "|" entre los logos */
body.theme-ubes .logo-wrapper::before {
  background-color: var(--ubes-main-color);
}

/* =======================================================
 * ESTILOS CORREGIDOS PARA LOGOS
 * ======================================================= */

/* Contenedor principal de logos */
.logo-container {
  display: flex;
  justify-content: center; /* Centra los items horizontalmente */
  align-items: center;     /* Centra los items verticalmente */
  width: 80%;              /* Ocupa el 80% del ancho disponible */
  margin: 0 auto 15px auto; /* Centra el contenedor y le da margen inferior */
}

/* Estilo para TODAS las imágenes de logo */
.logo-container > .logo { /* Usamos el selector de hijo directo */
height: 45px;
width: auto;
object-fit: contain;
flex-shrink: 1;
max-width: 45%;
}

/* Estilo específico para el logo de UBES */
.logo-wrapper .ubes-logo {
 max-height: 80px; /* Aumentamos ligeramente la altura máxima */
 max-width: 100%;    /* <-- Ajusta el ancho máximo si es necesario */
}

/* Contenedor del logo UBES y su separador */
.logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-wrapper::before {
  content: '';
  display: none; /* <-- Oculto por defecto */
  width: 2px;
  height: 40px;
  margin: 0 15px;
}

/* 2. Cuando el tema UBES está activo, lo muestra y le da color */
body.theme-ubes .logo-wrapper::before {
  display: block; /* <-- Lo hacemos visible */
  background-color: var(--ubes-main-color); /* Usamos la variable de color de UBES */
  transform: translateY(-5px);
}

/* ======================================================= */

.yellow-line {
  width: 100%;
  height: 3px;
  background-color: #F5A623;
  margin: 10px 0;
}

/* Navbar */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  background-color: #f1f1f1;
  padding: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .logo {
  font-size: 1.5em;
  color: #F5A623;
  font-weight: bold;
}

nav .menu {
  display: flex;
  gap: 1em;
}

nav .menu a {
  text-decoration: none;
  color: #333;
  font-size: 1em;
}

/* Credencial */
.credencial-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  margin-top: 70px; /* Añadido para que no quede debajo del nav */
}

.credencial {
  width: 100%;
  max-width: 450px; /* Ancho máximo para la credencial */
  background-color: #f9f9f9;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Modal de imagen ampliada */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  text-align: center;
}

.modal-content {
  margin: auto;
  display: block;
  width: 50vh;
  height: 50vh;
  border-radius: 50%;
  border: 5px solid white;
  object-fit: cover;
}

.modal-content:hover {
  cursor: pointer;
}

/* Bloqueo total cuando el modal está activo */
.modal.blocking {
  display: none;           /* Por defecto oculto */
  position: fixed;
  z-index: 10050;          /* Más que el nav y otros modales */
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

/* Clase en body para evitar scroll e interacción por debajo */
body.modal-open {
  overflow: hidden !important;
}

/* Botón "Tomar selfie" (modal forzado) */
#startSelfieBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;          /* consistente con tus botones de la app */
  background-color: #F5A623;   /* color institucional ya usado */
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.15);
  transition: background-color .2s ease, box-shadow .2s ease, transform .06s ease;
}

#startSelfieBtn:hover {
  background-color: #d88b1b;   /* mismo hover que .button-group button */
}

#startSelfieBtn:active {
  transform: translateY(1px);
}

#startSelfieBtn:focus-visible {
  outline: 3px solid rgba(245,166,35,.35);
  outline-offset: 2px;
}

#startSelfieBtn[disabled] {
  background-color: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

#startSelfieBtn i {
  font-size: 1.1em;            /* si le agregás un ícono Font Awesome */
}

#pwdSubmitBtn {
  background-color: #F5A623;
  color: #fff;
}
#pwdSubmitBtn:hover { background-color: #d88b1b; }

/* 📌 Notificaciones */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px; /* Ancho para todas las notificaciones dentro */
    z-index: 10001; /* ¡MÁS ALTO QUE EL NAVBAR (9999)! */
}

/* 📌 Estilos de notificaciones */
.notification {
    background-color: #f44336;
    color: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.5s ease-in-out;
    margin-bottom: 10px; /* Para separar notificaciones entre sí */
}

/* 📌 Notificación de éxito */
.notification.success {
    background-color: #4CAF50;
    margin-bottom: 50px;
}

/* 📌 Animaciones de notificación */
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* 📌 Botón para cerrar notificación */
.notification .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
}

@media only screen and (max-width: 768px) {
  .modal-content {
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    object-fit: cover;
  }
}

/* --- ADAPTACIÓN PARA MÓVILES (SOLUCIÓN DEFINITIVA) --- */
@media (max-width: 768px) {
  html, body {
    height: 100%;
    overflow: hidden; /* Evita el scroll en la página completa */
  }

  .credencial-container {
    height: 100vh; /* Ocupa toda la altura de la ventana */
    width: 100vw; /* Ocupa todo el ancho de la ventana */
    padding: 0;
    margin-top: 0; /* Resetea el margen */
    align-items: stretch; /* Estira el hijo para que ocupe todo el alto */
  }

  .credencial {
    width: 100%; /* Ocupa todo el ancho */
    height: 100%; /* Ocupa toda la altura */
    border-radius: 0; /* Sin bordes redondeados para un look de pantalla completa */
    box-shadow: none; /* Sin sombra */
    margin: 0; /* Resetea márgenes */
    padding: 85px 20px 20px 20px; /* Aumentado el padding superior para que el logo no se corte */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Alinea el contenido principal arriba */
    align-items: center;
    position: static; /* Asegurarse de que no sea 'relative' para evitar conflictos */
  }
  
  /* Ajustar tamaños de elementos internos para que quepan mejor */
  .photo-wrapper {
    width: 120px;
    height: 120px;
    margin-bottom: 0.5em;
  }

  .credencial h2 {
    font-size: 1.1em;
    margin: 0.2em 0;
  }

  .credencial p {
    font-size: 0.85em;
    margin: 0.2em 0;
  }
  
  /* Quitar posicionamiento absoluto del VTO y dejarlo en el flujo normal */
  .credencial p.expiry {
    position: static;
    width: auto;
    margin: 0.5em 0 0 0; /* Pequeño margen superior para separarlo del QR */
  }

  /* Empujar el QR (y el VTO que le sigue) hacia abajo */
  .qr {
    width: 120px;
    height: 120px;
    margin-top: auto; /* ESTA ES LA SOLUCIÓN: Empuja este elemento hacia abajo */
    margin-bottom: 0;
  }

  .header .logo {
    max-width: 160px; /* Un poco más pequeño en mobile */
    margin-bottom: 10px;
  }

  nav .menu {
    display: none;
  }
  nav .hamburger {
    display: block;
    cursor: pointer;
    font-size: 2em;
  }
  nav .menu.active {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background-color: white;
    justify-content: center;
    align-items: center;
    z-index: 9;
  }
  nav .menu.active .menu-content {
    background-color: transparent;
    padding: 2em;
    border-radius: 0;
    text-align: center;
  }
  .menu-content ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .menu-content li {
    margin: 1em 0;
  }
  .menu-content a {
    text-decoration: none;
    color: #333;
    font-size: 1.2em;
    display: block;
    text-align: center;
  }
  nav .menu.active a {
    font-size: 2em;
    color: black;
  }

  #startSelfieBtn {
    width: 100%;
    padding: 14px 18px;
  }
}

.hamburger {
  display: none;
}

.hamburger.open {
  content: '✖';
  z-index: 10;
}

/* Estilos específicos para la imagen de perfil dentro de su contenedor */
.img-container img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.2) translateY(-10%);
}

/* Modal para reposicionar la foto */
#repositionModal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

.reposition-content {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  max-width: 300px;
  margin: 0 10px;
}

.reposition-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 10px auto;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #ddd;
}

.reposition-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: grab;
}

#savePositionButton {
  padding: 10px 20px;
  border: none;
  background-color: #F5A623;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
}

.credencial h2,
.credencial p {
  margin: 0.5em 0;
}

.credencial p.passport {
  font-weight: bold;
  color: #000;
}

.credencial p.expiry {
  font-style: italic;
  color: #888;
}

.qr {
  width: 150px;
  height: 150px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: white;
  border: 2px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
}

.qr img {
  width: auto;
  height: 110%;
  object-fit: contain;
  border-radius: 0;
  transform: translateY(1%);
}

.header {
  margin-bottom: 20px;
  text-align: center;
  width: 100%;
}

/* Estilos específicos y responsivos para el logo del header */

.website {
  display: inline-block;
  padding: 5px 15px; /* Un poco más de padding horizontal */
  font-size: 16px;
  font-weight: bold;
  color: #000;
  text-decoration: none;
  border: 2px solid #F5A623;
  border-radius: 25px;
  background-color: transparent;
}

/* --- CAMBIO PRINCIPAL AQUÍ --- */
.header .website {
  /* Se eliminó 'display: block;' para que el contenedor se ajuste al texto */
  margin-top: 5px;
  font-size: 14px;
  text-decoration: none;
  color: #333;
}

#logout {
  cursor: pointer;
}

/* Opcional: estilos para la página de Perfil */
.profile-container {
  margin-top: 70px;
  max-width: 600px;
  margin: 100px auto 0;
  background: #f9f9f9;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.profile-container h1 {
  text-align: center;
  margin-bottom: 1em;
  color: #F5A623;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: bold;
  margin-bottom: 0.3em;
}

.form-group input {
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.form-group input:disabled {
  background-color: #eee;
  cursor: not-allowed;
}

.button-group {
  text-align: center;
  margin-top: 1em;
}

.button-group button {
  padding: 0.7em 1.5em;
  margin: 0 0.5em;
  border: none;
  border-radius: 5px;
  background-color: #F5A623;
  color: #fff;
  cursor: pointer;
  font-size: 1em;
}

.button-group button:hover {
  background-color: #d88b1b;
}

/* Contenedor de imagen y botón */
.photo-wrapper {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 1rem;
}

.img-container {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.edit-photo-button {
  position: absolute;
  bottom: 0;
  right: 0;
  transform: translate(-10%, -10%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background-color: #F5A623;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.edit-photo-button i {
  color: #fff;
  font-size: 14px;
}

.profile-container .img-container {
  margin: 0 auto 1em;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
}

.profile-container .img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

@media (min-width: 769px) {
  nav .hamburger {
    display: none;
  }
  nav .menu {
    display: block;
    position: static;
  }
  .menu-content ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
  }
  .menu-content li {
    margin: 0;
  }
  .menu-content a {
    font-size: 1em;
    text-decoration: none;
    color: #333;
  }
  .menu.active {
    display: block;
  }
}

@media (max-width: 768px) {
  .profile-container {
    max-width: 100%;
    margin: 0;
    margin-top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
  }
}
