/* Custom Styles for Wedding Landing Page */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

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

.fade-in {
    animation: fadeIn 0.8s ease-out;
}

/* Hero section overlay */
.hero-overlay {
    background: linear-gradient(
        rgba(255, 255, 255, 0.7),
        rgba(255, 255, 255, 0.9)
    );
}

/* Flash message auto-hide animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.flash-message {
    animation: slideIn 0.5s ease-out;
}

.flash-message.hiding {
    animation: slideOut 1.5s ease-out;
}

/* Custom button hover effects */
.btn-wedding {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-wedding::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-wedding:hover::before {
    width: 300px;
    height: 300px;
}

/* Gallery hover effects */
.gallery-item {
    position: relative;
    overflow: hidden;
}

.gallery-item img {
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Form focus states */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8b7355;
}

/* Loading animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #d4af37;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* Countdown Timer Animations */
@keyframes countdownAppear {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes flipNumber {
    0% {
        transform: rotateX(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateX(90deg);
        opacity: 0.3;
    }
    100% {
        transform: rotateX(0deg);
        opacity: 1;
    }
}

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

/* Countdown box styling */
.countdown-box {
    opacity: 0;
    animation: countdownAppear 10.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 2.3s ease, box-shadow 0.3s ease;
}

/* Target countdown boxes accounting for separator divs in between */
.countdown-box:nth-child(1) {
    animation-delay: 0ms;
}

.countdown-box:nth-child(3) {
    animation-delay: 400ms;
}

.countdown-box:nth-child(5) {
    animation-delay: 800ms;
}

.countdown-box:nth-child(7) {
    animation-delay: 1200ms;
}

.countdown-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Number transition effect */
.countdown-number {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.countdown-number.flip {
    animation: flipNumber 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Separator styling */
.countdown-separator {
    width: 2px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, rgba(212, 175, 55, 0.3), transparent);
    margin: 0 0.5rem;
}

/* Enhanced countdown container */
.countdown-container {
    perspective: 1000px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .countdown-item {
        min-width: 60px;
        padding: 0.5rem;
    }

    .countdown-number {
        font-size: 1.5rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none;
    }
}

/* ============================================
   TABLE OF CONTENTS CARD STYLES
   ============================================ */

/* TOC Card Container */
.toc-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.5rem;
    background: white;
    border: 2px solid #f5f5dc;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.toc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), rgba(139, 115, 85, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.toc-card:hover::before {
    opacity: 1;
}

.toc-card:hover {
    border-color: #d4af37;
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Icon Wrapper */
.toc-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f5f5dc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.toc-card:hover .toc-icon-wrapper {
    background: #d4af37;
    transform: scale(1.1) rotate(5deg);
}

.toc-card:hover .toc-icon-wrapper.bg-wedding-primary {
    background: #8b7355;
}

/* Icon SVG */
.toc-icon {
    width: 40px;
    height: 40px;
    color: #d4af37;
    transition: all 0.3s ease;
}

.toc-card:hover .toc-icon {
    color: white;
}

.toc-icon.text-white {
    color: white;
}

.toc-card:hover .toc-icon.text-white {
    transform: scale(1.1);
}

/* Icon Image (for custom uploaded icons) */
.toc-icon-image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.toc-card:hover .toc-icon-image {
    transform: scale(1.1);
}

/* Card Title */
.toc-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #8b7355;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.toc-card:hover .toc-title {
    color: #d4af37;
}

.toc-title.text-wedding-primary {
    color: #d4af37;
}

.toc-card:hover .toc-title.text-wedding-primary {
    color: #8b7355;
}

/* Card Description */
.toc-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

/* Disabled State */
.toc-card.opacity-75 {
    opacity: 0.6;
}

.toc-card.opacity-75:hover {
    transform: translateY(0);
    box-shadow: none;
    border-color: #f5f5dc;
}

.toc-card.opacity-75 .toc-icon-wrapper {
    background: #e5e5e5;
}

.toc-card.opacity-75:hover .toc-icon-wrapper {
    background: #e5e5e5;
    transform: scale(1);
}

.toc-card.opacity-75 .toc-icon {
    color: #9ca3af;
}

.toc-card.opacity-75:hover .toc-icon {
    color: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toc-card {
        padding: 1.5rem 1rem;
    }

    .toc-icon-wrapper {
        width: 60px;
        height: 60px;
    }

    .toc-icon {
        width: 30px;
        height: 30px;
    }

    .toc-title {
        font-size: 1.1rem;
    }

    .toc-description {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .toc-card {
        padding: 1.25rem 0.75rem;
    }

    .toc-icon-wrapper {
        width: 50px;
        height: 50px;
    }

    .toc-icon {
        width: 25px;
        height: 25px;
    }

    .toc-title {
        font-size: 1rem;
    }

    .toc-description {
        font-size: 0.75rem;
    }
}

/* ============================================
   PUZZLE FEATURE STYLES
   ============================================ */

/* Puzzle Overlay Container */
#puzzle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    /* Prevent iOS Safari scroll bounce */
    overscroll-behavior: none;
    overflow: hidden;
}

#puzzle-overlay.puzzle-complete {
    animation: fadeOut 2s ease-out forwards;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Puzzle Instructions */
.puzzle-instructions {
    color: white;
    text-align: center;
    margin-bottom: 20px;
    max-width: 600px;
}

.puzzle-instructions h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #d4af37;
}

.puzzle-instructions p {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

/* Puzzle Grid Container */
#puzzle-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Puzzle Grid */
#puzzle-grid {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    grid-template-rows: repeat(4, 150px);
    gap: 0;
    background: white;
    border: 6px solid #000;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Drop Zones */
.puzzle-drop-zone {
    width: 100px;
    height: 150px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    position: relative;
    transition: all 0.2s ease;
}

.puzzle-drop-zone.drag-over {
    background: rgba(212, 175, 55, 0.3);
    border-color: #d4af37;
    transform: scale(1.05);
}

.puzzle-drop-zone.filled {
    background: transparent;
    border-color: transparent;
}

.puzzle-drop-zone.hint {
    background: rgba(34, 197, 94, 0.5);
    animation: pulse 1s ease-in-out 2;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.8);
}

.puzzle-drop-zone.correct-flash {
    animation: correctFlash 0.6s ease-out;
}

@keyframes correctFlash {
    0%, 100% {
        background: rgba(255, 255, 255, 0.8);
    }
    50% {
        background: rgba(76, 175, 80, 0.5);
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
    }
}

/* Placed Pieces */
.puzzle-piece-placed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.puzzle-piece-placed.pop-in {
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scattered Pieces Container */
#scattered-pieces {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10000;
    /* Prevent iOS Safari scroll bounce during touch interactions */
    overscroll-behavior: none;
}

/* Individual Puzzle Pieces */
.puzzle-piece {
    position: absolute;
    width: 50px;
    height: 75px;
    cursor: grab;
    pointer-events: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    z-index: 1;
    /* iOS Safari touch fixes */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

.puzzle-piece:hover,
.puzzle-piece:active {
    transform: scale(1.1) rotate(0deg) !important;
    z-index: 10;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

.puzzle-piece.dragging {
    cursor: grabbing;
    opacity: 0.7;
    z-index: 1000;
    transform: scale(1.2) rotate(0deg) !important;
}

.puzzle-piece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    /* Prevent iOS image save menu on long press */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.puzzle-piece.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px) rotate(-5deg);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px) rotate(5deg);
    }
}

/* Progress Indicator */
.puzzle-progress {
    color: white;
    text-align: center;
    margin-top: 20px;
}

.puzzle-progress-bar {
    width: 400px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px auto;
}

#puzzle-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #d4af37, #8b7355);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

.puzzle-progress-text {
    font-size: 1rem;
    margin-top: 5px;
}

/* Reset Button */
.puzzle-controls {
    margin-top: 15px;
}

#puzzle-reset {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

#puzzle-reset:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Confetti Animation */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10001;
    display: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #d4af37;
    top: -10px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* RSVP Button Container - Hidden until puzzle complete */
.rsvp-button-container {
    opacity: 0;
    transform: scale(0.8);
    transition: all 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.rsvp-button-container.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    #puzzle-grid {
        grid-template-columns: repeat(4, 60px);
        grid-template-rows: repeat(4, 90px);
        border: 4px solid #000;
    }

    .puzzle-drop-zone {
        width: 60px;
        height: 90px;
    }

    .puzzle-piece {
        width: 40px;
        height: 60px;
    }

    .puzzle-instructions h2 {
        font-size: 1.5rem;
    }

    .puzzle-instructions p {
        font-size: 0.9rem;
    }

    .puzzle-progress-bar {
        width: 280px;
    }
}

/* Very small screens - simplified puzzle */
@media (max-width: 480px) {
    .puzzle-instructions {
        padding: 10px;
    }

    .puzzle-instructions h2 {
        font-size: 1.2rem;
    }

    .puzzle-instructions p {
        font-size: 0.8rem;
    }

    #puzzle-grid {
        grid-template-columns: repeat(4, 50px);
        grid-template-rows: repeat(4, 75px);
    }

    .puzzle-drop-zone {
        width: 50px;
        height: 75px;
    }

    .puzzle-piece {
        width: 35px;
        height: 52px;
    }
}

/* ============================================
   FLOATING PHOTOS BACKGROUND EFFECT
   ============================================ */

/* Container for floating photos */
#floating-photos-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* Individual floating photo */
.floating-photo {
    position: fixed;
    width: 250px;
    height: auto;
    opacity: 0;
    pointer-events: none;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    will-change: opacity, transform;
}

/* Fade-in animation */
@keyframes fadeInPhoto {
    0% {
        opacity: 0;
        transform: scale(0.95) rotate(var(--rotation, 0deg));
    }
    100% {
        opacity: 0.6;
        transform: scale(1) rotate(var(--rotation, 0deg));
    }
}

/* Fade-out animation */
@keyframes fadeOutPhoto {
    0% {
        opacity: 0.6;
        transform: scale(1) rotate(var(--rotation, 0deg));
    }
    100% {
        opacity: 0;
        transform: scale(0.95) rotate(var(--rotation, 0deg));
    }
}

/* Responsive adjustments for floating photos */
@media (max-width: 768px) {
    .floating-photo {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .floating-photo {
        width: 100px;
    }

    @keyframes fadeInPhoto {
        0% {
            opacity: 0;
            transform: scale(0.95) rotate(var(--rotation, 0deg));
        }
        100% {
            opacity: 0.5;
            transform: scale(1) rotate(var(--rotation, 0deg));
        }
    }

    @keyframes fadeOutPhoto {
        0% {
            opacity: 0.5;
            transform: scale(1) rotate(var(--rotation, 0deg));
        }
        100% {
            opacity: 0;
            transform: scale(0.95) rotate(var(--rotation, 0deg));
        }
    }
}
