/* === FUENTES === */
@font-face {
  font-family: 'MiddleOfApril';
  src: url('../fonts/Middle-of-April.ttf') format('truetype');
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-BoldItalic.ttf') format('truetype');
  font-style: italic;
  font-weight: 700;
}

/* === RESET Y BASE === */
* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: url('../img/fondo-oscuro.png') no-repeat center center fixed;
  background-size: cover;
  background-attachment: fixed;
  color: white;
  font-family: 'Segoe UI', sans-serif;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
}

.contenedor-pagina {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* ✅ centra verticalmente */
  padding: 40px 0;
}

body.light-mode {
  background: url('../img/fondo-claro.png') no-repeat center center fixed;
  background-size: cover;
  background-attachment: fixed;
  color: #111;
}

/* 🔹 Button Styles: General, Delete, Edit, Scroll-to-top */
/* === CLASE BOTÓN PERSONALIZADA === */
.boton {
  background-color: #007bff;
  color: white;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  border: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  min-height: 48px; /* ✅ tamaño táctil adecuado */
}
.boton:hover {
  background-color: #3ae374;
  color: black;
  transform: scale(1.05);
}

/* === ANIMACIONES === */
@keyframes parallax {
  0% { background-position: center center; }
  50% { background-position: center top; }
  100% { background-position: center center; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes colores {
  0% { color: #70d6ff; }
  50% { color: #3ae374; }
}
@keyframes flotarMol {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(20px, 10px) rotate(90deg); }
  50% { transform: translate(0, 20px) rotate(180deg); }
  75% { transform: translate(-20px, 10px) rotate(270deg); }
}
@keyframes fadeInImagen {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes burbujaAnimacion {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* === ENCABEZADO === */
h1 span {
  animation: colores 5s infinite ease-in-out alternate;
  display: inline-block;
  font-family: 'MiddleOfApril', cursive;
  font-size: 3.5rem;
}
.subtitulo {
  font-family: 'Nunito', sans-serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 30px;
  opacity: 0.85;
}

/* === BÚSQUEDA === */
.busqueda {
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}
.busqueda input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 12px;
  border: 2px solid #3ae374;
  background-color: #5e5e5e;
  color: #111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  min-height: 48px;

}
body.light-mode .busqueda input {
  background-color: #f3f3f3;
  color: #111;
}
.botones-busqueda {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}


/* === CONTENEDOR PRINCIPAL === */
.ventana {
  background-color: #1e1e1e;
  padding: 40px;
  border-radius: 20px;
  max-width: 960px;
  width: 90%;
  margin: 0 auto;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  animation: fadeIn 0.5s ease-in-out;
  text-align: center;
}
body.light-mode .ventana {
  background-color: rgba(255,255,255,0.95);
  color: #111;
}

.contenedor-principal {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* === RESULTADOS === */
#resultado {
  margin-top: 20px;
  background-color: #292929;
  padding: 20px;
  border-radius: 10px;
  color: white;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 15px;
  line-height: 1.6;
  animation: fadeIn 0.5s ease-in-out;
}
body.light-mode #resultado {
  background-color: #f7f7f7;
  color: #111;
  border: 1px solid #ccc;
}
.titulo-resultado {
  font-weight: bold;
  font-size: 1.2rem;
  color: #3ae374;
  margin-bottom: 10px;
}
.titulo-resultado strong {
  color: #3ae374;
  font-weight: bold;
}
.pronunciacion {
  color: #70d6ff;
}
body.light-mode .pronunciacion {
  color: #2254a3;
}
.traduccion,
.sinonimos {
  font-style: italic;
}
.sinonimos span {
  display: inline-block;
  margin: 4px 6px 4px 0;
  padding: 4px 10px;
  border-radius: 16px;
  background-color: #444;
  font-style: italic;
}
body.light-mode .sinonimos span {
  background-color: #ddd;
  color: #222;
}

/* === AVISO NUEVOS TÉRMINOS === */
.aviso-nuevos {
  margin-top: 12px;
  padding: 8px 16px;
  background-color: rgba(58, 227, 116, 0.1);
  border: 1px solid #3ae374;
  border-radius: 10px;
  font-size: 14px;
  color: #3ae374;
  font-style: italic;
  animation: fadeIn 0.4s ease-in-out;
  text-align: center;
}
body.light-mode .aviso-nuevos {
  background-color: rgba(24, 119, 242, 0.1);
  border: 1px solid #1877f2;
  color: #1877f2;
}

#contadorTerminos {
  margin-top: 12px;
  font-size: 0.95rem;
  color: #ccc;
  font-family: 'Nunito', sans-serif;
  font-style: italic;
  line-height: 1.4;
  animation: fadeIn 0.4s ease-in-out;
  text-align: center;
}
body.light-mode #contadorTerminos {
  color: #222;
}

/* === SUGERENCIAS === */
.sugerencias {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.sugerencias button {
  background-color: #2196f3;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  transition: background-color 0.3s, transform 0.2s;
}
.sugerencias button:hover {
  background-color: #3ae374;
  color: black;
  transform: scale(1.02);
}

/* === TOGGLE MODO CLARO/OSCURO === */
#toggle-modo {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 30px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(to right, #1877f2, #ff5c39);
  cursor: pointer;
  transition: background 0.3s ease;
  overflow: hidden;
  z-index: 1001;
}
#toggle-modo::before {
  content: '🌙';
  position: absolute;
  width: 26px;
  height: 26px;
  top: 2px;
  left: 2px;
  background: white;
  border-radius: 50%;
  font-size: 14px;
  text-align: center;
  line-height: 26px;
  transition: transform 0.3s ease;
}
body.light-mode #toggle-modo::before {
  content: '☀️';
  transform: translateX(30px);
}

/* === BOTÓN MENÚ === */
.menu-toggle {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 48px;
  height: 48px;
  background: #3f51b5;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1002;
  display: none;
}

/* === NAVEGACIÓN === */
.nav-flotante {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  background: transparent;
  backdrop-filter: none;
  border-radius: 0 0 16px 16px;
  z-index: 1001;
}
.nav-flotante button {
  min-height: 48px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: 12px;
  color: white;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
}
.btn-agregar    { background-color: #ff9800; }
.btn-sugerencias{ background-color: #ff69b4; }
.btn-traductor  { background-color: #03a9f4; }
.btn-inicio     { background-color: #8bc34a; }
.btn-comparador { background-color: #9c27b0; }
.btn-certificados { background-color: #ff5722; }
.btn-admin      { background-color: #3f51b5; }
.nav-flotante button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* === FONDO MOLÉCULAS === */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-repeat: repeat;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}
.molecula {
  position: fixed;
  width: 60px;
  height: 60px;
  opacity: 0.3;
  filter: brightness(140%);
  animation: flotarMol 60s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}
.zona-moleculas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* === IMÁGENES ESTRUCTURA === */
.imagen-instrumento {
  display: block;
  margin: 20px auto;
  max-width: 300px;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, opacity 0.3s ease;
  animation: fadeInImagen 0.6s ease-in-out;
}
.imagen-instrumento:hover {
  transform: scale(1.05);
}
.resultado-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
}
.bloque-texto {
  flex: 1 1 60%;
  min-width: 250px;
}
.bloque-imagen {
  flex: 1 1 35%;
  min-width: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* === SPARKIE CON EFECTO BRILLO Y MOVIMIENTO === */
#sparkie-boton {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none; /* Sin fondo */
  transition: transform 0.3s ease;
}

#sparkie-boton img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 50%;
  animation: reboteSparkie 2s ease-in-out infinite, brilloSparkie 3s ease-in-out infinite;
  transition: transform 0.3s ease;
}

#sparkie-boton:hover img {
  transform: scale(1.1) rotate(2deg);
}

/* Brillo intermitente */
@keyframes brilloSparkie {
  0%, 100% {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.9));
  }
}

/* Rebote vertical */
@keyframes reboteSparkie {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

#sparkie-burbuja {
  position: absolute;
  top: -45px;
  left: 80px;
  background-color: #ffffffcc;
  color: #333;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  animation: burbujaAnimacion 0.5s ease;
  white-space: nowrap;
}

.oculto {
  display: none;
}

/* === ICONOS EN BOTONES === */
.boton i {
  font-size: 16px;
  margin: 0;
  color: white;
  transition: color 0.3s ease;
}
.boton:hover i {
  color: black;
}

/* Ícono del botón de modo claro/oscuro */
#toggle-modo i {
  font-size: 16px;
  color: #fff;
  transition: transform 0.3s ease, color 0.3s ease;
}
body.light-mode #toggle-modo i {
  color: #111;
}

.popup-exito {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #d4edda;
  color: #155724;
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  z-index: 9999;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.5s ease-in-out;
}

.popup-exito i {
  color: #28a745;
  font-size: 18px;
}

.oculto {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.footer-legal {
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  background-color: transparent;
  color: #ccc;
  margin-top: 2rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); /* ✅ mejora lectura sobre fondo colorido */
}

.footer-legal a {
  color: #cdcdcd;
  text-decoration: none;
  margin: 0 0.5rem;
}
.footer-legal a:hover {
  text-decoration: underline;
}

#btn-sugerir {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background-color: #1877f2;
  color: white;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-size: 24px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.ventana-sugerencia {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: #111;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0,0,0,0.3);
  z-index: 1001;
  max-width: 400px;
  width: 90%;
  margin: 0 auto;
  overflow-wrap: anywhere;
}
.ventana-sugerencia textarea,
.ventana-sugerencia input {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px;
  min-height: 48px;
}
.ventana-sugerencia .botones-form {
  display: flex;
  justify-content: space-between;
}
.oculto {
  display: none !important;
}

#btn-sugerir {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 1000;
  background-color: #ff5c39;
  color: white;
  border: none;
  border-radius: 50%;
  padding: 12px;
  font-size: 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  cursor: pointer;
}
#btn-sugerir:hover {
  background-color: #e14b2f;
}

/* ⚙️  Responsive Tweaks */
/* === AJUSTES RESPONSIVOS === */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav-flotante { top: 0; left: 0; right: auto; width: 220px; height: 100vh; flex-direction: column; align-items: flex-start; background: rgba(30,30,30,0.95); padding: 80px 10px 10px; transform: translateX(-100%); transition: transform 0.3s ease; }
  body.light-mode .nav-flotante { background: rgba(255,255,255,0.95); }
  .nav-flotante.abierto { transform: translateX(0); }
  .nav-flotante button { width: 100%; text-align: left; }
  .ventana { padding: 20px; }
  .resultado-flex { flex-direction: column; }
  .ventana-sugerencia { top: 10%; max-height: 80vh; overflow-y: auto; }
}
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
  }
}
