/* ============================================
   GLOBAL STYLES & RESET
============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Playfair Display', serif;
    overflow-x: hidden;
    background: linear-gradient(135deg, #ffeef8 0%, #ffe5f1 50%, #ffd4e5 100%);
    min-height: 100vh;
    position: relative;
}

/* Floating heart particles background animation */
.hearts-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.heart-particle {
    position: absolute;
    font-size: 20px;
    opacity: 0;
    animation: floatHeart 8s infinite;
}

@keyframes floatHeart {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ============================================
   PAGE CONTAINER & TRANSITIONS
============================================ */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1;
}

.page.active {
    opacity: 1;
    transform: translateX(0);
}

.page.exit-left {
    opacity: 0;
    transform: translateX(-100%);
}

/* ============================================
   PAGE 1 - NAME VALIDATION
============================================ */
.name-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 40px 30px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(255, 105, 180, 0.3);
    max-width: 400px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.page-title {
    font-family: 'Great Vibes', cursive;
    font-size: 2.5rem;
    color: #ff6b9d;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(255, 107, 157, 0.3);
}

.input-group {
    margin-bottom: 25px;
}

.input-label {
    display: block;
    font-size: 1rem;
    color: #ff6b9d;
    margin-bottom: 8px;
    font-weight: 600;
}

.romantic-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ffc0cb;
    border-radius: 15px;
    font-size: 1rem;
    font-family: 'Playfair Display', serif;
    background: #fff;
    transition: all 0.3s ease;
    outline: none;
}

.romantic-input:focus {
    border-color: #ff6b9d;
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.3);
    transform: translateY(-2px);
}

.romantic-input::placeholder {
    color: #ffb3d9;
    font-style: italic;
}

.error-message {
    color: #ff4757;
    font-size: 0.9rem;
    margin-top: 10px;
    text-align: center;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ff6b9d, #ffa6c9);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1.2rem;
    font-family: 'Dancing Script', cursive;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
}

.submit-btn:active {
    transform: scale(0.95);
}

.submit-btn:hover {
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.6);
    transform: translateY(-3px);
}

/* Heart animation for successful validation */
.heart-burst {
    position: fixed;
    top: 50%;
    left: 50%;
    font-size: 80px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    z-index: 1000;
}

.heart-burst.animate {
    animation: heartBurst 1s ease-out;
}

@keyframes heartBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2) rotate(360deg);
    }
}

/* ============================================
   PAGE 2 - DATE & TIME
============================================ */
.datetime-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 400px;
    width: 100%;
}

.datetime-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 30px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(255, 107, 157, 0.3);
    animation: gentleGlow 3s ease-in-out infinite;
}

@keyframes gentleGlow {
    0%, 100% {
        box-shadow: 0 15px 50px rgba(255, 107, 157, 0.3);
    }
    50% {
        box-shadow: 0 15px 60px rgba(255, 107, 157, 0.5);
    }
}

.datetime-label {
    font-family: 'Dancing Script', cursive;
    font-size: 1.5rem;
    color: #ff6b9d;
    margin-bottom: 15px;
}

.datetime-value {
    font-size: 2rem;
    color: #ff4081;
    font-weight: 600;
    letter-spacing: 2px;
}

.next-btn {
    padding: 15px 50px;
    background: linear-gradient(135deg, #ff6b9d, #ffa6c9);
    border: none;
    border-radius: 30px;
    color: white;
    font-size: 1.3rem;
    font-family: 'Dancing Script', cursive;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInButton 0.6s ease forwards 1s;
}

@keyframes fadeInButton {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.next-btn:active {
    transform: scale(0.95);
}

/* ============================================
   PAGE 3 - VINTAGE LETTER
============================================ */
.letter-container {
    max-width: 400px;
    width: 100%;
    perspective: 1000px;
}

.envelope {
    width: 100%;
    height: 300px;
    position: relative;
    background: #f4e8d8;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(139, 69, 19, 0.3);
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: #e8d5be;
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    transform-origin: top center;
    transition: transform 1s ease;
    z-index: 2;
}

.envelope.open .envelope-flap {
    transform: rotateX(-180deg);
}

.letter-paper {
    position: absolute;
    top: 50px;
    left: 10%;
    width: 80%;
    background: #faf8f3;
    padding: 30px 20px;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(0);
    transition: transform 1s ease 0.5s;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.envelope.open .letter-paper {
    transform: translateY(-80px);
    max-height: 500px;
    opacity: 1;
}

.letter-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #4a4a4a;
    font-family: 'Playfair Display', serif;
    opacity: 0;
}

.letter-text.typing {
    animation: fadeInText 2s ease forwards 1.5s;
}

@keyframes fadeInText {
    to {
        opacity: 1;
    }
}

/* ============================================
   PAGE 4 - ANIMATED NOTEBOOK
============================================ */
.notebook-container {
    max-width: 380px;
    width: 100%;
}

.notebook {
    background: #8b4513;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
}

.notebook-cover {
    background: linear-gradient(135deg, #d4a574, #b8956f);
    padding: 50px 30px;
    border-radius: 5px;
    text-align: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;

}

.notebook-title {
    font-family: 'Great Vibes', cursive;
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.notebook-cover.flip {
    transform: rotateY(-180deg);
    opacity: 0;
}

.notebook-page {
    background: #fffef7;
    padding: 50px 30px;
    border-radius: 5px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 20px;
    opacity: 0;
    transform: translateX(40px);
    transition: transform 1.2s ease-out, opacity 1.2s ease-out;
    will-change: transform, opacity;
}


.notebook-page.active {
    opacity: 1;
    transform: translateX(0);
}


.notebook-page.flip-out {
    opacity: 0;
    transform: translateX(-40px);
}


.page-text {
    font-size: 1.1rem;
    line-height: 2;
    color: #4a4a4a;
    text-align: center;
    font-family: 'Dancing Script', cursive;
}

/* ============================================
   PAGE 5 - PROPOSAL POPUP
============================================ */
.blur-background {
    backdrop-filter: blur(10px);
    background: rgba(255, 182, 193, 0.3);
}

.proposal-popup {
    background: white;
    padding: 50px 40px;
    border-radius: 30px;
    box-shadow: 0 30px 80px rgba(255, 107, 157, 0.5);
    text-align: center;
    max-width: 350px;
    width: 90%;
    animation: popupAppear 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popupAppear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.proposal-popup.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.proposal-question {
    font-family: 'Great Vibes', cursive;
    font-size: 2.5rem;
    color: #ff6b9d;
    margin-bottom: 40px;
}

.proposal-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.proposal-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 25px;
    font-size: 1.2rem;
    font-family: 'Dancing Script', cursive;
    cursor: pointer;
    transition: all 0.3s ease;
}

.yes-btn {
    background: linear-gradient(135deg, #ff6b9d, #ffa6c9);
    color: white;
    box-shadow: 0 10px 30px rgba(255, 107, 157, 0.4);
}

.yes-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(255, 107, 157, 0.6);
}

.no-btn {
    background: #f0f0f0;
    color: #888;
}

/* Final celebration screen */
.celebration {
    display: none;
    text-align: center;
    animation: celebrationAppear 1s ease;
}

@keyframes celebrationAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.celebration-text {
    font-family: 'Apple chancery', cursive;
    font-size: 2.5rem;
    color: #ff6b9d;
    text-shadow: 0 0 20px rgba(255, 107, 157, 0.6);
    animation: glow 2s ease-in-out infinite;
    line-height: 1.5;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 107, 157, 0.6);
    }
    50% {
        text-shadow: 0 0 40px rgba(255, 107, 157, 1);
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #ff6b9d;
    position: absolute;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Sound toggle button */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ff6b9d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
}

/* Responsive adjustments */
@media (max-width: 400px) {
    .page-title {
        font-size: 2rem;
    }
    
    .datetime-value {
        font-size: 1.5rem;
    }
    
    .proposal-question {
        font-size: 2rem;
    }
    
    .celebration-text {
        font-size: 2rem;
    }
}