﻿/* ============================================================
   PRELOADER ANIMATIONS - Full Screen Fix
   ============================================================ */

/* Preloader Container - Full Screen */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(135deg, #FFF9F5 0%, #FBEAE3 40%, #F3D5D0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    
}

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

/* Cake Animation */
.cake-preloader {
    position: relative;
    width: 120px;
    height: 140px;
    margin: 0 auto;
}

.cake-layer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px;
    animation: layerAppear 0.8s ease forwards;
    opacity: 0;
}

.layer-bottom {
    bottom: 10px;
    width: 100px;
    height: 35px;
    background: linear-gradient(180deg, #8B5E3C 0%, #6B3F2A 100%);
    border-radius: 8px 8px 4px 4px;
    animation-delay: 0.2s;
}

.layer-middle {
    bottom: 45px;
    width: 85px;
    height: 30px;
    background: linear-gradient(180deg, #D99A94 0%, #C4847E 100%);
    border-radius: 8px;
    animation-delay: 0.5s;
}

.layer-top {
    bottom: 75px;
    width: 70px;
    height: 28px;
    background: linear-gradient(180deg, #E8C4B8 0%, #D99A94 100%);
    border-radius: 8px 8px 4px 4px;
    animation-delay: 0.8s;
}

@keyframes layerAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

/* Cream Piping */
.cream-pipe {
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 18px;
    background: radial-gradient(ellipse at center, #FFE4D6 0%, #FAD5C4 100%);
    border-radius: 50%;
    opacity: 0;
    animation: creamAppear 0.6s ease 0.9s forwards;
    box-shadow: 0 2px 10px rgba(217, 154, 148, 0.3);
}

.cream-pipe::before,
.cream-pipe::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(ellipse at center, #FFE4D6 0%, #FAD5C4 100%);
    border-radius: 50%;
    top: -8px;
}

.cream-pipe::before {
    left: -8px;
    animation: creamSquirt 0.8s ease 1s forwards;
}

.cream-pipe::after {
    right: -8px;
    animation: creamSquirt 0.8s ease 1.1s forwards;
}

@keyframes creamAppear {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

@keyframes creamSquirt {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Heart */
.heart-preloader {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    animation: heartFloat 1.5s ease-in-out infinite;
    opacity: 0;
    animation-delay: 0.3s;
    animation-fill-mode: forwards;
}

@keyframes heartFloat {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.5);
    }
    30% {
        opacity: 1;
        transform: translateX(-50%) translateY(-5px) scale(1.2);
    }
    60% {
        transform: translateX(-50%) translateY(5px) scale(1);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Sprinkles */
.sprinkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sprinkle {
    position: absolute;
    font-size: 16px;
    color: #D99A94;
    animation: sprinkleFall 2s ease-in-out infinite;
    opacity: 0;
}

@keyframes sprinkleFall {
    0% {
        opacity: 0;
        transform: translateY(-20px) rotate(0deg);
    }
    30% {
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(40px) rotate(360deg);
    }
}

/* Loading Dots */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #D99A94;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Preloader Typography */
.preloader-title {
    font-family: 'Great Vibes', cursive;
    font-size: 2rem;
    color: #5B3932;
    margin-top: 30px;
}

.preloader-sub {
    color: #D99A94;
    font-size: 1.1rem;
    margin-top: 5px;
    font-family: 'Poppins', sans-serif;
}

/* Responsive Preloader */
@media (max-width: 768px) {
    .cake-preloader {
        width: 90px;
        height: 110px;
    }
    .layer-bottom { width: 75px; height: 28px; }
    .layer-middle { width: 65px; height: 24px; }
    .layer-top { width: 55px; height: 22px; }
    .cream-pipe { width: 45px; height: 14px; top: 45px; }
    .cream-pipe::before, .cream-pipe::after { width: 15px; height: 15px; top: -6px; }
    .heart-preloader { font-size: 22px; top: -20px; }
    .preloader-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .cake-preloader { width: 70px; height: 85px; }
    .layer-bottom { width: 58px; height: 22px; }
    .layer-middle { width: 50px; height: 18px; }
    .layer-top { width: 42px; height: 16px; }
    .cream-pipe { width: 35px; height: 11px; top: 35px; }
    .cream-pipe::before, .cream-pipe::after { width: 12px; height: 12px; top: -5px; }
    .heart-preloader { font-size: 18px; top: -15px; }
    .preloader-title { font-size: 1.2rem; }
}