html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 40px;
  background: linear-gradient(135deg, #0a3d62 0%, #1a5f8a 25%, #0d4a6b 50%, #1a5f8a 75%, #0a3d62 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  position: relative;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Animación de nieve */
#snow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  color: white;
  font-size: 1.5em;
  font-family: Arial;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
  animation: fall linear infinite;
  opacity: 0.8;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
  }
}

/* Decoraciones navideñas */
.star-decoration {
  position: fixed;
  font-size: 2em;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  animation: twinkle 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes twinkle {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.5; transform: translateX(-50%) scale(1.2); }
}

/* Árbol flotante */
.floating-tree {
  position: fixed;
  font-size: 4em;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 0 20px rgba(34, 139, 34, 0.6));
  animation: treeFloat 6s ease-in-out infinite;
  top: 20%;
  right: 10%;
}

@keyframes treeFloat {
  0%, 100% { 
    transform: translateY(0px) rotate(-3deg);
  }
  50% { 
    transform: translateY(-20px) rotate(3deg);
  }
}

/* Papá Noel en trineo */
.santa-sleigh {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
  animation: santaBounce 0.5s ease-in-out infinite;
  flex-direction: row;
}

/* Orden: Papá Noel → Trineo → Renos (de izquierda a derecha) */
.santa-emoji {
  font-size: 3.2em;
  margin-right: -15px;
  z-index: 4;
  position: relative;
  animation: santaSit 1.2s ease-in-out infinite;
  transform-origin: center bottom;
  order: 1;
}

.sleigh-emoji {
  font-size: 2.8em;
  margin-left: -8px;
  margin-right: -8px;
  z-index: 2;
  position: relative;
  order: 2;
}

/* Contenedor de renos siempre al final */
.sleigh-front {
  display: flex;
  align-items: center;
  z-index: 6;
  order: 3;
}

.reindeer {
  font-size: 2.2em;
  animation: reindeerRun 0.4s ease-in-out infinite;
  display: inline-block;
}

.reindeer-1 {
  margin-right: -25px;
  animation-delay: 0s;
}

.reindeer-2 {
  margin-right: -20px;
  animation-delay: 0.2s;
}

/* Invertir visualmente los renos cuando van de izquierda a derecha */
.santa-sleigh.reindeers-flipped .sleigh-front {
  transform: scaleX(-1);
}

.santa-sleigh.reindeers-flipped .reindeer-1 {
  margin-right: -25px;
}

.santa-sleigh.reindeers-flipped .reindeer-2 {
  margin-right: -20px;
}

/* Invertir orden cuando va de derecha a izquierda: Renos → Trineo → Papá Noel */
.santa-sleigh.reverse-direction {
  flex-direction: row-reverse;
}

/* Con row-reverse, el orden se invierte visualmente, así que:
   Para que Renos aparezca primero, necesita order: 3
   Para que Trineo aparezca segundo, necesita order: 2
   Para que Papá Noel aparezca tercero, necesita order: 1 */
.santa-sleigh.reverse-direction .sleigh-front {
  order: 3; /* Aparece primero con row-reverse */
  transform: scaleX(1); /* Renos normales cuando van de derecha a izquierda */
}

.santa-sleigh.reverse-direction .sleigh-emoji {
  order: 2; /* Aparece segundo con row-reverse */
  margin-left: -8px;
  margin-right: -8px;
}

.santa-sleigh.reverse-direction .santa-emoji {
  order: 1; /* Aparece tercero (último) con row-reverse */
  margin-right: 0;
  margin-left: -15px;
}

.santa-sleigh.reverse-direction .reindeer-1 {
  margin-right: -25px;
  margin-left: 0;
}

.santa-sleigh.reverse-direction .reindeer-2 {
  margin-right: -20px;
  margin-left: 0;
}

@keyframes santaBounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

@keyframes santaSit {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}

@keyframes reindeerRun {
  0%, 100% { 
    transform: translateY(0px) translateX(0px);
  }
  25% { 
    transform: translateY(-2px) translateX(2px);
  }
  50% { 
    transform: translateY(0px) translateX(0px);
  }
  75% { 
    transform: translateY(-2px) translateX(-2px);
  }
}

/* Contenedor de regalos */
#gifts-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.gift {
  position: absolute;
  font-size: 1.5em;
  animation: giftFall linear forwards;
  filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
  pointer-events: none;
}

@keyframes giftFall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

/* Contenedor del logo con efectos */
.logo-container {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.logo-img {
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
  animation: logoGlow 2s ease-in-out infinite alternate;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px;
}

@keyframes logoGlow {
  from { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6)); }
  to { filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.9)); }
}

/* Efectos de brillo en el logo */
.sparkle {
  position: absolute;
  font-size: 1.5em;
  pointer-events: none;
  z-index: 4;
  animation: sparkleMove 3s ease-in-out infinite;
}

.sparkle-1 {
  top: -10px;
  left: -20px;
  animation-delay: 0s;
}

.sparkle-2 {
  top: 50%;
  right: -30px;
  animation-delay: 1s;
}

.sparkle-3 {
  bottom: -10px;
  left: 50%;
  animation-delay: 2s;
}

@keyframes sparkleMove {
  0%, 100% { 
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% { 
    opacity: 1;
    transform: scale(1.5) rotate(180deg);
  }
}

.form-signin {
  width: 100%;
  max-width: 330px;
  padding: 30px;
  margin: auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
              0 0 30px rgba(220, 20, 60, 0.2),
              0 0 30px rgba(34, 139, 34, 0.2);
  position: relative;
  z-index: 10;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 215, 0, 0.3);
  animation: formFloat 3s ease-in-out infinite;
}

@keyframes formFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.form-signin .checkbox {
  font-weight: 400;
}

.form-signin .form-control {
  position: relative;
  box-sizing: border-box;
  height: auto;
  padding: 12px;
  font-size: 16px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.christmas-input {
  border: 2px solid #d4af37;
  background: linear-gradient(to bottom, #fffef0, #ffffff);
  margin-bottom: 15px;
}

.christmas-input:focus {
  z-index: 2;
  border-color: #dc143c;
  box-shadow: 0 0 15px rgba(220, 20, 60, 0.5),
              inset 0 0 10px rgba(255, 215, 0, 0.2);
  outline: none;
  transform: scale(1.02);
}

.christmas-input::placeholder {
  color: #8b7355;
}

.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Título navideño */
.christmas-title {
  color: #dc143c;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3),
               0 0 10px rgba(255, 215, 0, 0.5);
  font-weight: bold;
  margin-bottom: 25px !important;
}

.title-text {
  display: inline-block;
  animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Botón navideño */
.christmas-btn {
  background: linear-gradient(135deg, #dc143c 0%, #ff1744 50%, #dc143c 100%);
  background-size: 200% 200%;
  border: none;
  color: white;
  font-weight: bold;
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(220, 20, 60, 0.4),
              inset 0 0 20px rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  animation: buttonShine 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

@keyframes buttonShine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.christmas-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 20, 60, 0.6),
              inset 0 0 30px rgba(255, 255, 255, 0.3);
  background-position: 100% 50%;
}

.christmas-btn:active {
  transform: translateY(0);
}

.btn-text {
  position: relative;
  z-index: 1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Footer navideño */
.christmas-footer {
  color: #d4af37;
  font-weight: 500;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .floating-tree {
    font-size: 3em;
    right: 5%;
    top: 15%;
  }
  
  .form-signin {
    padding: 20px;
  }
  
  .reindeer {
    font-size: 1.8em;
  }
  
  .sleigh-emoji {
    font-size: 2.2em;
  }
  
  .santa-emoji {
    font-size: 2.5em;
  }
}
