/**
 * Medical Center GSAP Animations - CORRECTED VERSION
 * Version: 3.0.0 - Avada-Compatible
 */

/* ====================================================
   HEART & ECG ANIMATION - WITH PRELOADER HIDING (FIXED)
   ==================================================== */

/* Hide heart animation while preloader exists - MORE AGGRESSIVE SELECTORS */
.preloader {
    z-index: 999999 !important;
}

/* Hide ANY heart animation when preloader is present */
.preloader ~ * .medical-animation-wrapper,
.preloader ~ * .heart-ecg-container,
body:has(.preloader:not(.preloader-hidden)) .medical-animation-wrapper,
body:has(.preloader:not(.preloader-hidden)) .heart-ecg-container {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show heart animation only after preloader is hidden */
.preloader.preloader-hidden ~ * .medical-animation-wrapper,
.preloader.preloader-hidden ~ * .heart-ecg-container,
body:has(.preloader.preloader-hidden) .medical-animation-wrapper,
body:has(.preloader.preloader-hidden) .heart-ecg-container {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Extra safety - hide during preloader animation */
.preloader:not(.preloader-hidden) + * .medical-animation-wrapper,
.preloader:not(.preloader-hidden) + * .heart-ecg-container {
    opacity: 0 !important;
    visibility: hidden !important;
}

.medical-animation-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 400px;
    position: relative;
}

.heart-ecg-container {
    position: relative;
    display: inline-block;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

.animated-heart {
    width: 120px;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center;
    z-index: 1;
    filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.5));
    will-change: transform;
}

.ecg-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.ecg-path {
    filter: drop-shadow(0 0 2px rgba(255, 107, 107, 0.5));
}

.pulse-dot {
    filter: drop-shadow(0 0 3px rgba(255, 107, 107, 0.8));
}

/* Mobile */
@media (max-width: 768px) {
    .heart-ecg-container {
        width: 280px;
        height: 280px;
    }
    
    .animated-heart {
        width: 80px;
    }
    
    .ecg-line {
        transform: scale(0.9);
        transform-origin: center;
    }
}

/* Visibility */
@media (min-width: 769px) {
    .heart-ecg-container.mobile-version {
        display: none;
    }
}

@media (max-width: 768px) {
    .heart-ecg-container.desktop-version {
        display: none;
    }
}

/* ====================================================
   MEDICAL HERO ANIMATION - UPDATED LAYERING
   ==================================================== */

.medical-hero-animation-wrapper {
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 120px;
}

/* Flowing Lines - BOTTOM LAYER (z-index: 1) */
.flowing-lines-svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;  /* Changed from 0 to 1 - lowest layer */
    overflow: visible;
    pointer-events: none;
    transform: translateX(405px) !important; /* This WILL move everything */
}

.flowing-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.flow-line-static,
.flow-line-animated {
    fill: none;
    stroke-linecap: round;
}

.flow-line-animated {
    will-change: stroke-dashoffset, opacity;
}

/* Hero Base Image - MIDDLE LAYER (z-index: 2) */
.hero-base-image {
    position: relative;
    z-index: 2;  /* Changed from 1 to 2 - above flowing lines */
    display: inline-block;
}

.hero-base-image img.base-device {
    display: block;
    width: auto;
    height: auto;
    max-width: min(600px, 90vw);
}

/* Floating Elements Container - TOP LAYER (z-index: 3) */
.floating-elements-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;  /* Changed from 2 to 3 - above base image */
    pointer-events: none;
}

/* Individual Floating Elements - HIGHEST (z-index: 4) */
.floating-element {
    position: absolute;
    cursor: pointer;
    transition: filter 0.3s ease;
    z-index: 4;  /* Changed from 3 to 4 - highest layer */
    pointer-events: auto;
    will-change: transform, filter;
}

.floating-element:hover {
    filter: brightness(1.15) drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.floating-element img {
    width: 100%;
    height: auto;
    display: block;
}

/* Element Positioning */
.element-thermometer {
    width: 134px;
    top: 10%;
    left: 55%;
}

.element-oximeter {
    width: 235px;
    top: 55%;
    left: 70%;
    transform: translateX(-50%);
}

.element-pills {
    width: 55px;
    top: 25%;
    left: 70%;
}

/* Responsive */
@media (max-width: 768px) {
    .medical-hero-animation-wrapper {
        min-height: 350px;
        margin-left: 50px;
    }
    
    .hero-base-image img.base-device {
        max-width: min(500px, 85vw);
    }
    
    .flowing-lines-svg-container {
        transform: translateX(250px) !important; /* Adjusted for mobile */
    }
    
    .element-thermometer {
        width: 112px;
        top: 8%;
        left: 56%;
    }
    
    .element-oximeter {
        width: 196px;
        top: 46%;
        left: 65%;
    }
    
    .element-pills {
        width: 46px;
        top: 25%;
        left: 67%;
    }
}

@media (max-width: 480px) {
    .medical-hero-animation-wrapper {
        min-height: 300px;
        margin-left: 20px;
    }
    
    .hero-base-image img.base-device {
        max-width: min(400px, 80vw);
    }
    
    .flowing-lines-svg-container {
        transform: translateX(180px) !important; /* Adjusted for mobile */
    }
    
    .element-thermometer {
        width: 89px;
        top: 7%;
        left: 60%;
    }
    
    .element-oximeter {
        width: 157px;
        top: 67%;
        left: 80%;
    }
    
    .element-pills {
        width: 37px;
        top: 20%;
        left: 85%;
    }
}

/* ===== MEDICAL REPORT EXPANSION WITH CHART LINES ===== */
.medical-report-expansion-wrapper {
  background-color: #3e3bc0;
  padding: 0 !important; /* REMOVED top/bottom padding */
  min-height: 100vh;
  overflow: visible !important;
  position: relative;
  margin: 0 !important; /* Ensure no margin */
}

.report-container {
  position: relative;
  width: 66.666%;
  margin-left: 33.333% !important;
  margin-top: 0 !important; /* Force no top margin */
  padding-top: 0 !important; /* Force no top padding */
  opacity: 0.9;
  transform-origin: center center;
  will-change: transform, opacity;
  z-index: 1;
  top: 0; /* Ensure it starts at top */
}

.medical-report {
  width: 100% !important;
  height: auto !important;
  max-height: 100vh; /* Allow full viewport height */
  display: block;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  object-fit: contain;
  vertical-align: top; /* Remove any image spacing */
  display: block; /* Remove inline spacing */
}

/* Remove any potential spacing from parent */
.report-container::before,
.report-container::after {
  display: none !important;
}

/* Force image to load */
.medical-report[data-orig-src] {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ===== CHART LINES OVERLAY ===== */
.chart-lines-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.chart-lines-image {
  position: absolute;
  top: 54%;
  left: 59.5%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 685px;
  height: auto;
  opacity: 0.85;
  /* Initially hidden with clip-path */
  clip-path: inset(0 100% 0 0);
  will-change: clip-path;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Responsive adjustments for chart lines */
@media (max-width: 1024px) {
  .chart-lines-image {
    width: 85%;
  }
}

@media (max-width: 768px) {
  .chart-lines-image {
    width: 90%;
    max-width: 600px;
  }
  
  .report-container {
    width: 80%;
    margin-left: 20% !important;
  }
}

@media (max-width: 480px) {
  .chart-lines-image {
    width: 95%;
    max-width: 400px;
  }
  
  .report-container {
    width: 90%;
    margin-left: 10% !important;
  }
}

/* ===== BLOOD PRESSURE COUNTER - RESPONSIVE ===== */
.bp-counter {
    position: absolute;
    top: 140px;
    left: 1020px;
    z-index: 10;
    font-family: 'Gilroy', sans-serif;
    font-weight: 500;
    font-size: 32px; /* Changed from 36px to 32px */
    color: #6fe3d6;
    line-height: 1;
    letter-spacing: -0.5px;
    pointer-events: none;
    transition: none; /* Keep this */
}

.bp-systolic {
    display: inline-block;
}

.bp-diastolic {
    display: inline-block;
}

.bp-separator {
    display: inline-block;
    margin: 0px;
    color: #6fe3d6;
}

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .bp-counter {
        left: 1020px;
        top: 140px;
        font-size: 32px;
    }
}

/* Desktop (1025px - 1399px) */
@media (min-width: 1025px) and (max-width: 1399px) {
    .bp-counter {
        left: 800px;
        top: 120px;
        font-size: 30px;
    }
}

/* Tablet Landscape (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .bp-counter {
        left: 65%;
        top: 100px;
        font-size: 28px;
    }
}

/* Tablet Portrait (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .bp-counter {
        left: 55%;
        top: 80px;
        font-size: 26px;
    }
}

/* Mobile Large (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .bp-counter {
        left: 15px;
        top: 60px;
        font-size: 24px;
    }
}

/* Mobile Small (up to 480px) */
@media (max-width: 480px) {
    .bp-counter {
        left: 10px;
        top: 40px;
        font-size: 22px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .bp-counter {
        top: 30px;
        left: 15px;
        font-size: 22px;
    }
}