/**
 * Fountain Life Premium Team Section Styles
 * Award-winning UI/UX Design - Medical Team Cards
 * Inspired by: Fountain Life, Apple Health, Luxury Medical Aesthetics
 */

/* ==========================================================================
   CSS Variables & Configuration
   ========================================================================== */
:root {
  /* Neon Colors - Gold & Navy Theme */
  --fl-neon-primary: #c8a45a;
  --fl-neon-secondary: #0a1628;
  --fl-neon-accent: #e6c97a;
  
  /* Background */
  --fl-bg-dark: #0a0a14;
  --fl-bg-gradient-start: #0d0d1a;
  --fl-bg-gradient-mid: #151528;
  --fl-bg-gradient-end: #0a0a14;
  
  /* Card */
  --fl-card-bg: rgba(255, 255, 255, 0.03);
  --fl-card-border: rgba(200, 164, 90, 0.15);
  --fl-card-glow: rgba(200, 164, 90, 0.15);
  
  /* Timing */
  --fl-timing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --fl-timing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fl-timing-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ==========================================================================
   Main Section Container
   ========================================================================== */
.fl-team {
  position: relative;
  min-height: 100vh;
  padding: 40px 0 120px;
  overflow: hidden;
  background: var(--fl-bg-dark);
  isolation: isolate;
  margin-top: 0;
}

/* ==========================================================================
   Background Layers System
   ========================================================================== */
.fl-team__bg-layers {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* Animated Gradient Background */
.fl-team__gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    var(--fl-bg-gradient-start) 0%,
    var(--fl-bg-gradient-mid) 50%,
    var(--fl-bg-gradient-end) 100%
  );
  animation: flGradientShift 20s ease-in-out infinite;
}

@keyframes flGradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Noise Texture Overlay */
.fl-team__noise {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Neon Orb - Floating Light Effect */
.fl-team__neon-orb {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    var(--fl-neon-primary) 0%,
    rgba(200, 164, 90, 0.4) 30%,
    rgba(10, 22, 40, 0.2) 60%,
    transparent 70%
  );
  filter: blur(80px);
  opacity: 0.6;
  animation: flOrbFloat 25s ease-in-out infinite, flOrbPulse 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes flOrbFloat {
  0%, 100% {
    transform: translate(-50%, -50%) translate(0, 0);
  }
  25% {
    transform: translate(-50%, -50%) translate(100px, -50px);
  }
  50% {
    transform: translate(-50%, -50%) translate(-50px, 80px);
  }
  75% {
    transform: translate(-50%, -50%) translate(-80px, -30px);
  }
}

@keyframes flOrbPulse {
  0%, 100% {
    opacity: 0.4;
    filter: blur(80px);
  }
  50% {
    opacity: 0.7;
    filter: blur(100px);
  }
}

/* Background Image (when enabled) */
.fl-team__bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.15;
}

/* Background Video (when enabled) */
.fl-team__video-wrapper {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.fl-team__video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
}

.fl-team__video-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.7);
  pointer-events: none;
}

/* Glass Effect Overlay */
.fl-team__glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0%,
    transparent 30%,
    transparent 70%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
}

/* ==========================================================================
   Content Container
   ========================================================================== */
.fl-team__container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Header */
.fl-team__header {
  text-align: center;
  margin-bottom: 50px;
}

.fl-team__subtitle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--fl-neon-primary);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px);
  animation: flFadeInUp 0.8s var(--fl-timing-smooth) 0.2s forwards;
}

.fl-team__subtitle::before,
.fl-team__subtitle::after {
  content: '';
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--fl-neon-primary));
}

.fl-team__subtitle::after {
  background: linear-gradient(90deg, var(--fl-neon-primary), transparent);
}

.fl-team__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 300;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(30px);
  animation: flFadeInUp 0.8s var(--fl-timing-smooth) 0.4s forwards;
}

.fl-team__title strong {
  font-weight: 700;
  background: linear-gradient(135deg, var(--fl-neon-primary), var(--fl-neon-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fl-team__description {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.6);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
  opacity: 0;
  transform: translateY(20px);
  animation: flFadeInUp 0.8s var(--fl-timing-smooth) 0.6s forwards;
}

@keyframes flFadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Cards Grid
   ========================================================================== */
.fl-team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  perspective: 1000px;
}

/* ==========================================================================
   Premium Card Design
   ========================================================================== */
.fl-card {
  position: relative;
  background: var(--fl-card-bg);
  border-radius: 32px;
  overflow: hidden;
  cursor: pointer;
  transform-style: preserve-3d;
}

/* Staggered entrance timing for cards (used by JS) */
.fl-card:nth-child(1) { --card-index: 0; }
.fl-card:nth-child(2) { --card-index: 1; }
.fl-card:nth-child(3) { --card-index: 2; }
.fl-card:nth-child(4) { --card-index: 3; }
.fl-card:nth-child(5) { --card-index: 4; }
.fl-card:nth-child(6) { --card-index: 5; }
.fl-card:nth-child(7) { --card-index: 6; }
.fl-card:nth-child(8) { --card-index: 7; }

/* Idle floating animation */
@keyframes flCardFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Glow effect layer */
.fl-card__glow {
  position: absolute;
  inset: -2px;
  border-radius: 34px;
  background: linear-gradient(
    135deg,
    rgba(200, 164, 90, 0.3),
    rgba(10, 22, 40, 0.2),
    rgba(230, 201, 122, 0.1)
  );
  opacity: 0;
  filter: blur(20px);
  transition: opacity 0.5s var(--fl-timing-smooth);
  z-index: -1;
}

.fl-card:hover .fl-card__glow {
  opacity: 1;
}

/* Glass morphism border */
.fl-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 32px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(200, 164, 90, 0.25),
    rgba(200, 164, 90, 0.05),
    rgba(200, 164, 90, 0.15)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Dynamic shadow */
.fl-card__shadow {
  position: absolute;
  bottom: -30px;
  left: 10%;
  right: 10%;
  height: 60px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
  filter: blur(20px);
  opacity: 0.5;
  transition: all 0.5s var(--fl-timing-smooth);
}

.fl-card:hover .fl-card__shadow {
  bottom: -40px;
  opacity: 0.7;
  filter: blur(30px);
}

/* ==========================================================================
   Card Visual Section (Image)
   ========================================================================== */
.fl-card__visual {
  position: relative;
  height: 340px;
  overflow: hidden;
}

.fl-card__image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.fl-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--fl-timing-smooth);
}

.fl-card:hover .fl-card__image {
  transform: scale(1.08);
}

/* Light reflection effect */
.fl-card__light {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 60%
  );
  transform: translateX(-100%) rotate(25deg);
  transition: transform 0.8s var(--fl-timing-smooth);
  pointer-events: none;
}

.fl-card:hover .fl-card__light {
  transform: translateX(100%) rotate(25deg);
}

/* Internal gradient overlay */
.fl-card__internal-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(
    to top,
    rgba(10, 22, 40, 0.95) 0%,
    rgba(10, 22, 40, 0.6) 50%,
    transparent 100%
  );
  pointer-events: none;
}

/* Accent line animation */
.fl-card__accent-line {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--fl-neon-primary), var(--fl-neon-accent));
  transition: width 0.5s var(--fl-timing-smooth);
}

.fl-card:hover .fl-card__accent-line {
  width: 100%;
}

/* ==========================================================================
   Card Content Section
   ========================================================================== */
.fl-card__content {
  position: relative;
  padding: 28px 32px 36px;
  background: linear-gradient(180deg, rgba(10, 22, 40, 0.85), rgba(10, 22, 40, 0.98));
}

.fl-card__specialty {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fl-neon-primary);
  margin-bottom: 12px;
  padding: 6px 14px;
  background: rgba(200, 164, 90, 0.1);
  border-radius: 20px;
  border: 1px solid rgba(200, 164, 90, 0.25);
}

.fl-card__name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.fl-card:hover .fl-card__name {
  color: var(--fl-neon-accent);
}

.fl-card__position {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
}

.fl-card__bio {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 20px;
}

/* CTA Button */
.fl-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fl-neon-primary);
  text-decoration: none;
  padding: 10px 0;
  position: relative;
  overflow: hidden;
}

.fl-card__cta::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--fl-neon-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--fl-timing-smooth);
}

.fl-card:hover .fl-card__cta::after {
  transform: scaleX(1);
  transform-origin: left;
}

.fl-card__cta-icon {
  display: inline-flex;
  transition: transform 0.3s var(--fl-timing-smooth);
}

.fl-card:hover .fl-card__cta-icon {
  transform: translateX(4px);
}

/* ==========================================================================
   Hover State - Full Card
   ========================================================================== */
.fl-card:hover {
  animation-play-state: paused; /* Pause float on hover */
  transform: translateY(-12px) scale(1.02);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(200, 164, 90, 0.1);
}

/* ==========================================================================
   Entrance & Exit Animations (Scroll Triggered)
   ========================================================================== */

/* Initial state - hidden */
.fl-card {
  opacity: 0;
  transform: translateY(80px) rotateX(15deg) scale(0.9);
  transition: 
    opacity 0.7s var(--fl-timing-smooth),
    transform 0.7s var(--fl-timing-smooth);
}

/* Visible state - entrance complete */
.fl-card.fl-visible {
  opacity: 1;
  transform: translateY(0) rotateX(0) scale(1);
}

/* Exit animation - disabled */
.fl-card.fl-exit {
  opacity: 1 !important;
  transform: translateY(0) rotateX(0) scale(1) !important;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.fl-team__empty {
  text-align: center;
  padding: 80px 40px;
  color: rgba(255, 255, 255, 0.5);
}

.fl-team__empty-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1200px) {
  .fl-team__grid {
    gap: 30px;
  }
  
  .fl-team__container {
    padding: 0 30px;
  }
}

@media (max-width: 992px) {
  .fl-team {
    padding: 80px 0;
  }
  
  .fl-team__header {
    margin-bottom: 60px;
  }
  
  .fl-team__neon-orb {
    width: 400px;
    height: 400px;
  }
  
  .fl-card__visual {
    height: 300px;
  }
}

@media (max-width: 768px) {
  .fl-team {
    padding: 60px 0;
  }
  
  .fl-team__container {
    padding: 0 20px;
  }
  
  .fl-team__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .fl-team__title {
    font-size: 2rem;
  }
  
  .fl-team__description {
    font-size: 1rem;
  }
  
  .fl-card {
    border-radius: 24px;
  }
  
  .fl-card::before {
    border-radius: 24px;
  }
  
  .fl-card__glow {
    border-radius: 26px;
  }
  
  .fl-card__visual {
    height: 280px;
  }
  
  .fl-card__content {
    padding: 24px;
  }
  
  .fl-card__name {
    font-size: 1.25rem;
  }
  
  /* Disable float animation on mobile */
  .fl-card {
    animation: none;
  }
  
  .fl-card.fl-visible {
    transform: translateY(0);
  }
  
  .fl-card:hover {
    transform: translateY(-8px);
  }
}

@media (max-width: 480px) {
  .fl-team__header {
    margin-bottom: 40px;
  }
  
  .fl-team__subtitle {
    font-size: 10px;
  }
  
  .fl-team__subtitle::before,
  .fl-team__subtitle::after {
    width: 20px;
  }
  
  .fl-card__visual {
    height: 240px;
  }
  
  .fl-team__neon-orb {
    width: 300px;
    height: 300px;
    filter: blur(60px);
  }
}

/* ==========================================================================
   Reduced Motion Preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .fl-card,
  .fl-team__gradient,
  .fl-team__neon-orb,
  .fl-team__subtitle,
  .fl-team__title,
  .fl-team__description {
    animation: none;
  }
  
  .fl-card {
    opacity: 1;
    transform: none;
  }
  
  .fl-card:hover {
    transform: scale(1.02);
  }
}

/* ==========================================================================
   Customizer: Light Theme Variant (Optional)
   ========================================================================== */
.fl-team--light {
  --fl-bg-dark: #f8f9fc;
  --fl-bg-gradient-start: #ffffff;
  --fl-bg-gradient-mid: #f0f2f8;
  --fl-bg-gradient-end: #e8eaf0;
  --fl-card-bg: rgba(255, 255, 255, 0.8);
  --fl-card-border: rgba(0, 0, 0, 0.08);
}

.fl-team--light .fl-team__title {
  color: #1a1a2e;
}

.fl-team--light .fl-team__description {
  color: rgba(26, 26, 46, 0.7);
}

.fl-team--light .fl-card__content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 252, 1));
}

.fl-team--light .fl-card__name {
  color: #1a1a2e;
}

.fl-team--light .fl-card__position,
.fl-team--light .fl-card__bio {
  color: rgba(26, 26, 46, 0.6);
}

.fl-team--light .fl-card__internal-gradient {
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
}

/* ==========================================================================
   Custom Neon Color (Set via inline style or Customizer)
   ========================================================================== */
.fl-team[data-neon-color] .fl-team__neon-orb {
  background: radial-gradient(
    circle,
    var(--custom-neon-color, var(--fl-neon-primary)) 0%,
    rgba(var(--custom-neon-rgb, 0, 212, 255), 0.4) 30%,
    transparent 70%
  );
}

/* ==========================================================================
   Animation Variants (Customizer Options)
   ========================================================================== */

/* No Animation Mode */
.fl-team--no-animation .fl-card {
  animation: none !important;
}

.fl-team--no-animation .fl-card.fl-visible {
  opacity: 1;
  transform: translateY(0) rotateX(0) scale(1);
}

.fl-team--no-animation .fl-team__neon-orb {
  animation: flOrbPulse 8s ease-in-out infinite;
}

/* Pulse Animation Variant */
.fl-team[data-animation="pulse"] .fl-card.fl-visible:not(.fl-exit):not(:hover) {
  animation: flCardPulse 4s ease-in-out infinite;
  animation-delay: calc(var(--card-index, 0) * 0.3s);
}

@keyframes flCardPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35), 0 0 40px rgba(200, 164, 90, 0.1);
  }
}

/* Float Animation (Default) - only when visible */
.fl-team[data-animation="float"] .fl-card.fl-visible:not(.fl-exit):not(:hover) {
  animation: flCardFloat 6s ease-in-out infinite;
  animation-delay: calc(var(--card-index, 0) * 0.5s);
}

/* Pause animations on hover for all variants */
.fl-team[data-animation="pulse"] .fl-card:hover,
.fl-team[data-animation="float"] .fl-card:hover {
  animation-play-state: paused;
}
