/**
 * ============================================================================
 * HOSPITAL ERP — PREMIUM HEALTHCARE ANIMATION SYSTEM
 * Path: front/assets/css/animations.css
 * 
 * Elegant, smooth, high-performance transitions and reveal effects.
 * Matching the MPP Group Custom Animation Engine with Healthcare Teal/Cyan styling.
 * Timing: 400-800ms reveals, 150-300ms micro-interactions.
 * Respects prefers-reduced-motion and provides 100% visible fallback.
 * ============================================================================
 */

/* -----------------------------------------------------------------------------
   0. Global Top Reading & Scroll Progress Bar
   ----------------------------------------------------------------------------- */
.hms-scroll-progress,
.mpp-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3.5px;
    background: linear-gradient(90deg, #0b8b7a 0%, #06b6d4 50%, #38bdf8 100%);
    z-index: 999999;
    pointer-events: none;
    transition: width 0.08s linear;
    box-shadow: 0 0 12px rgba(11, 139, 122, 0.8), 0 0 6px rgba(6, 182, 212, 0.6);
}

/* -----------------------------------------------------------------------------
   0B. Lenis Butter-Smooth Inertial Scroll Standards
   ----------------------------------------------------------------------------- */
html, body {
    overflow-x: clip !important;
}

html.lenis, html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-smooth iframe {
    pointer-events: none;
}

/* -----------------------------------------------------------------------------
   0C. Realistic Live Typing Animation & Blinking Cursor (H1, H2 & Headings)
   ----------------------------------------------------------------------------- */
.hms-typing-cursor,
.mpp-typing-cursor {
    display: inline-block;
    width: 3.5px;
    height: 0.92em;
    vertical-align: -0.06em;
    background: linear-gradient(180deg, #0b8b7a 0%, #06b6d4 100%);
    margin-left: 4px;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(11, 139, 122, 0.85);
    animation: hmsCursorBlink 0.85s ease-in-out infinite;
    pointer-events: none;
}

.hms-typing-cursor.is-done,
.mpp-typing-cursor.is-done {
    animation: hmsCursorFadeAfter 4s forwards, hmsCursorBlink 0.85s ease-in-out infinite;
}

@keyframes hmsCursorBlink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px rgba(11, 139, 122, 0.85);
    }
    50% {
        opacity: 0.15;
        box-shadow: 0 0 2px rgba(11, 139, 122, 0.25);
    }
}

@keyframes hmsCursorFadeAfter {
    0%, 75% {
        opacity: 0.85;
    }
    100% {
        opacity: 0;
    }
}

/* -----------------------------------------------------------------------------
   1. Keyframe Definitions
   ----------------------------------------------------------------------------- */
@keyframes hmsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes hmsFadeLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes hmsFadeRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes hmsSubtleZoom {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes hmsFloatAmbient {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes hmsPulseGlow {
    0%, 100% {
        box-shadow: 0 4px 14px rgba(11, 139, 122, 0.28);
    }
    50% {
        box-shadow: 0 4px 26px rgba(11, 139, 122, 0.58), 0 0 14px rgba(6, 182, 212, 0.45);
    }
}

@keyframes hmsDotBeacon {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(11, 139, 122, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 9px rgba(11, 139, 122, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(11, 139, 122, 0);
    }
}

@keyframes hmsShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* -----------------------------------------------------------------------------
   2. Progressive Enhancement: Scroll Reveal Base Classes (Infinite Multi-Scroll)
   (Content is 100% visible by default; animated smoothly when entering view)
   ----------------------------------------------------------------------------- */
.hms-anim-ready .hms-reveal {
    opacity: 0;
    transform: translateY(35px);
    transition: 
        opacity 0.45s ease-out,
        transform 0.45s ease-out;
    transition-delay: 0s !important;
    will-change: opacity, transform;
}

.hms-anim-ready .hms-reveal.hms-reveal-left {
    transform: translateX(-55px) translateY(0);
}

.hms-anim-ready .hms-reveal.hms-reveal-right {
    transform: translateX(55px) translateY(0);
}

.hms-anim-ready .hms-reveal.hms-reveal-zoom {
    transform: scale(0.90);
}

.hms-anim-ready .hms-reveal.hms-reveal-down {
    transform: translateY(-35px) translateX(0);
}

.hms-anim-ready .hms-reveal.hms-reveal-up {
    transform: translateY(45px) translateX(0);
}

/* In-View State: Perfectly glides in from Left, Right or Down and fixes cleanly into its spot */
.hms-anim-ready .hms-reveal.hms-in-view {
    opacity: 1 !important;
    transform: translate(0, 0) scale(1) !important;
    transition: 
        opacity 0.72s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.72s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Stagger Delay Modifiers */
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-1 { transition-delay: 0.06s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-2 { transition-delay: 0.12s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-3 { transition-delay: 0.18s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-4 { transition-delay: 0.24s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-5 { transition-delay: 0.30s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-6 { transition-delay: 0.36s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-7 { transition-delay: 0.42s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-8 { transition-delay: 0.48s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-9 { transition-delay: 0.54s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-10 { transition-delay: 0.60s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-11 { transition-delay: 0.66s !important; }
.hms-anim-ready .hms-reveal.hms-in-view.hms-delay-12 { transition-delay: 0.72s !important; }

/* -----------------------------------------------------------------------------
   3. Page-Load Hero Sequential Animations (No Scroll Required)
   ----------------------------------------------------------------------------- */
.hero-multi .hero-pill-badge,
.hero-multi .hero-copy h1,
.hero-multi .hero-copy .hero-lead,
.hero-multi .hero-actions,
.hero-multi .trust-row,
.hero-multi .product-stage,
.hero-center-content .hero-pill-badge,
.hero-center-content h1,
.hero-center-content .hero-lead,
.hero-center-content .hero-actions,
.hero-doctor-center-stage,
.hero .eyebrow,
.hero h1,
.hero .hero-lead,
.hero .hero-actions,
.hero .trust-row,
.hero .product-stage,
.page-hero .page-hero__crumbs,
.page-hero h1,
.page-hero .page-hero__lead,
#page-banner.team-banner .breadcrumb,
#page-banner.team-banner h1,
#page-banner.team-banner p {
    animation-duration: 0.78s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    animation-fill-mode: both;
}

/* Home Hero Sequence */
.hero-multi .hero-pill-badge,
.hero-center-content .hero-pill-badge,
.hero .eyebrow {
    animation-name: hmsFadeDown;
    animation-delay: 0.08s;
}
.hero-multi .hero-copy h1,
.hero-center-content h1,
.hero h1 {
    animation-name: hmsFadeUp;
    animation-delay: 0.18s;
}
.hero-multi .hero-copy .hero-lead,
.hero-center-content .hero-lead,
.hero .hero-lead {
    animation-name: hmsFadeUp;
    animation-delay: 0.28s;
}
.hero-multi .hero-actions,
.hero-center-content .hero-actions,
.hero .hero-actions {
    animation-name: hmsFadeUp;
    animation-delay: 0.38s;
}
.hero-multi .trust-row,
.hero .trust-row {
    animation-name: hmsFadeUp;
    animation-delay: 0.48s;
}
.hero-multi .product-stage,
.hero-doctor-center-stage,
.hero .product-stage {
    animation-name: hmsSubtleZoom;
    animation-delay: 0.25s;
}

/* Inner Page Hero Sequence */
.page-hero .page-hero__crumbs,
#page-banner.team-banner .breadcrumb {
    animation-name: hmsFadeDown;
    animation-delay: 0.08s;
}
.page-hero h1,
#page-banner.team-banner h1 {
    animation-name: hmsFadeUp;
    animation-delay: 0.18s;
}
.page-hero .page-hero__lead,
#page-banner.team-banner p {
    animation-name: hmsFadeUp;
    animation-delay: 0.28s;
}

/* -----------------------------------------------------------------------------
   4. Floating Ambient Elements & Live Status Beacons
   ----------------------------------------------------------------------------- */
.hms-float {
    animation: hmsFloatAmbient 4.5s ease-in-out infinite;
}

.pulse-dot,
.heartbeat-dot,
.live-status-dot,
.hms-live-dot,
.status-indicator-dot {
    animation: hmsDotBeacon 1.8s infinite !important;
}

/* -----------------------------------------------------------------------------
   5. Button & Call-to-Action Enhancements (Sheen & Magnetic States)
   ----------------------------------------------------------------------------- */
.button,
.btn,
.branch-pill-btn,
.billing-btn,
.premium-role-tab-btn,
.module-filter-btn {
    position: relative;
    overflow: hidden;
    transition: 
        transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.22s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
    will-change: transform;
}

/* Sleek Diagonal Light Sheen on Hover */
.button::after,
.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -70%;
    width: 45%;
    height: 200%;
    background: linear-gradient(
        60deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.28) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    transition: none;
    pointer-events: none;
}

.button:hover::after,
.btn-primary:hover::after {
    left: 140%;
    transition: left 0.75s ease-in-out;
}

.button:hover,
.btn:hover {
    transform: translateY(-2.5px);
    box-shadow: 0 8px 24px rgba(11, 139, 122, 0.28);
}

.button:active,
.btn:active {
    transform: translateY(0.5px) scale(0.98);
}

/* Gentle Glow for Primary Action Buttons */
.hero-actions .button:first-child,
.site-header .nav-actions .button,
.demo-box .button,
.footer-login-highlight {
    animation: hmsPulseGlow 3.5s ease-in-out infinite;
}

.footer-login-highlight {
    display: inline-block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.footer-login-highlight:hover {
    transform: translateX(4px);
}

/* -----------------------------------------------------------------------------
   6. Navigation Links Micro-Interactions (No Underline)
   ----------------------------------------------------------------------------- */
.primary-nav a {
    position: relative;
    transition: color 0.2s ease;
    border-bottom: none !important;
    text-decoration: none !important;
}

.primary-nav a::after {
    display: none !important;
    content: none !important;
}

/* -----------------------------------------------------------------------------
   7. Card & Media Smooth Hover Elevations
   ----------------------------------------------------------------------------- */
.value-card,
.custom-cap-card,
.leader-card,
.plan-card,
.pricing-card-item,
.demo-card-box,
.tech-spec-box,
.dev-process-card,
.network-preview-shell,
.role-pane-card,
.feature-card,
.feature-item,
.service-card,
.team-item,
.team-card,
.hospital-card,
.doctor-card,
.hero-num-card,
.module-list article,
.module-card-item,
.faq-item,
.testi-card {
    transition: 
        transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.25s ease;
}

.value-card:hover,
.custom-cap-card:hover,
.leader-card:hover,
.dev-process-card:hover,
.demo-card-box:hover,
.pricing-card-item:hover,
.hero-num-card:hover,
.testi-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(11, 43, 53, 0.12);
}

.feature-item:hover,
.service-card:hover,
.module-list article:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(11, 43, 53, 0.08);
}

/* Doctor & Team Photo Subtle Zoom */
.team-img-wrap,
.doctor-photo-wrap,
.leader-avatar,
.team-item-avatar {
    overflow: hidden;
}

.team-img-wrap img,
.doctor-photo-wrap img,
.team-card img,
.team-item img {
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.team-card:hover img,
.team-item:hover img,
.doctor-card:hover img {
    transform: scale(1.05);
}

/* -----------------------------------------------------------------------------
   8. Counter Animation Display Helpers
   ----------------------------------------------------------------------------- */
.hms-counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    transition: opacity 0.3s ease;
}

/* -----------------------------------------------------------------------------
   9. Reduced Motion Accessibility (Strict Compliance)
   ----------------------------------------------------------------------------- */
@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;
    }

    .hms-anim-ready .hms-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .hms-float,
    .hero-actions .button:first-child,
    .footer-login-highlight {
        animation: none !important;
    }
}
