/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Montserrat', sans-serif;
    overflow: hidden;
    background: #FFF5E6;
    height: 100vh;
    width: 100vw;
    position: relative;
    touch-action: none;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Loading Screen */
#loading-screen {
    background: #FFF5E6;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    color: #8B5E3C;
}

.flower-loader {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 3px solid #FFE4E1;
    border-top-color: #FFB6C1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-content p {
    font-size: 16px;
    color: #8B5E3C;
    opacity: 0.8;
}

/* Envelope Styles */
#envelope-container {
    background: linear-gradient(180deg, #FFF5E6 0%, #FFE4D6 100%);
    z-index: 100;
}

.envelope {
    position: relative;
    width: 320px;
    height: 200px;
    cursor: pointer;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.envelope-body {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #FFFFFF 0%, #FFF8F0 100%);
    border-radius: 8px;
    box-shadow: 
        0 10px 30px rgba(139, 94, 60, 0.15),
        0 1px 2px rgba(139, 94, 60, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    transform-origin: top center;
    transform: rotateX(0deg);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
}

.envelope-flap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 160px solid transparent;
    border-right: 160px solid transparent;
    border-top: 100px solid #FFF8F0;
    filter: drop-shadow(0 -2px 4px rgba(139, 94, 60, 0.1));
}

.envelope.opened .envelope-flap {
    transform: rotateX(-170deg);
}

.envelope-content {
    text-align: center;
    padding: 20px;
}

.envelope-greeting {
    font-family: 'Dancing Script', cursive;
    font-size: 24px;
    color: #8B5E3C;
    margin-bottom: 5px;
}

.guest-name-display {
    font-family: 'Dancing Script', cursive;
    font-size: 32px;
    font-weight: 700;
    color: #6C6D2F;
    margin-bottom: 15px;
}

.envelope-hint {
    font-size: 14px;
    color: #8B5E3C;
    opacity: 0.7;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Cards Container */
#cards-container {
    background: transparent;
    z-index: 50;
}

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.active {
    opacity: 1;
    transform: translateX(0);
}

.card.prev {
    transform: translateX(-100%);
}

.card-content {
    position: relative;
    width: 90%;
    max-width: 380px;
    aspect-ratio: 9/16;
    background: #FFFFFF;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 20px 40px rgba(139, 94, 60, 0.2),
        0 2px 8px rgba(139, 94, 60, 0.1);
}

.card-content video,
.card-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* RSVP Overlay */
.rsvp-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
}

.guest-name-rsvp {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    font-size: 32px;
    color: #6C6D2F;
    margin-bottom: 60px;
    transform: translateY(-10px);
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
}

.rsvp-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    font-size: 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
}

.rsvp-option {
    position: relative;
    cursor: pointer;
    padding: 12px 20px;
    color: #312E2A;
    transition: all 0.3s ease;
}

.rsvp-option span {
    position: relative;
    z-index: 2;
}

.rsvp-option .marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    object-fit: contain;
    pointer-events: none;
}

.rsvp-option.selected .marker {
    opacity: 1;
}

.rsvp-separator {
    color: #312E2A;
    opacity: 0.5;
}

/* Thank You Overlay (Card 4) */
.thank-you-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    z-index: 10;
}

.thank-you-message {
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

.thank-you-flowers {
    margin-bottom: 20px;
}

.thank-you-flowers .flower {
    display: inline-block;
    font-size: 40px;
    margin: 0 10px;
    animation: float 3s ease-in-out infinite;
}

.thank-you-flowers .flower:nth-child(2) {
    animation-delay: 0.5s;
}

.thank-you-flowers .flower:nth-child(3) {
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

.thank-you-message h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 48px;
    color: #FFB6C1;
    margin-bottom: 10px;
}

.thank-you-message p {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    color: #8B5E3C;
    margin-bottom: 30px;
}

.maps-button {
    background: linear-gradient(135deg, #6C6D2F 0%, #8B5E3C 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Montserrat', sans-serif;
    box-shadow: 
        0 8px 32px rgba(108, 109, 47, 0.3),
        0 2px 8px rgba(108, 109, 47, 0.2);
    position: relative;
    overflow: hidden;
}

.maps-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.maps-button:hover::before {
    left: 100%;
}

.maps-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 12px 40px rgba(108, 109, 47, 0.4),
        0 4px 16px rgba(108, 109, 47, 0.3);
}

.maps-button:active {
    transform: translateY(-1px) scale(1.02);
}

.maps-button span {
    display: inline-block;
    margin-right: 8px;
    font-size: 18px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Swipe hint */
.swipe-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    color: #8B5E3C;
    box-shadow: 0 4px 10px rgba(139, 94, 60, 0.1);
    animation: swipeHint 2s infinite;
    white-space: nowrap;
    max-width: 90%;
}

@keyframes swipeHint {
    0%, 100% { transform: translateX(-50%) translateX(0); }
    50% { transform: translateX(-50%) translateX(-5px); }
}

/* Touch feedback */
.card.dragging .card-content {
    transition: none;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .envelope {
        width: 280px;
        height: 180px;
    }
    
    .envelope-flap::after {
        border-left-width: 140px;
        border-right-width: 140px;
        border-top-width: 85px;
    }
    
    .guest-name-display {
        font-size: 22px;
    }
    
    .guest-name-rsvp {
        font-size: 28px;
    }
    
    .rsvp-options {
        font-size: 18px;
    }
    
    .thank-you-message h2 {
        font-size: 40px;
    }
}

@media (max-height: 700px) {
    .card-content {
        width: 85%;
    }
}

/* Footer Flowers Background (behind cards) */
.footer-flowers-bg {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: -20px;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    z-index: 30; /* Behind envelope (100) and cards (50) */
    height: 140px;
    pointer-events: none;
}

.footer-flower {
    width: 120px; /* Larger for more impact */
    height: auto;
    opacity: 0.2;
    filter: grayscale(40%);
    margin: 0 -25px; /* More overlap */
}

.footer-flower:nth-child(1) {
    transform: translateY(20px) scale(0.8) rotate(-10deg);
}

.footer-flower:nth-child(2) {
    transform: translateY(-10px) scale(1.2) rotate(5deg);
}

.footer-flower:nth-child(3) {
    transform: translateY(30px) scale(0.9) rotate(-5deg);
}

.footer-flower:nth-child(4) {
    transform: translateY(-20px) scale(1.1) rotate(10deg);
}

.footer-flower:nth-child(5) {
    transform: translateY(15px) scale(0.85) rotate(-8deg);
}

.footer-flower:nth-child(6) {
    transform: translateY(-15px) scale(1.15) rotate(7deg);
}

.footer-flower:nth-child(7) {
    transform: translateY(25px) scale(0.95) rotate(-3deg);
}

.footer-flower:nth-child(8) {
    transform: translateY(-25px) scale(1.05) rotate(12deg);
}

.footer-flower:nth-child(9) {
    transform: translateY(10px) scale(0.9) rotate(-6deg);
}

/* Footer Text Container (on top) */
.footer-text-container {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1001; /* Above everything */
    pointer-events: none;
}

.footer-text {
    display: inline-block;
    font-size: 12px;
    color: #8B5E3C;
    font-family: 'Montserrat', sans-serif;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    pointer-events: all;
    box-shadow: 0 2px 8px rgba(139, 115, 85, 0.15);
    white-space: nowrap;
}

/* Music Toggle Button */
.music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(139, 115, 85, 0.2);
    cursor: pointer;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(139, 115, 85, 0.15);
}

.music-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(139, 115, 85, 0.2);
}

.music-toggle .music-on,
.music-toggle .music-off {
    display: none;
}

.music-toggle.playing .music-on {
    display: block;
}

.music-toggle:not(.playing) .music-off {
    display: block;
}

/* Notebook Style Card 4 */
.notebook-background {
    position: relative;
    width: 100%;
    height: 100%;
    background: #FAF4EA;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.notebook-content {
    position: relative;
    width: 85%;
    max-width: 320px;
    text-align: center;
    z-index: 10;
}

.notebook-flower-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background-image: url('assets/flowers/6.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    filter: grayscale(100%);
    z-index: 1;
}

.thank-you-title {
    font-family: 'Caveat', cursive;
    font-size: 42px;
    font-weight: 400;
    color: #8B7355;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(139, 115, 85, 0.1);
    letter-spacing: 1px;
}

.notebook-lines {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    height: 200px;
    pointer-events: none;
    z-index: 1;
}

.notebook-lines .line {
    width: 100%;
    height: 1px;
    background: rgba(139, 115, 85, 0.15);
    margin-bottom: 25px;
    position: relative;
}

.notebook-lines .line::before {
    content: '';
    position: absolute;
    left: -20px;
    top: -1px;
    width: 3px;
    height: 3px;
    background: rgba(139, 115, 85, 0.3);
    border-radius: 50%;
}

.wishes-section {
    margin: 40px 0 25px;
    position: relative;
    z-index: 5;
}

.wishes-textarea {
    width: 100%;
    height: 100px;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Caveat', cursive;
    font-size: 18px;
    font-weight: 400;
    color: #6B5B4A;
    line-height: 25px;
    padding: 10px 15px;
    resize: none;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wishes-textarea::placeholder {
    color: rgba(107, 91, 74, 0.4);
    font-style: italic;
}

.submit-wishes-btn {
    background: rgba(139, 115, 85, 0.1);
    color: #8B7355;
    border: 2px solid rgba(139, 115, 85, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    font-family: 'Caveat', cursive;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    letter-spacing: 0.5px;
}

.submit-wishes-btn:hover {
    background: rgba(139, 115, 85, 0.15);
    border-color: rgba(139, 115, 85, 0.3);
    transform: translateY(-1px);
}

.submit-wishes-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.location-section {
    margin-top: 15px;
}

.elegant-location-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(139, 115, 85, 0.2);
    color: #8B7355;
    padding: 12px 24px;
    border-radius: 25px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(139, 115, 85, 0.1);
}

.elegant-location-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(139, 115, 85, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 115, 85, 0.15);
}

.location-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}