/* ═══════════════════════════════════════════════════════════════
   1. RESET E BASE
═══════════════════════════════════════════════════════════════ */
html, body {
  height: 100%;
  margin: 0;
  box-sizing: border-box;
}

body {
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #fef9f0;
  overflow: hidden;
}


/* ═══════════════════════════════════════════════════════════════
   2. VIDEO DE FONDO
═══════════════════════════════════════════════════════════════ */
#bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  background-image: url('video/vid_fondo_01.webp');
  background-size: cover;
  background-position: center;
  background-color: #fef9f0;
}

@media (prefers-reduced-motion: reduce) {
  #bg-video { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   3. OVERLAY DE TRANSICIÓN (login → app)
═══════════════════════════════════════════════════════════════ */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255,255,255,0.7), #FEF7EA 70%);
  backdrop-filter: blur(8px);
}
body.transition-final::after { opacity: 1; }

body.transition-out .featurex article,
body.transition-out .login-bg-animation {
  transform: scale(1.2);
  filter: blur(8px);
  opacity: 0;
  transition: all 0.6s ease;
}


/* ═══════════════════════════════════════════════════════════════
   4. LAYOUT FEATUREX
═══════════════════════════════════════════════════════════════ */
.featurex {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
}

.featurex + .featurex { margin-top: 1em; }

.featurex article {
  padding: 1.5em;
  text-align: center;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  border: 2px solid transparent;
  background-color: rgba(255, 252, 245, 0.4);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 10;
  isolation: isolate;
  overflow: visible;
  font-size: 0.9em;
  margin: 0 auto 1.5em auto;
  max-width: 400px;
  width: 100%;
  min-height: 20px;
}

/* Borde degradado interior do article */
.featurex article::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(
    90deg,
    rgba(81,110,255,0.3),
    rgba(255,34,159,0.3),
    rgba(255,204,0,0.3),
    rgba(81,110,255,0.3)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.featurex article.no-border::before { display: none; }

.featurex article .form-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* ═══════════════════════════════════════════════════════════════
   5. DECORACIÓN AMIZAR (latido detrás do article)
═══════════════════════════════════════════════════════════════ */
.login-bg-animation {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.login-bg-animation img {
  height: 36em;
  position: absolute;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.07));
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.07));
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: latido2 3.6s cubic-bezier(.25, 0.1, .25, 1) infinite;
  transform-origin: center center;
}

@keyframes latido2 {
  0%   { transform: scale(1);     opacity: 0.1;  }
  22%  { transform: scale(1.04);  opacity: 0.2;  }
  30%  { transform: scale(1.02);  opacity: 0.15; }
  60%  { transform: scale(1.008); opacity: 0.12; }
  100% { transform: scale(1);     opacity: 0.1;  }
}


/* ═══════════════════════════════════════════════════════════════
   6. LOGO PRINCIPAL
═══════════════════════════════════════════════════════════════ */
.login-logo {
  width: 75%;
  max-width: 260px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}


/* ═══════════════════════════════════════════════════════════════
   7. FORMULARIOS
═══════════════════════════════════════════════════════════════ */
#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#mensaje-error {
  color: red;
  margin-bottom: 0.5em;
  min-height: 1em;
}

.form-input,
.form-textarea {
  width: 80%;
  max-width: 280px;
  color: rgb(35,35,35);
  border-radius: 99px;
  font-size: 0.8em;
  resize: none;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.03);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
  transition: background-color 0.3s, transform 0.3s;
}

.inline-inputs {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.inline-inputs .form-input {
  width: 95%;
  min-width: 120px;
}

.modo-acceso {
  display: flex;
  gap: 20px;
  font-size: 0.9em;
  align-items: center;
  margin-top: 0.8em;
}

.modo-acceso label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.amizar-ia-btn.secondary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 35px;
  border-radius: 99px;
  background: rgba(249,250,251,0.2);
  border: 0.5px solid #6d6d6d;
  margin-top: 2em;
  cursor: pointer;
}


/* ═══════════════════════════════════════════════════════════════
   9. PE DE PÁXINA (ENISA)
═══════════════════════════════════════════════════════════════ */
.enisa-block {
  margin-top: 1em;
  cursor: default;
}

.enisa-block p {
  margin: 0 1em;
  font-size: 0.6em;
  line-height: 1.4;
  text-align: justify;
  color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  gap: 0.7em;
}

.enisa-block img {
  margin-right: 0.8em;
}


/* ═══════════════════════════════════════════════════════════════
   10. ANIMACIÓN DE BORDE AMIZAR
═══════════════════════════════════════════════════════════════ */
@keyframes amizar-border-move {
  0%   { background-position: 0% 50%, 0% 50%; }
  100% { background-position: 0% 50%, 300% 50%; }
}


/* ═══════════════════════════════════════════════════════════════
   11. DETALLES (ocultar frecha nativa)
═══════════════════════════════════════════════════════════════ */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }


/* ═══════════════════════════════════════════════════════════════
   12. RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  body { margin: 1.5em; }
  .featurex + .featurex { margin-top: 1.5em; }
}
