* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #0f0f1e 100%);
  background-size: 400% 400%;
  animation: gradient-shift 15s ease infinite;
  overflow-x: hidden;
  transition: background 0.3s ease;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

body.light-mode {
  background: linear-gradient(135deg, #FF9FE5 0%, #FFE66D 25%, #A8E6CF 50%, #8ED4FF 75%, #FF9FE5 100%);
  background-size: 400% 400%;
  animation: gradient-shift 15s ease infinite;
}

.page-wrapper {
  min-height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  transition: background 0.3s ease;
}

/* Floating particles */
.particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  animation: float-up linear infinite;
  opacity: 0;
}
@keyframes float-up {
  0% { transform: translateY(100%) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle ease-in-out infinite;
}

/* Card */
.invitation-card {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, rgba(20,20,40,0.95) 0%, rgba(25,25,50,0.95) 100%);
  border: 4px solid #7C4DFF;
  border-radius: 40px;
  max-width: 520px;
  width: 100%;
  padding: 48px 40px;
  box-shadow:
    0 0 0 12px rgba(124,77,255,0.15),
    0 12px 50px rgba(0,0,0,0.4),
    0 0 30px rgba(124,77,255,0.2);
  text-align: center;
  animation: bounce-in 0.8s cubic-bezier(0.68,0.55,0.265,1.55) both;
  transition: all 0.3s ease;
}

@keyframes bounce-in {
  0% { opacity: 0; transform: scale(0.3) rotate(-5deg); }
  50% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

body.light-mode .invitation-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(255,245,220,0.95) 100%);
  border-color: #FF9FE5;
  box-shadow:
    0 0 0 12px rgba(255,159,229,0.15),
    0 12px 50px rgba(0,0,0,0.1),
    0 0 30px rgba(255,230,100,0.25);
}

.emoji-burst {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: pop 0.6s cubic-bezier(0.175,0.885,0.32,1.275) 0.3s both;
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Avatar frame */
.avatar-frame {
  width: 160px;
  height: 160px;
  margin: 16px auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.8s ease 0.35s both;
  position: relative;
}

.avatar-circle {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #7C4DFF 0%, #00D9FF 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(124,77,255,0.4);
  transition: all 0.3s ease;
  position: relative;
}

.avatar-circle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(124,77,255,0.55);
}

body.light-mode .avatar-circle {
  background: linear-gradient(135deg, #FF9FE5 0%, #FFE66D 100%);
  box-shadow: 0 8px 30px rgba(255,159,229,0.3);
}

body.light-mode .avatar-circle:hover {
  box-shadow: 0 12px 40px rgba(255,159,229,0.45);
}

.avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
  color: white;
}

.avatar-placeholder i {
  width: 70px;
  height: 70px;
  color: rgba(255,255,255,0.9);
}

/* Avatar image styles */
.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: opacity 0.8s ease-in-out;
}

.avatar-image.fade-out {
  opacity: 0;
}

.avatar-image.fade-in {
  opacity: 1;
}

.celebrates-text {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #A78BFA;
  margin-bottom: 8px;
  animation: fade-in 0.8s ease 0.3s both;
}

.big-name {
  font-family: 'Bungee', sans-serif;
  font-weight: 700;
  font-size: clamp(3rem, 10vw, 4.5rem);
  line-height: 1;
  background: linear-gradient(135deg, #7C4DFF 0%, #00D9FF 50%, #A78BFA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  animation: slide-up 0.8s ease 0.4s both;
  transition: background 0.3s ease;
}

body.light-mode .big-name {
  background: linear-gradient(135deg, #E84B8A 0%, #F5A623 50%, #50B348 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.age-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7C4DFF, #00D9FF);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  padding: 8px 24px;
  border-radius: 50px;
  margin-bottom: 24px;
  animation: bounce 0.6s ease 0.5s both;
  transition: background 0.3s ease;
  transform: rotate(-2deg);
}

@keyframes bounce {
  0% { opacity: 0; transform: scale(0) rotate(-10deg); }
  60% { transform: scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-2deg); }
}

body.light-mode .age-badge {
  background: linear-gradient(135deg, #E84B8A, #F5A623);
  color: #fff;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
  opacity: 0.4;
}
.divider-line { flex: 1; height: 1px; background: linear-gradient(to right, transparent, #ffd700, transparent); }
.divider-icon { color: #ffd700; font-size: 0.8rem; }

/* Detail rows */
.detail-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(124,77,255,0.15), rgba(0,217,255,0.08));
  border: 2px solid #7C4DFF;
  border-radius: 20px;
  padding: 14px 18px;
  margin-bottom: 12px;
  text-align: left;
  animation: fade-in 0.8s ease both;
  transition: all 0.3s ease;
}

.detail-row:hover {
  transform: translateX(4px);
  box-shadow: 0 6px 20px rgba(124,77,255,0.25);
}

body.light-mode .detail-row {
  background: linear-gradient(135deg, rgba(255,159,229,0.12), rgba(255,230,100,0.1));
  border-color: #FF9FE5;
}
.detail-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #7C4DFF, #00D9FF);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

body.light-mode .detail-icon {
  background: linear-gradient(135deg, #FF9FE5, #A8E6CF);
  color: #fff;
}
.detail-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #A78BFA;
  margin-bottom: 2px;
  transition: color 0.3s ease;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
}

body.light-mode .detail-label {
  color: #E84B8A;
}
.detail-value {
  font-size: 0.95rem;
  color: #E0E7FF;
  font-weight: 600;
  transition: color 0.3s ease;
  font-family: 'Fredoka', sans-serif;
}

body.light-mode .detail-value {
  color: #222;
}

.phrases-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
  animation: fade-in 1s ease 0.6s both;
}
.phrase {
  font-size: 1rem;
  color: #00D9FF;
  font-style: normal;
  font-family: 'Bungee', sans-serif;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(124,77,255,0.1), rgba(0,217,255,0.08));
  border: 2px solid #7C4DFF;
  border-radius: 20px;
  padding: 12px 16px;
  transform: rotate(-1deg);
}
.phrase:nth-child(2) {
  transform: rotate(1deg);
}

.countdown-section {
  margin: 24px 0;
  animation: fade-in 1s ease 0.7s both;
}
.countdown-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #A78BFA;
  margin-bottom: 12px;
  transition: color 0.3s ease;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
}

body.light-mode .countdown-label {
  color: #E84B8A;
}
.countdown-boxes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.countdown-box {
  background: linear-gradient(135deg, rgba(124,77,255,0.15), rgba(0,217,255,0.1));
  border: 2px solid #7C4DFF;
  border-radius: 16px;
  padding: 12px 6px;
  text-align: center;
  transition: all 0.3s ease;
}

.countdown-box:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(124,77,255,0.3);
}

body.light-mode .countdown-box {
  background: linear-gradient(135deg, rgba(255,159,229,0.15), rgba(255,230,100,0.12));
  border-color: #FF9FE5;
}
.countdown-number {
  font-family: 'Bungee', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #7C4DFF 0%, #00D9FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  transition: all 0.3s ease;
}

body.light-mode .countdown-number {
  background: linear-gradient(135deg, #E84B8A 0%, #50B348 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.countdown-unit {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7C4DFF;
  margin-top: 4px;
  transition: color 0.3s ease;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
}

body.light-mode .countdown-unit {
  color: #E84B8A;
}

.guest-greeting {
  font-size: 0.95rem;
  color: #7C4DFF;
  margin-top: 14px;
  margin-bottom: 12px;
  animation: fade-in 1s ease 0.5s both;
  transition: color 0.3s ease;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
}

body.light-mode .guest-greeting {
  color: #E84B8A;
}

.note-text {
  font-size: 0.9rem;
  color: #7C4DFF;
  font-style: normal;
  margin-top: 16px;
  animation: fade-in 1s ease 1s both;
  transition: color 0.3s ease;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
}

body.light-mode .note-text {
  color: #E84B8A;
}

.whatsapp-btn {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 36px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(37, 211, 102, 0.35);
  transition: all 0.2s ease;
  animation: fade-in 1s ease 0.8s both;
  width: 100%;
  text-decoration: none;
}
.whatsapp-btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 15px 40px rgba(37, 211, 102, 0.5);
}
.whatsapp-btn:active { transform: translateY(-1px); }

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,107,157,0.2), rgba(255,195,60,0.15));
  border: 2px solid #FF6B9D;
  color: #FF6B9D;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 6px 25px rgba(255,107,157,0.25);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 8px 35px rgba(255,107,157,0.35);
  background: linear-gradient(135deg, rgba(255,107,157,0.3), rgba(255,195,60,0.25));
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon-dark,
.theme-icon-light {
  position: absolute;
  width: 28px;
  height: 28px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon-dark {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-icon-light {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}

body.light-mode .theme-toggle {
  background: linear-gradient(135deg, rgba(255,159,229,0.2), rgba(255,230,100,0.15));
  border-color: #FF9FE5;
  color: #FF9FE5;
  box-shadow: 0 6px 25px rgba(255,159,229,0.25);
}

body.light-mode .theme-toggle:hover {
  box-shadow: 0 8px 35px rgba(255,159,229,0.35);
  background: linear-gradient(135deg, rgba(255,159,229,0.3), rgba(255,230,100,0.25));
}

body.light-mode .theme-icon-dark {
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}

body.light-mode .theme-icon-light {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (max-width: 480px) {
  .invitation-card { padding: 40px 24px; }
  .countdown-boxes { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .countdown-number { font-size: 1.4rem; }
  .theme-toggle {
    width: 44px;
    height: 44px;
    top: 16px;
    right: 16px;
  }
  .theme-icon-dark,
  .theme-icon-light {
    width: 20px;
    height: 20px;
  }
}

/* ========================================
   Estilos para invitados personalizados
   ======================================== */

/* Animación de entrada para el saludo personalizado */
.guest-greeting {
  opacity: 0;
  animation: slide-in-greeting 0.8s ease 0.3s forwards;
}

@keyframes slide-in-greeting {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estilos para invitación confirmada */
.invitation-card.confirmed {
  border-color: #25d366;
  box-shadow:
    0 0 0 12px rgba(37,211,102,0.15),
    0 12px 50px rgba(0,0,0,0.4),
    0 0 30px rgba(37,211,102,0.3);
  animation: pulse-confirmed 2s ease infinite;
}

@keyframes pulse-confirmed {
  0%, 100% {
    box-shadow:
      0 0 0 12px rgba(37,211,102,0.15),
      0 12px 50px rgba(0,0,0,0.4),
      0 0 30px rgba(37,211,102,0.3);
  }
  50% {
    box-shadow:
      0 0 0 16px rgba(37,211,102,0.2),
      0 12px 50px rgba(0,0,0,0.4),
      0 0 40px rgba(37,211,102,0.4);
  }
}

body.light-mode .invitation-card.confirmed {
  border-color: #25d366;
  box-shadow:
    0 0 0 12px rgba(37,211,102,0.15),
    0 12px 50px rgba(0,0,0,0.1),
    0 0 30px rgba(37,211,102,0.25);
}

/* Destacar el nombre del invitado */
.guest-greeting strong {
  background: linear-gradient(135deg, #7C4DFF 0%, #00D9FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.1em;
  font-weight: 700;
}

body.light-mode .guest-greeting strong {
  background: linear-gradient(135deg, #E84B8A 0%, #F5A623 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

