/* ==========================================================================
   Romantic Proposal Webpage - Stylesheet
   Theme: Soft Pink, White, Lavender, and Gold Accents
   Style: Glassmorphism, Premium Modern Web Design, Highly Animated
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design System & CSS Variables
   -------------------------------------------------------------------------- */
:root {
    --pink-light: hsl(340, 100%, 97%);
    --pink-mid: hsl(343, 90%, 82%);
    --pink-main: hsl(343, 100%, 72%);
    --pink-dark: hsl(340, 60%, 25%);
    --pink-hover: hsl(343, 95%, 65%);
    --pink-glow: rgba(255, 105, 180, 0.3);
    
    --lavender-light: hsl(260, 100%, 98%);
    --lavender-main: hsl(260, 60%, 75%);
    --lavender-dark: hsl(260, 40%, 35%);
    
    --gold-accent: hsl(45, 100%, 62%);
    --gold-glow: rgba(255, 215, 0, 0.4);
    
    --glass-bg: rgba(255, 255, 255, 0.42);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 20px 50px rgba(255, 150, 180, 0.18);
    --glass-shadow-inset: inset 0 0 12px rgba(255, 255, 255, 0.4);
    
    --transition-smooth: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    --transition-quick: all 0.2s ease-out;
    --transition-escape: top 0.4s cubic-bezier(0.25, 0.8, 0.25, 1.1), left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1.1);
}

/* --------------------------------------------------------------------------
   2. Reset & General Styles
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--pink-dark);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--pink-light);
    perspective: 1000px;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   3. Animated Background Gradient & Particles
   -------------------------------------------------------------------------- */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, 
        var(--pink-light) 0%, 
        var(--lavender-light) 30%, 
        hsl(330, 100%, 96%) 60%, 
        hsl(270, 100%, 96%) 100%
    );
    background-size: 400% 400%;
    z-index: -2;
    animation: gradMove 20s ease infinite;
}

@keyframes gradMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

/* Floating Hearts & Bubbles in background */
.particle-heart {
    position: absolute;
    bottom: -50px;
    pointer-events: none;
    color: var(--pink-mid);
    opacity: 0;
    will-change: transform, opacity;
    animation: rise var(--duration) linear infinite;
}

@keyframes rise {
    0% {
        transform: translateY(0) scale(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: var(--max-opacity);
    }
    90% {
        opacity: var(--max-opacity);
    }
    100% {
        transform: translateY(-110vh) scale(var(--scale)) rotate(var(--rot));
        opacity: 0;
    }
}

/* Sparkle trail elements */
.sparkle-particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: var(--gold-accent);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    pointer-events: none;
    z-index: 9999;
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 10px var(--gold-glow);
    animation: sparkleFade 0.8s forwards ease-out;
}

@keyframes sparkleFade {
    0% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.1) rotate(180deg);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   4. Floating Music Controls
   -------------------------------------------------------------------------- */
.floating-music-btn {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--glass-shadow);
    color: var(--pink-dark);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    overflow: hidden;
}

.floating-music-btn:hover {
    transform: scale(1.1) rotate(8deg);
    background: rgba(255, 255, 255, 0.6);
    border-color: var(--pink-main);
    box-shadow: 0 0 15px var(--pink-glow);
}

.music-wave-container {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    margin-left: 2px;
}

.music-wave-container .wave {
    width: 2px;
    background-color: var(--pink-main);
    border-radius: 2px;
    animation: bounce 0.8s ease-in-out infinite alternate;
}

.music-wave-container .wave1 { height: 100%; animation-delay: -0.2s; }
.music-wave-container .wave2 { height: 60%; animation-delay: 0s; }
.music-wave-container .wave3 { height: 80%; animation-delay: -0.4s; }

.floating-music-btn.playing #musicIcon {
    display: none;
}

.floating-music-btn.playing .music-wave-container {
    display: flex;
}

@keyframes bounce {
    0% { height: 3px; }
    100% { height: 14px; }
}

/* --------------------------------------------------------------------------
   5. Proposal Container & Card (Main UI)
   -------------------------------------------------------------------------- */
.proposal-container {
    position: relative;
    width: 90%;
    max-width: 520px;
    z-index: 10;
    opacity: 0;
    transform: translateY(30px);
    animation: cardEntrance 1.2s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animated glowing border behind card */
.card-glow-border {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 27px;
    background: linear-gradient(45deg, var(--pink-main), var(--lavender-main), var(--gold-accent), var(--pink-main));
    background-size: 300% 300%;
    z-index: -1;
    opacity: 0.55;
    filter: blur(8px);
    animation: flowGradient 6s linear infinite, glowBorder 3s ease-in-out infinite;
}

@keyframes flowGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes glowBorder {
    0% { opacity: 0.45; filter: blur(6px); }
    50% { opacity: 0.75; filter: blur(12px); }
    100% { opacity: 0.45; filter: blur(6px); }
}

/* The Glassmorphism Card */
.glass-card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 24px;
    padding: 3rem 2.2rem;
    box-shadow: var(--glass-shadow), var(--glass-shadow-inset);
    text-align: center;
    animation: float 6s ease-in-out infinite;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(0.5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* Heartbeat Title */
.heartbeat-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--pink-dark);
    letter-spacing: -0.5px;
    animation: heartbeat 2.2s infinite ease-in-out;
    transform-origin: center;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.04); }
    28% { transform: scale(1); }
    42% { transform: scale(1.04); }
    70% { transform: scale(1); }
}

/* Proposal Text Content */
#proposalText {
    font-size: 1.12rem;
    line-height: 1.7;
    color: var(--pink-dark);
    font-weight: 400;
    opacity: 0.95;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* --------------------------------------------------------------------------
   6. Buttons & Interactive Behavior
   -------------------------------------------------------------------------- */
.buttons-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.8rem;
    margin-top: 0.5rem;
    min-height: 60px;
    position: relative;
}

.btn {
    position: relative;
    padding: 1.1rem 2.6rem;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    overflow: hidden;
    outline: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Yes Button Styling */
.btn-yes {
    background: linear-gradient(135deg, var(--pink-main), var(--pink-hover));
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(255, 105, 180, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-yes:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 15px 30px rgba(255, 105, 180, 0.5);
    background: linear-gradient(135deg, var(--pink-hover), hsl(343, 100%, 58%));
}

.btn-yes:active {
    transform: translateY(-1px) scale(0.98);
}

/* No Button Styling */
.btn-no {
    background: linear-gradient(135deg, #ffffff, #f0e6eb);
    color: var(--pink-dark);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.04);
}

.btn-no.escaped {
    position: fixed;
    z-index: 1000;
    transition: var(--transition-escape);
}

.btn-no:hover {
    background: linear-gradient(135deg, #ffffff, #ffeaf4);
    box-shadow: 0 12px 25px rgba(255, 180, 200, 0.2);
}

/* Speech Bubble for escaping No button */
.speech-bubble {
    position: absolute;
    background: var(--pink-dark);
    color: #ffffff;
    padding: 0.65rem 1.1rem;
    border-radius: 16px;
    font-size: 0.92rem;
    font-weight: 500;
    width: max-content;
    max-width: 240px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    z-index: 1010;
    pointer-events: none;
    transform: translateY(-100%) scale(0);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    transform-origin: bottom center;
}

.speech-bubble.visible {
    transform: translateY(-120%) scale(1);
    opacity: 1;
}

.speech-bubble.hidden {
    display: none;
}

.bubble-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid var(--pink-dark);
}

/* Button Ripple Click Effect */
.ripple {
    position: absolute;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-effect 0.6s linear;
    pointer-events: none;
    z-index: 1;
}

@keyframes ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   7. Fullscreen Overlay (Success Screen)
   -------------------------------------------------------------------------- */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, 
        hsl(340, 100%, 98%) 0%, 
        hsl(340, 100%, 94%) 70%, 
        hsl(330, 100%, 91%) 100%
    );
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.215, 0.61, 0.355, 1), 
                visibility 0.8s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.fullscreen-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.fullscreen-overlay.hidden {
    display: none;
}

.success-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 3rem 2.2rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(255, 100, 150, 0.15), var(--glass-shadow-inset);
    transform: scale(0.85) translateY(20px);
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.15);
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.fullscreen-overlay.visible .success-content {
    transform: scale(1) translateY(0);
}

/* Success Message Title */
.success-title {
    font-family: 'Sacramento', cursive, sans-serif;
    font-size: 4rem;
    font-weight: 700;
    color: var(--pink-main);
    text-shadow: 0 2px 10px rgba(255, 105, 180, 0.25);
    line-height: 1.1;
}

.animated-yay {
    animation: yayBounce 1.5s infinite ease-in-out;
}

@keyframes yayBounce {
    0%, 100% { transform: scale(1) rotate(-2deg); }
    50% { transform: scale(1.1) rotate(2deg); }
}

/* Success Message body */
.success-message {
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--pink-dark);
}

/* Cute animated GIF styling */
.gif-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(255, 105, 180, 0.25);
    border: 4px solid #ffffff;
    background-color: #fff0f5;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gifPlaceholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

.gif-fallback-glowing-heart {
    position: absolute;
    font-size: 5.5rem;
    z-index: 1;
    animation: heartPulse 1.2s infinite ease-in-out;
}

@keyframes heartPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px var(--pink-main)); }
    50% { transform: scale(1.2); filter: drop-shadow(0 0 20px var(--pink-hover)); }
}

/* --------------------------------------------------------------------------
   8. Custom Top Popup Notification
   -------------------------------------------------------------------------- */
.toast-popup {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translate(-50%, -120px);
    width: 90%;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 18px;
    padding: 1.1rem 1.6rem;
    box-shadow: 0 15px 35px rgba(255, 120, 160, 0.16), var(--glass-shadow-inset);
    z-index: 10000;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.22);
}

.toast-popup.visible {
    transform: translate(-50%, 0);
}

.toast-popup.hidden {
    display: none;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--pink-dark);
}

.toast-icon {
    font-size: 1.3rem;
    animation: rotateSparkle 2s infinite linear;
}

@keyframes rotateSparkle {
    to { transform: rotate(360deg); }
}

#toastMessage {
    font-size: 0.98rem;
    font-weight: 500;
    flex-grow: 1;
    line-height: 1.4;
}

.close-toast-btn {
    background: none;
    border: none;
    color: var(--pink-dark);
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
    transition: var(--transition-quick);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-toast-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   9. Responsive Design & Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .glass-card {
        padding: 2.2rem 1.5rem;
        gap: 1.5rem;
    }

    .heartbeat-title {
        font-size: 1.5rem;
    }

    #proposalText {
        font-size: 1.02rem;
        line-height: 1.6;
    }

    .buttons-group {
        flex-direction: column;
        gap: 1rem;
        min-height: 140px;
    }

    .btn {
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1.08rem;
    }
    
    .floating-music-btn {
        top: 15px;
        right: 15px;
        width: 42px;
        height: 42px;
        font-size: 0.95rem;
    }
    
    .toast-popup {
        top: 15px;
    }

    .success-title {
        font-size: 3rem;
    }

    .success-content {
        padding: 2.2rem 1.5rem;
        gap: 1.4rem;
    }

    .gif-wrapper {
        width: 180px;
        height: 180px;
    }
}

/* Accessibility features */
@media (prefers-reduced-motion: reduce) {
    .bg-gradient,
    .particle-heart,
    .sparkle-particle,
    .glass-card,
    .heartbeat-title,
    .animated-yay,
    .wave {
        animation: none !important;
    }
    
    .btn, 
    .btn-no.escaped,
    .speech-bubble,
    .toast-popup,
    .fullscreen-overlay {
        transition: none !important;
    }
}
