/* 
 * Dental Care Website Stylesheet
 * Custom styles supplementing Tailwind CSS
 */

/* ==========================================================================
   1. CSS Custom Properties
   ========================================================================== */
:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --secondary: #0EA5E9;
  --accent: #10B981;
  --bg-light: #F8FAFC;
  --bg-dark: #0F172A;
  --text-light: #1E293B;
  --text-dark: #F1F5F9;
  --radius: 0.75rem;
  --radius-full: 9999px;
  --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. Base Styles
   ========================================================================== */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', sans-serif;
  transition: background-color 0.3s, color 0.3s;
}

::selection {
  background-color: var(--primary);
  color: white;
}

/* ==========================================================================
   3. Navigation Styles
   ========================================================================== */
#navbar {
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

#navbar.scrolled {
  box-shadow: 0 4px 30px rgba(0,0,0,0.1);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 0.125rem; /* h-0.5 */
  background-color: var(--primary);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

#mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

#mobile-menu.open {
  transform: translateX(0);
}

/* ==========================================================================
   4. Hero Section
   ========================================================================== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.hero-illustration {
  animation: float 6s ease-in-out infinite;
}

@keyframes pulse-shadow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(37, 99, 235, 0); }
}

.btn-pulse {
  animation: pulse-shadow 2s ease-in-out infinite;
}

/* ==========================================================================
   5. Scroll Animations
   ========================================================================== */
.scroll-animate {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children animations */
.scroll-animate-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate-children.visible > *:nth-child(1) { transition-delay: 0.1s; }
.scroll-animate-children.visible > *:nth-child(2) { transition-delay: 0.2s; }
.scroll-animate-children.visible > *:nth-child(3) { transition-delay: 0.3s; }
.scroll-animate-children.visible > *:nth-child(4) { transition-delay: 0.4s; }
.scroll-animate-children.visible > *:nth-child(5) { transition-delay: 0.5s; }
.scroll-animate-children.visible > *:nth-child(6) { transition-delay: 0.6s; }
.scroll-animate-children.visible > *:nth-child(7) { transition-delay: 0.7s; }
.scroll-animate-children.visible > *:nth-child(8) { transition-delay: 0.8s; }

.scroll-animate-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Slide-in variants */
.scroll-animate-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-animate-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-animate-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-animate-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================================================
   6. Service Cards
   ========================================================================== */
.service-card {
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.service-card:hover::before {
  transform: scaleX(1);
}

/* ==========================================================================
   7. Team Cards
   ========================================================================== */
.team-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.team-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.team-card .social-icons {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.team-card:hover .social-icons {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   8. Before/After Gallery Slider
   ========================================================================== */
.before-after-slider {
  position: relative;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
}

.ba-before, .ba-after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.ba-after {
  clip-path: inset(0 0 0 50%);
  transition: clip-path 0.05s ease;
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: white;
  cursor: ew-resize;
  z-index: 10;
  transform: translateX(-50%);
}

.ba-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ba-handle::after {
  content: '◀ ▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: var(--primary);
  white-space: nowrap;
  letter-spacing: 4px;
}

/* Gallery filter transition */
.gallery-item {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.gallery-item.hidden {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  position: absolute;
}

/* ==========================================================================
   9. Lightbox Modal
   ========================================================================== */
#gallery-lightbox {
  border: none;
  border-radius: 1rem;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  background: transparent;
}

#gallery-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   10. Testimonial Carousel
   ========================================================================== */
#testimonial-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.testimonial-card {
  flex-shrink: 0;
}

.testimonial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.testimonial-dot.active {
  background: var(--primary);
  transform: scale(1.3);
}

/* ==========================================================================
   11. Pricing Cards
   ========================================================================== */
.pricing-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pricing-card:hover {
  transform: translateY(-5px);
}

.pricing-card.popular {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   12. Booking Form
   ========================================================================== */
/* Step indicators */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  border: 2px solid #e2e8f0;
  color: #94a3b8;
  background: white;
  transition: all 0.3s ease;
}

.step-dot.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.step-dot.completed {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.step-line {
  width: 60px;
  height: 2px;
  background: #e2e8f0;
  transition: background 0.3s ease;
}

.step-line.active {
  background: var(--primary);
}

.step-line.completed {
  background: var(--accent);
}

/* Booking step transitions */
.booking-step {
  display: none;
  animation: fadeIn 0.4s ease;
}

.booking-step.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Success animation */
#booking-success {
  display: none;
}

#booking-success.show {
  display: flex;
}

@keyframes checkmark {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.success-checkmark {
  animation: checkmark 0.6s ease forwards;
}

/* Form inputs */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
  background: white;
}

.dark .form-input {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:user-valid {
  border-color: var(--accent);
}

.form-input:user-invalid {
  border-color: #ef4444;
}

/* ==========================================================================
   13. Booking Modal
   ========================================================================== */
#booking-modal {
  border: none;
  border-radius: 1.5rem;
  padding: 2rem;
  max-width: 550px;
  width: 90%;
  background: white;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.dark #booking-modal {
  background: #1e293b;
}

#booking-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

/* ==========================================================================
   14. Back to Top Button
   ========================================================================== */
#back-to-top {
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  transform: translateY(-3px);
}

/* ==========================================================================
   15. Newsletter Form
   ========================================================================== */
#newsletter-form input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary);
}

/* ==========================================================================
   16. Counter Animation
   ========================================================================== */
.counter-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   17. Utility Classes
   ========================================================================== */
/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glass morphism */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass {
  background: rgba(0, 0, 0, 0.2);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .scroll-animate,
  .scroll-animate-left,
  .scroll-animate-right,
  .scroll-animate-children > * {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   18. Responsive Overrides
   ========================================================================== */
@media (max-width: 768px) {
  .before-after-slider {
    height: 200px;
  }
  .ba-handle::before {
    width: 32px;
    height: 32px;
  }
}
