/* ==========================================================================
   Tesla Medical Imaging Center - Custom Styles
   Design Tokens & Component Classes
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens - CLAUDE.md Section 16)
   -------------------------------------------------------------------------- */

:root {
  /* Colors */
  --color-primary: #0A1628;
  --color-secondary: #00BFA6;
  --color-accent: #4DD0E1;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F8FAFC;
  --color-bg-gray: #F1F5F9;
  --color-text: #1E293B;
  --color-text-body: #475569;
  --color-text-muted: #94A3B8;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Typography */
  --font-fa: 'Vazirmatn', system-ui, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --section-padding-mobile: 3rem;
  --section-padding-desktop: 5rem;
  --container-max: 1440px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(10, 22, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(10, 22, 40, 0.12);
  --shadow-xl: 0 24px 48px rgba(10, 22, 40, 0.16);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #0A1628 0%, #142240 50%, #1A3A5C 100%);
  --gradient-cta: linear-gradient(135deg, #00BFA6 0%, #4DD0E1 100%);
  --gradient-card: linear-gradient(180deg, rgba(0,191,166,0.05) 0%, rgba(77,208,225,0.1) 100%);
  --overlay-dark: linear-gradient(180deg, rgba(10,22,40,0.7) 0%, rgba(10,22,40,0.3) 100%);
}


/* --------------------------------------------------------------------------
   2. Alpine.js x-cloak (must be before Alpine initializes)
   -------------------------------------------------------------------------- */

[x-cloak] {
  display: none !important;
}


/* --------------------------------------------------------------------------
   3. Base Styles
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

html[dir="rtl"] body {
  font-family: var(--font-fa);
  line-height: 1.8;
}

html[dir="ltr"] body {
  font-family: var(--font-en);
  line-height: 1.6;
}


/* --------------------------------------------------------------------------
   3. Button Components (CLAUDE.md Section 6.10 & 19.1)
   -------------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  font-weight: 700;
  font-size: 0.9375rem;
  color: #FFFFFF;
  background: var(--gradient-cta);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(0, 191, 166, 0.25);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(0, 191, 166, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-sm);
  filter: brightness(0.95);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #00BFA6;
}

.btn-primary:disabled,
.btn-primary.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #00BFA6;
  background: transparent;
  border: 2px solid #00BFA6;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.4;
}

.btn-secondary:hover {
  background-color: #E0F7F4;
  color: #009688;
  transform: translateY(-1px);
}

.btn-secondary:active {
  background-color: #B2EBE0;
  transform: scale(0.98);
}

.btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #00BFA6;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #142240;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.4;
}

.btn-ghost:hover {
  background-color: #E8EAF0;
}

.btn-ghost:active {
  background-color: #C5CAD6;
  transform: scale(0.98);
}

.btn-ghost:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #2A3F5F;
}

.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #FFFFFF;
  background-color: #EF4444;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.4;
}

.btn-danger:hover {
  filter: brightness(0.9);
  background-color: #DC2626;
}

.btn-danger:active {
  background-color: #B91C1C;
  transform: scale(0.98);
}

.btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #EF4444;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button sizes */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.0625rem;
}


/* --------------------------------------------------------------------------
   4. Section Styling
   -------------------------------------------------------------------------- */

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #142240;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 2rem;
  }
}

@media (min-width: 1024px) {
  .section-title {
    font-size: 2.25rem;
  }
}

.section-subtitle {
  font-size: 1rem;
  color: var(--color-text-body);
  max-width: 36rem;
  line-height: 1.9;
}

@media (min-width: 1024px) {
  .section-subtitle {
    font-size: 1.0625rem;
  }
}


/* --------------------------------------------------------------------------
   5. Navbar Scroll Behavior
   -------------------------------------------------------------------------- */

.navbar-main {
  transition: background-color var(--transition-base),
              box-shadow var(--transition-base);
}

.navbar-main.is-scrolled {
  background-color: #FFFFFF;
  box-shadow: var(--shadow-md);
}

/* Navbar logo: white (inverted) when transparent, normal when scrolled */
.navbar-main .nav-logo-img {
  filter: brightness(0) invert(1);
  transition: filter var(--transition-base);
}

.navbar-main.is-scrolled .nav-logo-img {
  filter: none;
}

/* Navbar text colors when scrolled to white bg */
.navbar-main.is-scrolled .nav-link {
  color: #142240;
}

.navbar-main.is-scrolled .nav-link:hover {
  color: #00BFA6;
}

.navbar-main.is-scrolled .nav-cta-outline {
  border-color: #00BFA6;
  color: #00BFA6;
}

.navbar-main.is-scrolled .nav-cta-outline:hover {
  background-color: #E0F7F4;
}

.navbar-main.is-scrolled .nav-hamburger {
  color: #142240;
}


/* --------------------------------------------------------------------------
   6. Card Hover Effects (CLAUDE.md Section 6.3 & 19.3)
   -------------------------------------------------------------------------- */

.card-hover {
  transition: transform var(--transition-base),
              box-shadow var(--transition-base);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}


/* --------------------------------------------------------------------------
   7. Skeleton Loading Animation (CLAUDE.md Section 19.5)
   -------------------------------------------------------------------------- */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.skeleton {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  background-color: #E8EAF0;
  border-radius: var(--radius-md);
}


/* --------------------------------------------------------------------------
   8. Toast Notifications
   -------------------------------------------------------------------------- */

@keyframes toast-slide-in {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}

.toast-enter {
  animation: toast-slide-in 300ms ease forwards;
}

.toast-exit {
  animation: toast-slide-out 200ms ease forwards;
}


/* --------------------------------------------------------------------------
   9. WhatsApp Pulse Animation (CLAUDE.md Section 19.14)
   -------------------------------------------------------------------------- */

@keyframes whatsapp-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

.whatsapp-pulse {
  animation: whatsapp-pulse 2s infinite;
}


/* --------------------------------------------------------------------------
   10. Spinner Animation
   -------------------------------------------------------------------------- */

@keyframes spinner {
  to { transform: rotate(360deg); }
}

.animate-spinner {
  animation: spinner 0.6s linear infinite;
}


/* --------------------------------------------------------------------------
   11. Swiper Pagination Custom Styles
   -------------------------------------------------------------------------- */

.swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  background: #C5CAD6;
  opacity: 1;
  transition: all var(--transition-base);
}

.swiper-pagination-bullet-active {
  background: #00BFA6;
  width: 28px;
  border-radius: var(--radius-full);
}


/* --------------------------------------------------------------------------
   12. Scroll Progress Bar
   -------------------------------------------------------------------------- */

[data-scroll-progress] {
  background: linear-gradient(to left, #4DD0E1, #00BFA6);
}


/* --------------------------------------------------------------------------
   13. Ripple Effect on Buttons (CLAUDE.md Section 6.10)
   -------------------------------------------------------------------------- */

.btn-primary,
.btn-secondary {
  position: relative;
  overflow: hidden;
}

.btn-ripple {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: translate(-50%, -50%) scale(0);
  animation: btn-ripple 600ms ease-out forwards;
  pointer-events: none;
}

@keyframes btn-ripple {
  to {
    transform: translate(-50%, -50%) scale(80);
    opacity: 0;
  }
}


/* --------------------------------------------------------------------------
   14. Quick-Book Bar Transition
   -------------------------------------------------------------------------- */

[data-quick-book-bar] {
  transition: transform 350ms cubic-bezier(0.4, 0, 0.2, 1);
}


/* --------------------------------------------------------------------------
   15. Typing Cursor
   -------------------------------------------------------------------------- */

[data-typing]::after {
  content: '|';
  display: inline-block;
  color: #00BFA6;
  font-weight: 300;
  animation: typing-cursor 0.9s step-end infinite;
  margin-inline-start: 1px;
}

@keyframes typing-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}


/* --------------------------------------------------------------------------
   16. Insurance Tooltip
   -------------------------------------------------------------------------- */

.insurance-badge {
  position: relative;
}

.insurance-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  background: #0A1628;
  color: #FFFFFF;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 20;
}

.insurance-badge::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: #0A1628;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 20;
}

.insurance-badge:hover::after,
.insurance-badge:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* --------------------------------------------------------------------------
   17. Stats Ring Animation
   -------------------------------------------------------------------------- */

.stat-ring {
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 50ms linear;
}


/* --------------------------------------------------------------------------
   18. Service Filter Active Tab
   -------------------------------------------------------------------------- */

.filter-tab {
  transition: all var(--transition-base);
}

.filter-tab.is-active {
  background-color: #00BFA6;
  color: #FFFFFF;
  border-color: #00BFA6;
  box-shadow: 0 4px 14px rgba(0, 191, 166, 0.3);
}


/* --------------------------------------------------------------------------
   19. Doctor Card Quick-Book Button
   -------------------------------------------------------------------------- */

.doctor-book-btn {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.group:hover .doctor-book-btn {
  opacity: 1;
  transform: translateY(0);
}


/* --------------------------------------------------------------------------
   20. FAQ Accordion
   -------------------------------------------------------------------------- */

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 350ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 300ms ease;
  opacity: 0;
}

.faq-answer.is-open {
  max-height: 400px;
  opacity: 1;
}

.faq-chevron {
  transition: transform var(--transition-base);
}

.faq-item.is-open .faq-chevron {
  transform: rotate(180deg);
}


/* --------------------------------------------------------------------------
   21. CTA Section Animations
   -------------------------------------------------------------------------- */

@keyframes cta-shimmer {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

@keyframes cta-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}


/* --------------------------------------------------------------------------
   22. Print Styles (CLAUDE.md Section 19.38)
   -------------------------------------------------------------------------- */

@media print {
  .no-print,
  [data-no-print],
  .navbar-main,
  .top-bar,
  .site-footer,
  .floating-buttons,
  .cookie-consent {
    display: none !important;
  }

  body {
    background: white;
    color: black;
    font-size: 12pt;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}
