/**
 * Custom CSS for St. Jude Medcare Centre Website
 * Complements Tailwind CSS utility classes
 * Includes animations, gradients, and custom component styles
 */

/* ============================================
   Core Document Styles
   ============================================ */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 25%, #ffffff 50%, #f1f5f9 75%, #f8fafc 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ============================================
   Professional Background Patterns & Textures
   ============================================ */

/* Subtle geometric pattern overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(5, 150, 105, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(16, 185, 129, 0.01) 0%, transparent 50%);
  background-size: 300px 300px, 200px 200px, 400px 400px;
  background-position: 0 0, 100px 100px, 200px 200px;
  background-attachment: fixed;
  pointer-events: none;
  z-index: -1;
}

/* Professional section backgrounds */
.bg-professional-light {
  background: linear-gradient(145deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.9) 100%);
  backdrop-filter: blur(10px);
}

.bg-professional-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.98) 100%);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

/* Enhanced section styling */
section {
  position: relative;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 0%, rgba(255, 255, 255, 0.02) 50%, transparent 100%);
  pointer-events: none;
}

/* ============================================
   Image Quality Optimization
   ============================================ */

#hero-section {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  background-attachment: scroll;
}

/* Responsive background image behavior */
@media (max-width: 640px) {
  #hero-section {
    background-size: cover !important;
    background-position: center center !important;
    min-height: 80vh !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  #hero-section {
    background-size: cover !important;
    background-position: center center !important;
    min-height: 85vh !important;
  }
}

@media (min-width: 1025px) {
  #hero-section {
    background-size: cover !important;
    background-position: center center !important;
    min-height: 90vh !important;
  }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
  #hero-section {
    min-height: 75vh !important;
    background-position: center 20% !important; /* Slightly adjust position for mobile */
  }
}

#hero-section[style*="background-image"] {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* High-quality image rendering for all background images */
.bg-cover {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: bicubic;
}

/* Optimize image loading and quality */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: bicubic;
}

/* ============================================
   Keyframe Animations
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(22, 163, 74, 0.3),
                0 0 10px rgba(22, 163, 74, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(22, 163, 74, 0.5),
                0 0 40px rgba(22, 163, 74, 0.3);
  }
}

@keyframes shimmerWave {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  10%, 30% {
    transform: scale(0.9);
  }
  20%, 40%, 60%, 80%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   Hero Section & Gradients
   ============================================ */

.hero-gradient {
  background-image: radial-gradient(circle at top left, #e0f2fe, transparent 55%),
    radial-gradient(circle at bottom right, #ecfeff, transparent 55%);
  animation: shimmerWave 3s linear infinite;
}

.hero-section {
  animation: honey 2s ease-in-out infinite;
}

.hero-title {
  animation: fadeInUp 1s ease-out 0.4s backwards;
  font-size: clamp(1.875rem, 5vw, 3.75rem);
}

.gradient-primary {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.gradient-overlay {
  position: relative;
  overflow: hidden;
}

.gradient-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.1), transparent);
  pointer-events: none;
}

/* ============================================
   Card Component Animations
   ============================================ */

.card-hover {
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1),
              background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(22, 163, 74, 0.1), 
              0 4px 6px rgba(22, 163, 74, 0.05);
  background-color: rgba(22, 163, 74, 0.05);

}

/* ============================================
   Scroll-Based Animation Classes
   ============================================ */

.animate-on-scroll {
  animation: fadeInUp 0.8s ease-out forwards;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  opacity: 0;
  transform: translateY(30px);
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.8s ease-out forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.8s ease-out forwards;
}

.animate-slide-up {
  animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-slide-down {
  animation: slideDown 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-rotate-in {
  animation: rotateIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-shake {
  animation: shake 0.8s ease-out forwards;
}

.animate-heartbeat {
  animation: heartbeat 1s ease-out forwards;
}

.animate-pulse-light {
  animation: pulse 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

/* Stagger animations for multiple elements */
.animate-on-scroll:nth-child(1) { animation-delay: 0s; }
.animate-on-scroll:nth-child(2) { animation-delay: 0.1s; }
.animate-on-scroll:nth-child(3) { animation-delay: 0.2s; }
.animate-on-scroll:nth-child(4) { animation-delay: 0.3s; }
.animate-on-scroll:nth-child(5) { animation-delay: 0.4s; }
.animate-on-scroll:nth-child(6) { animation-delay: 0.5s; }

/* ============================================
   Button Animations
   ============================================ */

.btn-primary {
  @apply inline-flex items-center rounded-full bg-primary-600 px-6 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-primary-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: left 0.5s ease;
  z-index: 0;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary span {
  position: relative;
  z-index: 1;
}

/* ============================================
   Button Styles & States
   ============================================ */

.btn-primary {
  @apply inline-flex items-center rounded-full bg-primary-600 px-6 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-primary-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2;
}

.btn-secondary {
  @apply inline-flex items-center rounded-full border border-slate-300 px-6 py-2.5 text-sm font-semibold text-slate-700 shadow-sm transition hover:border-primary-500 hover:text-primary-600 hover:shadow-md;
}

.btn-outline {
  @apply inline-flex items-center rounded-full border border-primary-300 px-6 py-2.5 text-sm font-semibold text-primary-600 shadow-sm transition hover:bg-primary-50 hover:border-primary-500;
}

/* ============================================
   Form Elements & Inputs
   ============================================ */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
textarea,
select {
  @apply block w-full rounded-md border border-slate-300 px-4 py-2 text-base text-slate-900 shadow-sm transition placeholder:text-slate-500 focus:border-primary-500 focus:ring-2 focus:ring-primary-500 focus:ring-opacity-50;
}

textarea {
  @apply resize-vertical;
}

input[type="checkbox"],
input[type="radio"] {
  @apply h-4 w-4 text-primary-600 transition border-slate-300 rounded focus:ring-primary-500;
}

label {
  @apply block text-sm font-medium text-slate-700;
}

/* ============================================
   Typography & Text Utilities
   ============================================ */

.text-gradient {
  @apply bg-gradient-to-r from-primary-600 to-primary-700 bg-clip-text text-transparent;
}

.underline-hover {
  position: relative;
}

.underline-hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width 300ms ease;
}

.underline-hover:hover::after {
  width: 100%;
}

/* ============================================
   Navigation Enhancements
   ============================================ */

header {
  position: relative;
  z-index: 13;
}

nav a:focus-visible {
  @apply outline-none ring-2 ring-primary-500 ring-offset-2 rounded;
}

/* ============================================
   Alert & Notification Styles
   ============================================ */

.alert {
  @apply rounded-lg px-4 py-3 text-sm border;
}

.alert-success {
  @apply border-emerald-200 bg-emerald-50 text-emerald-800;
}

.alert-error {
  @apply border-red-200 bg-red-50 text-red-800;
}

.alert-warning {
  @apply border-yellow-200 bg-yellow-50 text-yellow-800;
}

.alert-info {
  @apply border-blue-200 bg-blue-50 text-blue-800;
}

/* ============================================
   Badge & Tag Styles
   ============================================ */

.badge {
  @apply inline-flex items-center rounded-full px-3 py-1 text-xs font-semibold;
}

.badge-primary {
  @apply bg-primary-50 text-primary-700;
}

.badge-gray {
  @apply bg-slate-100 text-slate-700;
}

.badge-green {
  @apply bg-emerald-50 text-emerald-700;
}

/* ============================================
   Separator & Divider
   ============================================ */

.divider {
  @apply border-b border-slate-200;
}

/* ============================================
   Loading & Shimmer Effects
   ============================================ */

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #fff 50%,
    #f0f0f0 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ============================================
   Scroll & Floating Elements
   ============================================ */

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 40;
}

.floating-action {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
}

/* ============================================
   Responsive Utilities
   ============================================ */

@media (max-width: 640px) {
  .hidden-mobile {
    display: none;
  }
}

/* ============================================
   Partners Scrolling Animation
   ============================================ */

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.animate-scroll {
  animation: scroll 30s linear infinite;
}

.partners-scroll {
  position: relative;
  overflow: hidden;
}

.partners-track {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  will-change: transform;
}

.partners-item {
  flex-shrink: 0;
}

.partners-scroll:hover .animate-scroll {
  animation-play-state: paused;
}

@media (min-width: 768px) {
  .hidden-desktop {
    display: none;
  }
}

