/**
 * Phát Đạt Dental - Ultra-Smooth Motion & UI/UX Animation Engine v2.0
 * 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.18s;
    --pd-dur-medium: 0.34s;
    --pd-dur-smooth: 0.52s;
    --pd-dur-slow: 0.85s;
    --pd-glow-blue: rgba(0, 90, 156, 0.16);
    --pd-glow-cyan: rgba(35, 159, 217, 0.24);
}

/* Native Cross-Document View Transitions (SPA-like smooth navigation) */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.18s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ==========================================================================
   0. TOP SCROLL PROGRESS BAR, FLY-TO-CART BUBBLE & BUTTON RIPPLE
   ========================================================================== */
#pd-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #1B3B6B 0%, #239FD9 55%, #64D2FF 100%);
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 100000;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(35, 159, 217, 0.55);
    will-change: transform;
}

.pd-fly-cart-bubble {
    position: fixed;
    z-index: 100001;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #239FD9;
    box-shadow: 0 10px 28px rgba(27, 59, 107, 0.32), 0 0 0 4px rgba(35, 159, 217, 0.18);
    overflow: hidden;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-sizing: border-box;
    will-change: transform, opacity;
}

.pd-fly-cart-bubble img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

/* Tactile Ripple Wave on Buttons */
.pd-ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    transform: scale(0);
    pointer-events: none;
    animation: pdRippleAnim 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    z-index: 1;
}

@keyframes pdRippleAnim {
    to {
        transform: scale(3.2);
        opacity: 0;
    }
}

/* Smooth Lazy Image Reveal */
img.pd-img-lazy-pending {
    opacity: 0;
    transition: opacity 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

img.pd-img-lazy-loaded {
    opacity: 1;
    transition: opacity 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Base hidden state: element waiting in viewport threshold */
.pd-reveal {
    opacity: 0;
    transform: translateY(20px);
    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.96) translateY(14px);
    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) translateY(0) !important;
    will-change: auto;
}

/* Variation: Slide from Left */
.pd-reveal-left {
    opacity: 0;
    transform: translateX(-22px);
    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(22px);
    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.03s !important; }
.pd-stagger-2 { transition-delay: 0.06s !important; }
.pd-stagger-3 { transition-delay: 0.09s !important; }
.pd-stagger-4 { transition-delay: 0.12s !important; }
.pd-stagger-5 { transition-delay: 0.15s !important; }
.pd-stagger-6 { transition-delay: 0.18s !important; }
.pd-stagger-7 { transition-delay: 0.21s !important; }
.pd-stagger-8 { transition-delay: 0.24s !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(-6px) !important;
    border-color: #7dd3fc !important;
    box-shadow: 0 18px 38px -8px rgba(0, 90, 156, 0.18),
                0 6px 16px rgba(15, 23, 42, 0.05) !important;
}

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

.product-card-wrap:hover .product-card-image {
    transform: scale(1.07) !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-btn:active,
.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;
}

/* Product Card Dual Action Buttons Hover Polish */
.product-card-btn.btn-cart-action {
    transition: all 0.25s var(--pd-ease-out-expo) !important;
}
.product-card-btn.btn-cart-action:hover {
    background: #e0f2fe !important;
    border-color: #239FD9 !important;
    color: #005a9c !important;
    transform: translateY(-1px);
}
.product-card-btn.btn-cart-action:hover svg {
    transform: scale(1.12) rotate(-5deg);
    transition: transform 0.25s var(--pd-ease-out-back);
}

.product-card-btn.btn-buynow-action {
    transition: all 0.25s var(--pd-ease-out-expo) !important;
}
.product-card-btn.btn-buynow-action:hover {
    background: linear-gradient(135deg, #1B3B6B 0%, #239FD9 100%) !important;
    box-shadow: 0 6px 16px rgba(35, 159, 217, 0.35) !important;
    transform: translateY(-1px);
}

/* ==========================================================================
   3. HEADER, MEGA-MENU & PAGE BANNER MOTION
   ========================================================================== */

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

.pd-badge-bump {
    animation: pdBadgeBump 0.55s 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.95) !important;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08) !important;
    transition: all 0.3s var(--pd-ease-in-out) !important;
}


/* 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;
}

/* Page Header Banner Subtle Ken Burns Zoom */
@keyframes pdPageBannerZoom {
    0% {
        transform: scale(1.07);
    }
    100% {
        transform: scale(1);
    }
}

.page-header-wrapper .title-bg,
#page-header-events .title-bg,
#page-header-blog .title-bg,
.pd-about-hero__media img {
    animation: pdPageBannerZoom 1.8s var(--pd-ease-out-expo) forwards;
    will-change: transform;
}

/* ==========================================================================
   4. HERO & BENTO PROMOTIONAL BANNERS (HOMEPAGE SECTION 5)
   ========================================================================== */

/* 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.055) !important;
}

/* Glass overlay cards inside Homepage Bento Banners */
.home-sec5-content-left,
.home-sec5-scanner-box,
.home-sec5-small-box {
    transition: transform 0.4s var(--pd-ease-out-expo),
                border-color 0.35s ease,
                box-shadow 0.4s ease,
                background-color 0.35s ease !important;
}

.banner.has-hover:hover .home-sec5-content-left,
.banner.has-hover:hover .home-sec5-scanner-box,
.banner.has-hover:hover .home-sec5-small-box {
    transform: translateY(-4px);
    border-color: rgba(100, 210, 255, 0.52) !important;
    box-shadow: 0 16px 36px rgba(8, 25, 44, 0.45), 0 0 20px rgba(35, 159, 217, 0.2) !important;
    background: rgba(8, 25, 44, 0.72) !important;
}

/* ==========================================================================
   5. INNER PAGES CARDS & INTERACTIVE ELEMENTS (ABOUT, BLOG, EVENTS, CAREERS, CONTACT, POLICY)
   ========================================================================== */

/* Footer Service Commitment Cards (4 Cam Kết) */
.pd-service-item {
    transition: transform 0.35s var(--pd-ease-out-expo),
                box-shadow 0.35s var(--pd-ease-out-expo),
                border-color 0.3s ease !important;
}
.pd-service-item:hover {
    transform: translateY(-5px) !important;
    border-color: rgba(35, 159, 217, 0.45) !important;
    box-shadow: 0 14px 32px rgba(27, 59, 107, 0.1) !important;
}
.pd-service-item .pd-service-icon {
    transition: transform 0.35s var(--pd-ease-out-back), color 0.3s ease !important;
}
.pd-service-item:hover .pd-service-icon {
    transform: scale(1.1) rotate(-4deg);
}

/* Contact Info Cards & Map Wrapper */
.contact-info-card {
    transition: transform 0.35s var(--pd-ease-out-expo),
                box-shadow 0.35s var(--pd-ease-out-expo),
                border-color 0.3s ease !important;
}
.contact-info-card:hover {
    transform: translateY(-5px) !important;
    border-color: rgba(35, 159, 217, 0.5) !important;
    box-shadow: 0 16px 36px rgba(27, 59, 107, 0.1) !important;
}
.contact-info-card .contact-info-icon-box {
    transition: transform 0.35s var(--pd-ease-out-back) !important;
}
.contact-info-card:hover .contact-info-icon-box {
    transform: scale(1.12);
}

/* Blog, Event, and Career Post Cards */
.blog-post-card,
.event-card,
.career-post-card,
.related-post-card {
    transition: transform 0.38s var(--pd-ease-out-expo),
                box-shadow 0.38s var(--pd-ease-out-expo),
                border-color 0.3s ease !important;
}
.blog-post-card:hover,
.event-card:hover,
.career-post-card:hover,
.related-post-card:hover {
    transform: translateY(-6px) !important;
    border-color: #93c5fd !important;
    box-shadow: 0 18px 38px -8px rgba(27, 59, 107, 0.14),
                0 6px 16px rgba(15, 23, 42, 0.05) !important;
}

/* About Page Cards (Benefits, Values, Steps, Mission, Facilities) */
.pd-about-value,
.pd-about-step,
.pd-about-mission-card,
.pd-about-facility {
    transition: transform 0.38s var(--pd-ease-out-expo),
                box-shadow 0.38s var(--pd-ease-out-expo),
                border-color 0.3s ease !important;
}
.pd-about-value:hover,
.pd-about-step:hover,
.pd-about-mission-card:hover {
    transform: translateY(-6px) !important;
    box-shadow: 0 18px 38px -8px rgba(27, 59, 107, 0.14) !important;
    border-color: rgba(35, 159, 217, 0.45) !important;
}
.pd-about-step .pd-about-step__image img,
.pd-about-facility img {
    transition: transform 0.65s var(--pd-ease-out-expo) !important;
}
.pd-about-step:hover .pd-about-step__image img,
.pd-about-facility:hover img {
    transform: scale(1.06) !important;
}

/* Policy Sidebar & Pagination Links */
.policy-nav-link {
    transition: all 0.25s var(--pd-ease-out-expo) !important;
}
.policy-nav-link:hover {
    transform: translateX(4px);
}
.bct-policy-pagination .pagination-link {
    transition: transform 0.3s var(--pd-ease-out-expo),
                box-shadow 0.3s var(--pd-ease-out-expo),
                border-color 0.3s ease !important;
}
.bct-policy-pagination .pagination-link:hover {
    transform: translateY(-3px);
    border-color: #239FD9 !important;
    box-shadow: 0 10px 24px rgba(35, 159, 217, 0.14) !important;
}

/* Product Detail Main Gallery Crossfade */
#main-product-image.pd-img-switching {
    opacity: 0.35 !important;
    transform: scale(0.97) !important;
}
#main-product-image {
    transition: opacity 0.28s var(--pd-ease-out-expo),
                transform 0.35s var(--pd-ease-out-expo) !important;
}

/* ==========================================================================
   6. LUXURY CTA BUTTON SHINE EFFECT & INPUT FOCUS GLOW
   ========================================================================== */

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

.button.primary::after,
#btn-submit-order::after,
.newsletter-submit-btn::after,
.contact-submit-btn::after,
.pd-about-btn--primary::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.3) 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,
.contact-submit-btn:hover::after,
.pd-about-btn--primary: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: #239FD9 !important;
    box-shadow: 0 0 0 3.5px rgba(35, 159, 217, 0.16) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    outline: none !important;
}

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

@keyframes pdRadarPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(35, 159, 217, 0.5);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(35, 159, 217, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(35, 159, 217, 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(35, 159, 217, 0.35) !important;
    background-color: #239FD9 !important;
}

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

/* ==========================================================================
   8. 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);
}

/* ==========================================================================
   9. 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,
    .pd-reveal-fade {
        opacity: 1 !important;
        transform: none !important;
    }
}
