/* Custom Premium Design System for Confession Website */

:root {
    --bg-primary: #fff0f3;
    --bg-secondary: #ffccd5;
    --accent: #ff4d6d;
    --accent-hover: #ff758f;
    --accent-light: #ffe5ec;
    --text-main: #4a373b;
    --text-muted: #857074;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 182, 193, 0.5);
    --shadow-sm: 0 4px 6px rgba(255, 77, 109, 0.08);
    --shadow-md: 0 10px 25px rgba(255, 77, 109, 0.15);
    --shadow-lg: 0 20px 40px rgba(255, 77, 109, 0.25);
    --font-heading: 'Pacifico', cursive;
    --font-body: 'Quicksand', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* Floating Hearts Background */
.hearts-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    bottom: -50px;
    font-size: 24px;
    color: var(--accent);
    opacity: 0.6;
    animation: floatUp 8s linear infinite;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-110vh) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 520px;
    z-index: 10;
    position: relative;
}

.hidden {
    display: none !important;
}

/* General Stage Styles */
.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card layout - Glassmorphism */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid var(--card-border);
    border-radius: 32px;
    padding: 40px 30px;
    text-align: center;
    width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Envelope Container and Elements */
.confession-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--accent);
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 77, 109, 0.15);
}

.envelope-wrapper {
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    perspective: 1000px;
}

.envelope {
    position: relative;
    width: 280px;
    height: 180px;
    background-color: #ffb3c1;
    border-radius: 0 0 16px 16px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.6s ease, background-color 0.6s ease, box-shadow 0.6s ease;
}

.envelope:hover {
    transform: translateY(-8px) rotate(-1deg);
}

.envelope.open {
    transform: translateY(50px);
}

/* Flap (Nắp thư) */
.flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 140px solid transparent;
    border-right: 140px solid transparent;
    border-top: 100px solid #ff85a1;
    border-radius: 16px 16px 0 0;
    transform-origin: top;
    transition: transform 0.5s ease-in-out, z-index 0.2s ease 0.3s, opacity 0.6s ease, transform 0.6s ease;
    z-index: 4;
}

.envelope.open .flap {
    transform: rotateX(180deg);
    z-index: 1;
}

/* Pocket (Thân thư phía trước) */
.pocket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 280px;
    height: 110px;
    background-color: #ff99ac;
    border-radius: 0 0 16px 16px;
    z-index: 3;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.pocket::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 140px solid transparent;
    border-right: 140px solid transparent;
    border-bottom: 95px solid #ffa5b6;
    border-radius: 0 0 16px 16px;
    z-index: 3;
}

/* Letter inside */
.letter {
    position: absolute;
    bottom: 10px;
    left: 15px;
    width: 250px;
    height: 100px; /* shorter when closed to fit inside the pocket */
    background-color: #fffdf9;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.1) 0.3s, 
                height 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.1) 0.3s;
    z-index: 2;
    overflow: hidden;
}

.envelope.open .letter {
    transform: translateY(-120px) scale(1.05);
    height: 180px; /* expands when opened to reveal full text */
    box-shadow: var(--shadow-md);
}



.letter-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-main);
    text-align: left;
}

.letter-text p {
    margin-bottom: 8px;
}

.letter-text .highlight {
    font-family: var(--font-heading);
    color: var(--accent);
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

/* Buttons Styling */
.btn {
    font-family: var(--font-body);
    font-weight: 700;
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #ff758f 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, #ff758f 0%, var(--accent) 100%);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.02);
}

.btn-yes {
    background: linear-gradient(135deg, #2ec4b6 0%, #20a497 100%);
    color: white;
}

.btn-yes:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 10px 20px rgba(46, 196, 182, 0.3);
}

.btn-no {
    background-color: #e5e5e5;
    color: #6c757d;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease, left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15), top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.btn-fade-out {
    opacity: 0 !important;
    transform: scale(0.7) !important;
    pointer-events: none !important;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes buttonShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px) rotate(-1deg); }
    75% { transform: translateX(8px) rotate(1deg); }
}

.btn-shake {
    animation: buttonShake 0.3s ease-in-out;
}

.btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    min-height: 80px; /* To prevent jumping elements when button flees */
    position: relative;
    width: 100%;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.btn-secondary {
    background-color: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-secondary:hover {
    background-color: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* Confession Card typography */
.main-question {
    font-size: 1.6rem;
    line-height: 1.4;
    color: var(--text-main);
    margin-top: 15px;
    margin-bottom: 12px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.avatar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.cute-couple-svg, .calendar-svg-icon, .cute-animated-love {
    width: 120px;
    height: 120px;
}

/* SVGs Animations */
.heart-pulse-svg {
    animation: heartPulse 1.2s infinite;
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.12); }
    60% { transform: scale(1); }
    80% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.pulsing-heart {
    transform-origin: 24px 24px;
    animation: heartPulseMini 1s infinite alternate;
}

@keyframes heartPulseMini {
    from { transform: translate(48px, 25px) scale(0.7); }
    to { transform: translate(48px, 25px) scale(0.9); }
}

/* Date Selection Styles */
.title-love {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 15px;
}

.prompt-text {
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 25px;
}

.date-selector-wrapper {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.cute-date-input {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 12px 20px;
    border: 2px solid var(--accent-light);
    border-radius: 16px;
    background-color: white;
    color: var(--text-main);
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
}

.cute-date-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(255, 77, 109, 0.2);
}

.btn-sparkle {
    position: relative;
    overflow: hidden;
}

/* Stage 4: Success Details */
.success-card {
    border-color: rgba(46, 196, 182, 0.2);
}

.font-handwritten {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: var(--accent);
}

.message-box {
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    border: 1px dashed var(--accent-light);
}

.final-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.date-highlight {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    background-color: var(--accent-light);
    padding: 8px 16px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 77, 109, 0.2);
}

.note-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.fallback-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 15px;
    margin-bottom: 5px;
}

/* Confetti Canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99;
}

/* Slideshow memory styles */
.slideshow-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.slideshow-container {
    width: 100%;
    height: 380px;
    border-radius: 16px;
    overflow: hidden;
}

.slideshow-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.slideshow-img:hover {
    transform: scale(1.03);
}

.slideshow-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--accent);
    margin-top: 10px;
    margin-bottom: 5px;
}

.slideshow-desc {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 15px;
    padding: 0 10px;
}

.slideshow-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.dot.active {
    background-color: var(--accent);
    opacity: 1;
    transform: scale(1.2);
}

/* Smooth fade transition for slideshow card content changes */
.fade-out-slide {
    opacity: 0;
    transform: scale(0.98);
}

/* Responsive Tweaks */
@media (max-width: 480px) {
    .slideshow-container {
        height: 320px;
    }

    .card {
        padding: 30px 20px;
        border-radius: 24px;
    }
    
    .confession-title {
        font-size: 1.5rem;
    }
    
    .main-question {
        font-size: 1.35rem;
    }
    
    .envelope-wrapper {
        height: 240px;
    }
    
    .envelope {
        width: 250px;
        height: 160px;
    }
    
    .flap {
        border-left: 125px solid transparent;
        border-right: 125px solid transparent;
        border-top: 90px solid #ff85a1;
    }
    
    .pocket {
        width: 250px;
        height: 100px;
    }
    
    .pocket::after {
        border-left: 125px solid transparent;
        border-right: 125px solid transparent;
        border-bottom: 85px solid #ffa5b6;
    }
    
    .letter {
        width: 220px;
        height: 90px; /* shorter when closed to fit mobile pocket */
        left: 15px;
    }
    
    .envelope.open .letter {
        transform: translateY(-100px) scale(1.05);
        height: 155px; /* expands when opened */
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
    
    .btn-yes:hover {
        transform: translateY(-2px) scale(1.05);
    }
}
