/**
 * Phát Đạt Dental - Ultra-Smooth Motion & Animation Engine
 * Standard: Modern High-End Medical & Dental Technology
 * Performance: GPU Composited (transform & opacity), 60-120fps, Zero Layout Thrashing
 */

:root {
    --pd-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --pd-ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --pd-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --pd-dur-quick: 0.2s;
    --pd-dur-medium: 0.35s;
    --pd-dur-smooth: 0.65s;
    --pd-dur-slow: 0.9s;
    --pd-glow-blue: rgba(0, 90, 156, 0.16);
    --pd-glow-cyan: rgba(0, 194, 203, 0.22);
}

/* ==========================================================================
   1. SCROLL-REVEAL SYSTEM (IntersectionObserver Driven)
   ========================================================================== */

/* Base hidden state: element waiting in viewport threshold */
.pd-reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity var(--pd-dur-smooth) var(--pd-ease-out-expo),
                transform var(--pd-dur-smooth) var(--pd-ease-out-expo);
    will-change: opacity, transform;
}

/* Active revealed state */
.pd-reveal.is-revealed {
    opacity: 1 !important;
    transform: translateY(0) !important;
    will-change: auto;
}

/* Variation: Fade only */
.pd-reveal-fade {
    opacity: 0;
    transition: opacity var(--pd-dur-smooth) var(--pd-ease-in-out);
    will-change: opacity;
}
.pd-reveal-fade.is-revealed {
    opacity: 1 !important;
    will-change: auto;
}

/* Variation: Scale-up (ideal for banners and featured cards) */
.pd-reveal-scale {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity var(--pd-dur-smooth) var(--pd-ease-out-expo),
                transform var(--pd-dur-smooth) var(--pd-ease-out-expo);
    will-change: opacity, transform;
}
.pd-reveal-scale.is-revealed {
    opacity: 1 !important;
    transform: scale(1) !important;
    will-change: auto;
}

/* Variation: Slide from Left */
.pd-reveal-left {
    opacity: 0;
    transform: translateX(-32px);
    transition: opacity var(--pd-dur-smooth) var(--pd-ease-out-expo),
                transform var(--pd-dur-smooth) var(--pd-ease-out-expo);
    will-change: opacity, transform;
}
.pd-reveal-left.is-revealed {
    opacity: 1 !important;
    transform: translateX(0) !important;
    will-change: auto;
}

/* Variation: Slide from Right */
.pd-reveal-right {
    opacity: 0;
    transform: translateX(32px);
    transition: opacity var(--pd-dur-smooth) var(--pd-ease-out-expo),
                transform var(--pd-dur-smooth) var(--pd-ease-out-expo);
    will-change: opacity, transform;
}
.pd-reveal-right.is-revealed {
    opacity: 1 !important;
    transform: translateX(0) !important;
    will-change: auto;
}

/* Stagger transition delays for child grids */
.pd-stagger-1 { transition-delay: 0.05s !important; }
.pd-stagger-2 { transition-delay: 0.10s !important; }
.pd-stagger-3 { transition-delay: 0.15s !important; }
.pd-stagger-4 { transition-delay: 0.20s !important; }
.pd-stagger-5 { transition-delay: 0.25s !important; }
.pd-stagger-6 { transition-delay: 0.30s !important; }
.pd-stagger-7 { transition-delay: 0.35s !important; }
.pd-stagger-8 { transition-delay: 0.40s !important; }

/* ==========================================================================
   2. PRODUCT CARD MICRO-INTERACTIONS
   ========================================================================== */

/* Modern card container with silky hover elevation */
.product-card-wrap {
    transition: transform var(--pd-dur-medium) var(--pd-ease-out-expo),
                box-shadow var(--pd-dur-medium) var(--pd-ease-out-expo),
                border-color var(--pd-dur-medium) var(--pd-ease-in-out) !important;
    will-change: transform, box-shadow;
}

.product-card-wrap:hover {
    transform: translateY(-5px) !important;
    border-color: #93c5fd !important;
    box-shadow: 0 16px 36px -6px rgba(0, 90, 156, 0.16),
                0 4px 12px rgba(15, 23, 42, 0.04) !important;
}

/* Product image smooth zoom on hover */
.product-card-image {
    transition: transform 0.5s var(--pd-ease-out-expo) !important;
    transform-origin: center center !important;
    will-change: transform;
}

.product-card-wrap:hover .product-card-image {
    transform: scale(1.06) !important;
}

/* Sale & Discount Badges - Subtle luxury sheen sweep */
@keyframes pdShimmer {
    0% {
        transform: translateX(-150%) skewX(-20deg);
    }
    100% {
        transform: translateX(250%) skewX(-20deg);
    }
}

.product-card-badge-sale {
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3) !important;
    transition: transform 0.2s ease !important;
}

.product-card-badge-sale::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    animation: pdShimmer 3.2s infinite ease-in-out;
    pointer-events: none;
}

.product-card-wrap:hover .product-card-badge-sale {
    transform: scale(1.05);
}

/* Quick view floating eye button */
.product-card-quickview {
    transition: all 0.25s var(--pd-ease-out-expo) !important;
}

.product-card-quickview:hover {
    transform: scale(1.12) !important;
    background: #005a9c !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 90, 156, 0.35) !important;
}

/* Tactile button feedback when pressed */
.product-card-action-btn:active,
.btn-add-cart-single:active,
.btn-quick-buy-single:active,
.button:active,
button[type="submit"]:active {
    transform: scale(0.96) !important;
    transition: transform 0.1s ease !important;
}

/* Dual action buttons styling hover transition */
.btn-add-cart-single {
    transition: all 0.2s var(--pd-ease-out-expo) !important;
}
.btn-add-cart-single:hover {
    background: #e0f2fe !important;
    border-color: #0284c7 !important;
    color: #005a9c !important;
}

.btn-quick-buy-single {
    transition: all 0.2s var(--pd-ease-out-expo) !important;
}
.btn-quick-buy-single:hover {
    background: #004578 !important;
    box-shadow: 0 4px 14px rgba(0, 90, 156, 0.35) !important;
}

/* ==========================================================================
   3. HEADER & NAVIGATION MOTION
   ========================================================================== */

/* Cart badge bump animation on increment */
@keyframes pdBadgeBump {
    0% { transform: scale(1); }
    28% { transform: scale(1.4); }
    55% { transform: scale(0.88); }
    75% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.pd-badge-bump {
    animation: pdBadgeBump 0.5s var(--pd-ease-out-back) !important;
}

/* Header sticky elevation transition */
.header-wrapper.stuck {
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08) !important;
    transition: all 0.3s var(--pd-ease-in-out) !important;
}

/* Animated sliding indicator for primary menu links */
.header-nav > li > a {
    position: relative;
    transition: color 0.2s ease;
}

.header-nav > li > a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #0077ff, #00c2cb);
    transition: width 0.28s var(--pd-ease-out-expo), left 0.28s var(--pd-ease-out-expo);
    border-radius: 2px;
}

.header-nav > li:hover > a::after,
.header-nav > li.active > a::after,
.header-nav > li.current-menu-item > a::after {
    width: 100%;
    left: 0;
}

/* Dropdown menus smooth slide & fade */
.nav-dropdown {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.22s var(--pd-ease-out-expo),
                transform 0.22s var(--pd-ease-out-expo),
                visibility 0.22s !important;
    pointer-events: none;
}

.nav-dropdown-has-arrow li:hover > .nav-dropdown,
li.has-dropdown:hover > .nav-dropdown {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* ==========================================================================
   4. HERO & PROMOTIONAL BANNERS
   ========================================================================== */

/* Banner image smooth zoom */
.banner.has-hover .banner-bg img {
    transition: transform 0.85s var(--pd-ease-out-expo) !important;
    will-change: transform;
}

.banner.has-hover:hover .banner-bg img {
    transform: scale(1.045) !important;
}

/* Subtle floating breathing effect for glass cards over banners */
@keyframes pdFloatSubtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.home-sec5-content-left {
    animation: pdFloatSubtle 4.5s ease-in-out infinite;
    will-change: transform;
}

.home-sec5-content-left:hover {
    animation-play-state: paused;
}

/* ==========================================================================
   5. LUXURY CTA BUTTON SHINE EFFECT
   ========================================================================== */

/* Shimmer shine sweep for primary action buttons */
.button.primary,
#btn-submit-order,
.newsletter-submit-btn {
    position: relative !important;
    overflow: hidden !important;
    transition: all 0.25s var(--pd-ease-out-expo) !important;
}

.button.primary::after,
#btn-submit-order::after,
.newsletter-submit-btn::after {
    content: '' !important;
    position: absolute !important;
    top: -50% !important;
    left: -120% !important;
    width: 60% !important;
    height: 200% !important;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.28) 50%,
        rgba(255, 255, 255, 0) 100%
    ) !important;
    transform: rotate(25deg) !important;
    pointer-events: none !important;
    transition: none !important;
}

.button.primary:hover::after,
#btn-submit-order:hover::after,
.newsletter-submit-btn:hover::after {
    left: 160% !important;
    transition: left 0.75s ease-in-out !important;
}

/* Focus glow ring for inputs */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    border-color: #005a9c !important;
    box-shadow: 0 0 0 3.5px rgba(0, 90, 156, 0.15) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    outline: none !important;
}

/* ==========================================================================
   6. FLOATING CONTACT TOOLS & RADAR PULSE
   ========================================================================== */

@keyframes pdRadarPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.5);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(0, 122, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

.floating-contact-btn,
.pd-pulse-radar,
.hotline-phone-ring {
    animation: pdRadarPulse 2.4s infinite ease-out !important;
}

/* Back to Top Button */
#top-link {
    transition: all 0.3s var(--pd-ease-out-expo) !important;
    border-radius: 50% !important;
}

#top-link:hover {
    transform: translateY(-4px) scale(1.08) !important;
    box-shadow: 0 8px 20px rgba(0, 90, 156, 0.35) !important;
    background-color: #005a9c !important;
}

#top-link:hover i {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

/* ==========================================================================
   7. MODAL SPRING & POPUP ENTRANCE
   ========================================================================== */

@keyframes pdModalSpring {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(15px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.quick-variant-modal-content {
    animation: pdModalSpring 0.35s var(--pd-ease-out-expo) !important;
}

/* Quick variant option pills */
.quick-variant-btn {
    transition: all 0.2s var(--pd-ease-out-expo) !important;
}

.quick-variant-btn:active {
    transform: scale(0.95) !important;
}

.quick-variant-btn.selected {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 90, 156, 0.2) !important;
}

/* Quick Purchase Modal Enhancements */
.qvm-backdrop {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    transition: opacity 0.3s var(--pd-ease-out-expo), visibility 0.3s var(--pd-ease-out-expo) !important;
}

.qvm-panel {
    transition: transform 0.35s var(--pd-ease-out-expo), opacity 0.35s ease !important;
}

.qvm-option-chip {
    transition: all 0.2s var(--pd-ease-out-expo) !important;
}
.qvm-option-chip:active {
    transform: scale(0.95) !important;
}
.qvm-option-chip.active {
    transform: scale(1.02) !important;
}

.qvm-thumb-item {
    transition: all 0.2s var(--pd-ease-out-expo) !important;
}
.qvm-thumb-item:hover {
    transform: translateY(-2px) !important;
}

/* Product Detail Tabs */
.tab-pane-item {
    animation: pdTabFade 0.32s var(--pd-ease-out-expo);
}
@keyframes pdTabFade {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.tab-clean-link {
    transition: all 0.22s var(--pd-ease-out-expo) !important;
}
.tab-clean-link:hover {
    transform: translateY(-1px);
}

/* ==========================================================================
   8. ACCESSIBILITY: 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;
        scroll-behavior: auto !important;
    }
    .pd-reveal,
    .pd-reveal-scale,
    .pd-reveal-left,
    .pd-reveal-right {
        opacity: 1 !important;
        transform: none !important;
    }
}
