/* ==========================================================================
   DEDICATION STYLES - FLORES AMARILLAS
   Diseño de alta fidelidad: Glassmorphism, resplandor dorado, tipografía de lujo
   y animaciones fluidas para la dedicatoria personalizada.
   ========================================================================== */

:root {
  --gold-primary: #ffd700;
  --gold-secondary: #ffb703;
  --gold-accent: #fff275;
  --gold-deep: #fb8500;
  --gold-glow: rgba(255, 215, 0, 0.45);
  --gold-glow-soft: rgba(255, 215, 0, 0.2);
  --glass-bg: rgba(6, 11, 25, 0.62);
  --glass-border: rgba(255, 215, 0, 0.32);
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 35px rgba(255, 183, 3, 0.18);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-cursive: 'Dancing Script', 'Brush Script MT', cursive;
  --font-sans: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-royal: 'Cinzel', serif;
}

/* Contenedor principal de la dedicatoria */
.dedication-card {
  position: fixed;
  top: 1.2vmin;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(92vw, 480px);
  padding: 10px 18px 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(190%);
  -webkit-backdrop-filter: blur(16px) saturate(190%);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow: var(--glass-shadow);
  text-align: center;
  color: #ffffff;
  pointer-events: auto;
  opacity: 0;
  animation: cardEntrance 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards,
             cardFloat 6s ease-in-out 2s infinite alternate;
  user-select: none;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.35s ease,
              width 0.35s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease,
              background 0.3s ease;
}

.dedication-card:hover {
  border-color: rgba(255, 215, 0, 0.55);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 35px rgba(255, 215, 0, 0.25);
}

/* Aura resplandeciente exterior */
.dedication-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110%;
  height: 110%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at center, rgba(255, 215, 0, 0.18) 0%, rgba(251, 133, 0, 0.08) 50%, transparent 75%);
  pointer-events: none;
  z-index: -1;
  filter: blur(20px);
  animation: pulseGlow 4s ease-in-out infinite alternate;
}

/* Destellos dorados flotantes */
.dedication-sparkles {
  position: absolute;
  inset: -10px;
  pointer-events: none;
  overflow: visible;
}

.sparkle {
  position: absolute;
  color: var(--gold-accent);
  font-size: 14px;
  opacity: 0;
  filter: drop-shadow(0 0 6px var(--gold-primary));
  animation: sparkleTwinkle 3s ease-in-out infinite;
}

.sparkle--1 { top: -6px; left: 12%; animation-delay: 0.2s; font-size: 16px; }
.sparkle--2 { top: 18%; right: -6px; animation-delay: 1.1s; font-size: 12px; }
.sparkle--3 { bottom: 12%; left: -8px; animation-delay: 2s; font-size: 15px; }
.sparkle--4 { bottom: -6px; right: 18%; animation-delay: 1.6s; font-size: 13px; }
.sparkle--5 { top: -8px; right: 28%; animation-delay: 2.5s; font-size: 14px; }

/* Barra superior con badge y botón de colapsar */
.dedication-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  transition: margin-bottom 0.3s ease;
}

.dedication-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  color: #fff9d6;
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.dedication-toggle-btn:hover {
  background: rgba(255, 215, 0, 0.28);
  border-color: var(--gold-primary);
  color: #ffffff;
  transform: scale(1.04);
}

.toggle-icon {
  font-size: 9px;
  transition: transform 0.35s ease;
  display: inline-block;
}

/* Contenido colapsable animado */
.dedication-collapsible {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
  transform-origin: top center;
  transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              transform 0.35s ease;
  overflow: hidden;
}

/* ESTADO COLAPSADO: Modo compacto que deja 100% libre la flor */
.dedication-card.is-collapsed {
  width: auto;
  max-width: min(92vw, 360px);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(6, 11, 28, 0.85);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.2);
  cursor: pointer;
}

.dedication-card.is-collapsed .dedication-header-bar {
  margin-bottom: 0;
  justify-content: center;
}

.dedication-card.is-collapsed .dedication-badge {
  margin-bottom: 0;
  padding: 0 4px;
  border: none;
  background: transparent;
  box-shadow: none;
}

.dedication-card.is-collapsed .dedication-collapsible {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.dedication-card.is-collapsed .toggle-icon {
  transform: rotate(180deg);
}

/* Badge superior */
.dedication-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  margin-bottom: 0;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.28);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold-accent);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.12);
  position: relative;
  transition: all 0.3s ease;
}

.badge-icon {
  font-size: 13px;
  animation: rotatePetal 6s linear infinite;
  display: inline-block;
}

.badge-text {
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.badge-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-primary);
  animation: dotPulse 1.8s infinite;
}

/* Saludo delicado */
.dedication-salutation {
  font-family: var(--font-cursive);
  font-size: 1.45rem;
  color: #fffae0;
  margin: 0 0 2px 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 240, 180, 0.3);
  letter-spacing: 0.5px;
}

/* Nombre del destinatario (protagonista visual) */
.dedication-name {
  font-family: var(--font-royal);
  font-size: clamp(1.8rem, 4.6vw, 2.7rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 6px 0;
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  display: inline-block;
}

.name-shimmer {
  background: linear-gradient(
    110deg,
    #ffffff 0%,
    #ffe169 22%,
    #ffb703 45%,
    #ffffff 60%,
    #ffc300 80%,
    #ffeaa7 100%
  );
  background-size: 240% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmerGold 5s linear infinite;
  display: inline-block;
  filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.6));
  transition: transform 0.3s ease;
}

.dedication-card:hover .name-shimmer {
  transform: scale(1.03);
}

/* Divisor ornamental */
.dedication-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px auto 10px;
  max-width: 280px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
}

.divider-gem {
  font-size: 12px;
  filter: drop-shadow(0 0 6px var(--gold-primary));
  animation: heartbeat 2.5s ease-in-out infinite;
}

/* Mensaje poético */
.dedication-message {
  font-family: var(--font-sans);
  font-size: clamp(0.85rem, 2vmin, 0.96rem);
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 auto 14px;
  max-width: 480px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.3px;
}

/* Botones de acción elegantes */
.dedication-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dedication-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: #fff8d6;
  cursor: pointer;
  outline: none;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.dedication-btn:hover {
  background: rgba(255, 215, 0, 0.22);
  border-color: rgba(255, 215, 0, 0.7);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.dedication-btn:active {
  transform: translateY(1px);
}

.btn-icon {
  font-size: 14px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.dedication-btn:hover .btn-icon {
  transform: scale(1.2);
}

/* Estado de música reproduciendo */
.dedication-btn--playing {
  background: rgba(255, 215, 0, 0.28);
  border-color: var(--gold-primary);
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
}

.dedication-btn--playing .btn-icon {
  animation: musicBounce 1s infinite alternate ease-in-out;
}

/* ==========================================================================
   MODAL DE CARTA ROMÁNTICA (Centrado perfecto en móviles y desktop)
   ========================================================================== */
.letter-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.letter-modal.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.letter-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.letter-modal__content {
  position: relative;
  width: min(92vw, 480px);
  max-height: calc(100dvh - 36px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(160deg, rgba(16, 21, 46, 0.97) 0%, rgba(6, 9, 26, 0.99) 100%);
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 24px;
  padding: 30px 22px 22px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.92), 0 0 45px rgba(255, 215, 0, 0.25);
  transform: scale(0.92) translateY(0);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  color: #f7f7f7;
  margin: auto;
  box-sizing: border-box;
}

.letter-modal__content::-webkit-scrollbar {
  width: 5px;
}
.letter-modal__content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  margin: 12px 0;
}
.letter-modal__content::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.4);
  border-radius: 999px;
}

.letter-modal.is-active .letter-modal__content {
  transform: scale(1) translateY(0);
}

.letter-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  z-index: 10;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.letter-modal__close:hover,
.letter-modal__close:active {
  background: rgba(255, 215, 0, 0.25);
  color: #ffffff;
  border-color: var(--gold-primary);
  transform: scale(1.08);
}

.letter-seal {
  font-size: 38px;
  display: inline-block;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 14px var(--gold-primary));
  animation: pulseGlow 2.5s ease-in-out infinite alternate;
}

.letter-modal__title {
  font-family: var(--font-cursive);
  font-size: 2rem;
  color: #fff3a8;
  margin-bottom: 16px;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.letter-modal__name {
  font-family: var(--font-royal);
  font-size: 1.7rem;
  color: var(--gold-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.letter-modal__body {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 20px;
}

.letter-paragraph {
  margin-bottom: 12px;
}

.letter-highlight {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--gold-accent);
  padding: 10px 16px;
  border-left: 2px solid var(--gold-primary);
  border-right: 2px solid var(--gold-primary);
  background: rgba(255, 215, 0, 0.06);
  border-radius: 8px;
  margin: 16px 0;
}

.letter-signature {
  font-family: var(--font-cursive);
  font-size: 1.5rem;
  color: var(--gold-secondary);
}

/* ==========================================================================
   ANIMACIONES CLAVE (KEYFRAMES)
   ========================================================================== */
@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes cardFloat {
  0% {
    transform: translate(-50%, 0);
  }
  100% {
    transform: translate(-50%, -6px);
  }
}

@keyframes shimmerGold {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 240% center;
  }
}

@keyframes pulseGlow {
  0% {
    opacity: 0.6;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes sparkleTwinkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.2) rotate(45deg);
  }
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.4);
    opacity: 1;
  }
}

@keyframes rotatePetal {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

@keyframes musicBounce {
  0% {
    transform: scale(1) rotate(-8deg);
  }
  100% {
    transform: scale(1.25) rotate(12deg);
  }
}

/* ==========================================================================
   RESPONSIVIDAD Y DISPOSITIVOS MÓVILES
   ========================================================================== */
@media (max-width: 600px) {
  .dedication-card {
    top: 1vmin;
    width: 95vw;
    padding: 8px 12px 10px;
    border-radius: 18px;
  }

  .dedication-card.is-collapsed {
    padding: 4px 10px;
    max-width: 88vw;
  }

  .dedication-badge {
    padding: 2px 8px;
    font-size: 9px;
    letter-spacing: 0.5px;
    margin-bottom: 0;
  }

  .dedication-toggle-btn {
    padding: 2px 8px;
    font-size: 9.5px;
  }

  .dedication-salutation {
    font-size: 1.15rem;
    margin-bottom: 0;
  }

  .dedication-name {
    font-size: 1.55rem;
    letter-spacing: 1px;
    margin-bottom: 2px;
  }

  .dedication-divider {
    margin: 4px auto 6px;
  }

  .dedication-message {
    font-size: 0.8rem;
    line-height: 1.35;
    margin-bottom: 8px;
  }

  .dedication-actions {
    gap: 8px;
  }

  .dedication-btn {
    padding: 5px 12px;
    font-size: 10.5px;
  }

  .letter-modal {
    padding: 12px;
  }

  .letter-modal__content {
    width: 95vw;
    max-height: calc(100dvh - 24px);
    max-height: calc(100vh - 24px);
    padding: 24px 16px 18px;
    border-radius: 20px;
  }

  .letter-seal {
    font-size: 32px;
    margin-bottom: 4px;
  }

  .letter-modal__title {
    font-size: 1.5rem;
    margin-bottom: 10px;
  }

  .letter-modal__name {
    font-size: 1.3rem;
  }

  .letter-modal__body {
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 12px;
  }

  .letter-highlight {
    font-size: 0.95rem;
    padding: 8px 12px;
    margin: 12px 0;
  }

  .letter-signature {
    font-size: 1.35rem;
  }
}

/* Si la pantalla es muy baja en altura (landscape móvil o pantallas estrechas) */
@media (max-height: 650px) {
  .dedication-card {
    padding: 8px 16px 8px;
    top: 1vmin;
  }

  .dedication-salutation {
    font-size: 1.1rem;
    margin: 0;
  }

  .dedication-name {
    font-size: 1.5rem;
    margin: 0;
  }

  .dedication-divider,
  .dedication-message {
    display: none;
  }
}
