/* Care U Diagnostic & Polyclinic - Animated Background & Micro-Interactions System */

/* ==========================================================================
   1. KEYFRAMES FOR TRANSITIONS AND MOTION LOOPS
   ========================================================================== */

/* Subtle background gradient movement */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Soft upward drifting motion */
@keyframes floatSoft {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -10px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Soft reverse/downward drifting motion */
@keyframes floatReverse {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(2px, 8px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Gentle opacity and size breathing */
@keyframes pulseSoft {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.03); }
}

/* Reusable fade and entry keyframes */
@keyframes fadeUp {
  0% { opacity: 0; transform: translate3d(0, 20px, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideLeft {
  0% { opacity: 0; transform: translate3d(25px, 0, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes slideRight {
  0% { opacity: 0; transform: translate3d(-25px, 0, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes scaleIn {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

/* Reflected glass shimmer glow */
@keyframes shimmer {
  0% { transform: translateX(-150%) skewX(-25deg); }
  100% { transform: translateX(150%) skewX(-25deg); }
}

/* Heartbeat ECG path drawing */
@keyframes heartbeatDraw {
  0% { stroke-dashoffset: 1200; }
  70%, 100% { stroke-dashoffset: 0; }
}

/* Gentle shaking for call icons */
@keyframes shakePhone {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

/* Breathing glow for WhatsApp action */
@keyframes breatheGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); }
  50% { box-shadow: 0 0 16px 4px rgba(37, 211, 102, 0.2); }
}

/* Moving highlight flow for gradient border */
@keyframes borderFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


/* ==========================================================================
   2. GLOBAL ANIMATED BACKGROUND LAYERS
   ========================================================================== */

.site-background {
  position: fixed;
  inset: 0;
  z-index: -10;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(135deg, #F8FCFF 0%, #EFF8FC 35%, #F1FAF4 70%, #FFFFFF 100%);
  background-size: 300% 300%;
  animation: gradientShift 22s ease-in-out infinite;
}

/* Blurred colored circular layers */
.gradient-orb {
  position: absolute;
  border-radius: 9999px;
  pointer-events: none;
  mix-blend-mode: multiply;
  will-change: transform;
}

.orb-blue {
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, rgba(22, 139, 194, 0.16) 0%, rgba(91, 192, 235, 0.04) 70%);
  filter: blur(80px);
  top: -10%;
  left: -5%;
  animation: floatSoft 18s ease-in-out infinite;
}

.orb-green {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(47, 138, 76, 0.12) 0%, rgba(120, 198, 122, 0.03) 70%);
  filter: blur(90px);
  top: 25%;
  right: -8%;
  animation: floatReverse 22s ease-in-out infinite;
}

.orb-gold {
  width: 38vw;
  height: 38vw;
  background: radial-gradient(circle, rgba(182, 148, 85, 0.06) 0%, transparent 75%);
  filter: blur(75px);
  bottom: -5%;
  left: 8%;
  animation: floatSoft 26s ease-in-out infinite alternate;
}

/* Repeating medical cross pattern backdrop */
.medical-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M25 5h10v20h20v10H35v20H25V35H5V25h20V5z' fill='%23123B73' fill-opacity='0.5' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: repeat;
}


/* ==========================================================================
   3. HERO PAGE DESIGN ELEMENTS
   ========================================================================== */

.hero-animated-bg {
  background: linear-gradient(120deg, rgba(22, 139, 194, 0.14), rgba(47, 138, 76, 0.10), rgba(255, 255, 255, 0.98), rgba(182, 148, 85, 0.07));
  background-size: 250% 250%;
  animation: gradientShift 14s ease-in-out infinite;
}

/* Cardiac heartbeat waves */
.hero-heartbeat {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: heartbeatDraw 9s cubic-bezier(0.25, 1, 0.5, 1) infinite;
}

/* Floating icons in hero background */
.floating-icon {
  position: absolute;
  pointer-events: none;
  opacity: 0.12;
  will-change: transform;
}

.floating-icon-1 { top: 12%; left: 8%; animation: floatSoft 6s ease-in-out infinite; }
.floating-icon-2 { top: 40%; left: 55%; animation: floatReverse 8s ease-in-out infinite; }
.floating-icon-3 { bottom: 15%; left: 15%; animation: floatSoft 7s ease-in-out infinite 1s; }
.floating-icon-4 { top: 22%; right: 12%; animation: floatReverse 9s ease-in-out infinite 0.5s; }


/* ==========================================================================
   4. GLASS AND BORDER EFFECTS
   ========================================================================== */

.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 24px -4px rgba(18, 59, 115, 0.05);
}

/* Animated gradient highlights */
.card-highlight {
  position: relative;
  isolation: isolate;
}

.card-highlight::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(90deg, #123B73, #168BC2, #2F8A4C, #B69455, #123B73);
  background-size: 300% 300%;
  animation: borderFlow 12s linear infinite;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}

.card-highlight:hover::before {
  opacity: 0.95;
}


/* ==========================================================================
   5. INTERACTIVE COMPONENT HOVER EFFECTS
   ========================================================================== */

/* Hover interactions for list cards */
.interactive-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.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.interactive-card:hover {
  transform: translate3d(0, -5px, 0);
  box-shadow: 0 12px 28px -4px rgba(18, 59, 115, 0.12);
  border-color: rgba(22, 139, 194, 0.4);
}

/* Gentle image zooms inside card headers */
.interactive-card:hover img {
  transform: scale(1.03);
}

/* Touch active compression states for mobile */
.interactive-card:active {
  transform: scale3d(0.99, 0.99, 1);
  box-shadow: 0 4px 10px -2px rgba(18, 59, 115, 0.08);
}


/* ==========================================================================
   6. CTA BUTTON EFFECTS AND SHIMMERS
   ========================================================================== */

.btn-primary-animated {
  position: relative;
  overflow: hidden;
  background-size: 200% auto;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-position 0.4s ease;
}

.btn-primary-animated:hover {
  transform: translate3d(0, -1.5px, 0);
  box-shadow: 0 6px 16px rgba(47, 138, 76, 0.3);
  background-position: right center;
}

.btn-primary-animated:active {
  transform: translate3d(0, 0, 0);
}

/* Shimmer overlay wrapper */
.shimmer-trigger {
  position: relative;
  overflow: hidden;
}

.shimmer-trigger::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: translateX(-100%);
}

.shimmer-trigger:hover::after {
  animation: shimmer 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Custom shimmer cycle for appointment CTA button */
.shimmer-btn-loop::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 150%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: translateX(-150%) skewX(-20deg);
  animation: shimmer 7s ease-in-out infinite;
}

/* WhatsApp slow breath interaction */
.wa-breathing {
  animation: breatheGreen 3.5s infinite;
  transition: transform 0.3s ease;
}

.wa-breathing:hover {
  transform: scale(1.03);
}

/* Call Shake interaction on hover */
.call-btn-shake:hover svg {
  animation: shakePhone 0.4s ease-in-out 2;
}


/* ==========================================================================
   7. SCROLL REVEAL (INTERSECTION OBSERVER) TRANSITIONS
   ========================================================================== */

/* Initially hidden only if JavaScript is supported/active */
html.js .reveal-up {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity 0.7s cubic-bezier(0.215, 0.61, 0.355, 1), 
              transform 0.7s cubic-bezier(0.215, 0.61, 0.355, 1);
}

html.js .reveal-left {
  opacity: 0;
  transform: translate3d(24px, 0, 0);
  transition: opacity 0.7s cubic-bezier(0.215, 0.61, 0.355, 1), 
              transform 0.7s cubic-bezier(0.215, 0.61, 0.355, 1);
}

html.js .reveal-right {
  opacity: 0;
  transform: translate3d(-24px, 0, 0);
  transition: opacity 0.7s cubic-bezier(0.215, 0.61, 0.355, 1), 
              transform 0.7s cubic-bezier(0.215, 0.61, 0.355, 1);
}

html.js .reveal-scale {
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.7s cubic-bezier(0.215, 0.61, 0.355, 1), 
              transform 0.7s cubic-bezier(0.215, 0.61, 0.355, 1);
}

html.js .reveal-fade {
  opacity: 0;
  transition: opacity 0.7s ease;
}

/* Fully revealed visible state triggered by JS class adding */
html.js .reveal-visible {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
}

/* Staggered card entrance for dynamically generated elements */
.doctor-card-entrance {
  opacity: 0;
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}



/* ==========================================================================
   8. RESPONSIVE ANIMATION CONTROLS (TABLET & MOBILE)
   ========================================================================== */

/* Tablet & Mobile tweaks */
@media (max-width: 1023px) {
  .orb-gold {
    display: none; /* remove third gold orb to save rendering cost */
  }
  .orb-blue {
    width: 60vw;
    height: 60vw;
    filter: blur(60px);
  }
  .orb-green {
    width: 55vw;
    height: 55vw;
    filter: blur(70px);
    top: 40%;
  }
  .floating-icon {
    display: none; /* disable floating icons on tablet and mobile to save repaint cycles */
  }
}

/* Mobile specific overrides */
@media (max-width: 639px) {
  .site-background {
    animation-duration: 32s; /* slow down shifting to prevent battery strain */
  }
  .orb-blue {
    width: 70vw;
    height: 70vw;
    filter: blur(50px);
    opacity: 0.10;
  }
  .orb-green {
    width: 65vw;
    height: 65vw;
    filter: blur(55px);
    opacity: 0.08;
  }
  
  /* Disable hover lift and shadows to keep scroll performance smooth */
  .interactive-card:hover {
    transform: none !important;
    box-shadow: 0 4px 20px -2px rgba(18, 59, 115, 0.08) !important;
    border-color: #D9E5EF !important;
  }
  .interactive-card:hover img {
    transform: none !important;
  }
}


/* ==========================================================================
   9. REDUCED MOTION PREFERENCES (ACCESSIBILITY COMPLIANCE)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: scroll !important;
    scroll-behavior: auto !important;
    transition-delay: 0s !important;
    transition-duration: 0s !important;
  }
  
  .site-background,
  .hero-animated-bg {
    animation: none !important;
    background-position: 0 0 !important;
  }
  
  .gradient-orb {
    animation: none !important;
    transform: none !important;
  }
  
  .floating-icon,
  .hero-heartbeat {
    animation: none !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
  
  .shimmer-trigger::after,
  .shimmer-btn-loop::after {
    display: none !important;
  }
  
  html.js .reveal-up,
  html.js .reveal-left,
  html.js .reveal-right,
  html.js .reveal-scale,
  html.js .reveal-fade {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
