/* ========================================
   Royal Dental Whittier - Custom Styles
   ======================================== */

:root {
  --transition-base: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Animations ---- */
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

@keyframes float-delayed {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-15px) scale(1.03); }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--glow-rgb, 37,119,235), 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(var(--glow-rgb, 37,119,235), 0); }
}

.animate-float { animation: float 6s ease-in-out infinite; }
.animate-float-delayed { animation: float-delayed 8s ease-in-out infinite 2s; }
.animate-fade-in-up { animation: fade-in-up 0.6s ease forwards; }
.animate-pulse-glow { animation: pulse-glow 2s infinite; }

/* ---- Navbar ---- */
#navbar.scrolled { box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08); }

.nav-link { position: relative; }
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-primary, #2577eb);
  transition: all 0.3s ease;
  transform: translateX(-50%);
  border-radius: 2px;
}
.nav-link:hover::after, .nav-link.active::after { width: 60%; }

/* ---- Service Cards ---- */
.service-card { position: relative; overflow: hidden; }
.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-accent, #eab308), var(--color-accent-dark, #ca8a04));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}
.service-card:hover::before { transform: scaleX(1); }

/* ---- Before/After Slider ---- */
.ba-slider {
  position: relative;
  overflow: hidden;
  cursor: col-resize;
  user-select: none;
  border-radius: 1rem;
}
.ba-slider img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ba-before {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}
.ba-after {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  clip-path: inset(0 50% 0 0);
}
.ba-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 4px;
  background: white;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  z-index: 10;
  transform: translateX(-50%);
}
.ba-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.ba-handle::before {
  content: '\f337';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  color: #333;
  font-size: 14px;
}

/* ---- Back to Top ---- */
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ---- Floating Lang Toggle ---- */
#floating-lang-toggle {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#floating-lang-toggle.visible {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ---- Booking Widget ---- */
#booking-widget .animate-fade-in-up {
  animation: fade-in-up 0.3s ease forwards;
}

/* ---- Blog ---- */
.blog-card { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.blog-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.1); }

.blog-content h2 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 1rem; color: #1a1a2e; }
.blog-content h3 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: #1a1a2e; }
.blog-content p { margin-bottom: 1rem; line-height: 1.8; color: #4b5563; }
.blog-content ul, .blog-content ol { margin: 1rem 0; padding-left: 1.5rem; }
.blog-content li { margin-bottom: 0.5rem; line-height: 1.7; color: #4b5563; }
.blog-content strong { color: #1f2937; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  #home { min-height: 80vh; }
}
@media (max-width: 768px) {
  #home { min-height: auto; padding-top: 3rem; padding-bottom: 5rem; }
  #floating-lang-toggle { top: auto; bottom: 80px; right: 1rem; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ---- Selection ---- */
::selection { background: var(--color-primary, #2577eb); color: white; }

/* ---- Print ---- */
@media print {
  nav, #back-to-top, #floating-lang-toggle, #booking-widget, .animate-float { display: none !important; }
  section { break-inside: avoid; }
}
