/* ==========================================================================
   EPP Group — Global Animations
   Page Loader, Page Transition, Scroll Reveal, Micro-interactions, Navbar
   ========================================================================== */

/* ---- Respect prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal, .reveal-left, .reveal-right, .reveal-zoom {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ==========================================================================
   1. PAGE LOADER
   ========================================================================== */
#page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

#page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #cfe2ff;
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.loader-logo {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 2px solid #0d6efd;
    border-radius: 50%;
    background: #0d6efd;
    opacity: 0.15;
    animation: pulse-loader 0.75s ease-in-out infinite alternate;
}

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

@keyframes pulse-loader {
    from { transform: scale(0.7); opacity: 0.1; }
    to   { transform: scale(1.1); opacity: 0.25; }
}

/* ==========================================================================
   2. PAGE TRANSITION OVERLAY
   ========================================================================== */
#page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: linear-gradient(135deg, #e8f2ff 0%, #cfe2ff 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ==========================================================================
   3. SCROLL REVEAL
   ========================================================================== */

/* Base: fade up */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

/* Slide from left */
.reveal-left {
    opacity: 0;
    transform: translateX(-36px);
    transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

/* Slide from right */
.reveal-right {
    opacity: 0;
    transform: translateX(36px);
    transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

/* Zoom in */
.reveal-zoom {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: opacity, transform;
}

/* Triggered state (all variants) */
.reveal.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-zoom.visible {
    opacity: 1;
    transform: none;
}

/* Staggered delay helpers */
.delay-100 { transition-delay: 0.10s; }
.delay-150 { transition-delay: 0.15s; }
.delay-200 { transition-delay: 0.20s; }
.delay-250 { transition-delay: 0.25s; }
.delay-300 { transition-delay: 0.30s; }
.delay-400 { transition-delay: 0.40s; }
.delay-500 { transition-delay: 0.50s; }

/* ==========================================================================
   4. BUTTON MICRO-INTERACTIONS
   ========================================================================== */

/* Universal button press feel */
.btn,
.btn-custom-primary,
.btn-outline-custom,
.btn-detail-home,
.btn-detail-modern,
.btn-view-all-modern,
.btn-white-custom,
.btn-cta-message,
.category-btn-home {
    position: relative;
    overflow: hidden;
}

/* Active / press state */
.btn:active,
.btn-custom-primary:active,
.btn-outline-custom:active,
.btn-detail-home:active,
.btn-detail-modern:active,
.btn-view-all-modern:active,
.btn-white-custom:active,
.btn-cta-message:active {
    transform: translateY(1.5px) scale(0.98) !important;
    transition-duration: 0.1s !important;
}

/* Category buttons skip the aggressive scale to maintain layout stability */
.category-btn-home:active {
    transform: translateY(1.5px) !important;
    transition-duration: 0.1s !important;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1) !important;
}

/* Ripple element (injected by JS) */
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    transform: scale(0);
    animation: ripple-anim 0.55s linear;
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4.5);
        opacity: 0;
    }
}

/* ==========================================================================
   5. NAVBAR SCROLL STATE
   ========================================================================== */
header {
    transition: box-shadow 0.35s ease, background 0.35s ease;
}

header.navbar-scrolled {
    box-shadow: 0 4px 24px rgba(0, 60, 160, 0.13) !important;
    background: linear-gradient(135deg, rgba(210, 235, 255, 0.99) 0%, rgba(230, 245, 255, 1) 100%) !important;
    border-bottom-color: rgba(13, 110, 253, 0.15) !important;
}

/* Nav link underline hover — smooth slide-in */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #0d6efd;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-link:hover::after {
    width: 40px;
}

/* Active already has after via inline style – keep consistent */
.nav-link.active::after {
    width: 40px !important;
}

/* ==========================================================================
   6. CARD HOVER — Spring-feel standard
   ========================================================================== */

/* Product cards */
.product-card-home,
.product-card-modern {
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.35s ease !important;
}

/* Service icon */
.service-icon-modern {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease,
                box-shadow 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease !important;
}

/* Banner info item icon */
.banner-icon-wrapper {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease !important;
}

.banner-info-item:hover .banner-icon-wrapper {
    transform: scale(1.12) !important;
    box-shadow: 0 6px 18px rgba(13, 110, 253, 0.22) !important;
}

/* Category filter buttons — spring */
.category-btn-home {
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                background 0.3s ease !important;
}

/* ==========================================================================
   7. HERO CAROUSEL CAPTION ANIMATION
   ========================================================================== */
.carousel-item.active .carousel-caption h1 {
    animation: heroTitleIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.carousel-item.active .carousel-caption p {
    animation: heroTitleIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.carousel-item.active .btn-group-home {
    animation: heroTitleIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

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

/* ==========================================================================
   8. DROPDOWN MENU — Smooth open
   ========================================================================== */
.dropdown-hover:hover .dropdown-menu-custom,
.dropdown-hover:focus-within .dropdown-menu-custom {
    animation: dropdownOpen 0.22s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

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

/* ==========================================================================
   9. WHATSAPP FLOAT BUTTON (if present)
   ========================================================================== */
.whatsapp-float,
.whatsapp-btn-fixed {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease !important;
}

.whatsapp-float:hover,
.whatsapp-btn-fixed:hover {
    transform: translateY(-5px) scale(1.08) !important;
}

/* ==========================================================================
   10. FOOTER LINKS
   ========================================================================== */
footer a {
    transition: color 0.25s ease, transform 0.25s ease;
    display: inline-block;
}

footer a:hover {
    transform: translateX(4px);
}
