/* ========================================
   NearFix — Custom Styles
   ======================================== */

/* --- Smooth Scrolling & Base --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  overflow-x: hidden;
}

::selection {
  background-color: #F5A623;
  color: #1C1C1E;
}

/* --- Brand Gradient Text --- */
.text-gradient {
  background: linear-gradient(135deg, #F5A623 0%, #E5941C 50%, #D4830F 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Primary Button --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #F5A623;
  color: #1C1C1E;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.btn-primary:hover {
  background-color: #E5941C;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 166, 35, 0.35);
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:active {
  transform: translateY(0);
}

/* --- Secondary Button --- */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  color: #1C1C1E;
  border: 1.5px solid #EFEFF1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  border-color: #F5A623;
  color: #F5A623;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* --- Navbar States --- */
#navbar {
  background: transparent;
}

#navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* --- Hero Background Glow --- */
.hero-glow {
  position: absolute;
  top: 20%;
  right: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --- Scroll Animations --- */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-up.delay-100 {
  transition-delay: 0.1s;
}

.fade-up.delay-200 {
  transition-delay: 0.2s;
}

.fade-up.delay-300 {
  transition-delay: 0.3s;
}

/* --- Stat Card Animation --- */
.stat-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

/* --- Service Card Hover --- */
.service-card .bg-white {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-card:hover .bg-white {
  transform: translateY(-4px);
}

/* --- Mobile Menu Animation --- */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-menu.open {
  display: block;
  max-height: 500px;
}

/* --- Hamburger Animation --- */
.hamburger-active .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-active .hamburger-line:nth-child(3) {
  width: 1.5rem;
  transform: translateY(-8px) rotate(-45deg);
}

/* --- Nav Link Hover Effect --- */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #F5A623;
  border-radius: 1px;
  transition: width 0.3s ease;
}

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

/* --- Counter Animation Highlight --- */
.counter-done {
  animation: counterPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes counterPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* --- Pulse Dot --- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- Testimonial Carousel Dots --- */
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EFEFF1;
  transition: all 0.3s ease;
  cursor: pointer;
}

.carousel-dot.active {
  background: #F5A623;
  width: 24px;
  border-radius: 4px;
}

/* --- Smooth Image Loading --- */
img {
  opacity: 0;
  transition: opacity 0.5s ease;
}

img.loaded,
img[src] {
  opacity: 1;
}

/* Force images visible even before JS runs */
img {
  opacity: 1;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* --- Focus States for Accessibility --- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #F5A623;
  outline-offset: 2px;
  border-radius: 8px;
}

/* --- Chat Bubble Typing Animation --- */
@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .hero-glow {
    width: 300px;
    height: 300px;
    top: 10%;
    right: -10%;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 2.25rem !important;
    line-height: 1.2 !important;
  }

  h2 {
    font-size: 1.75rem !important;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn-primary:hover,
  .btn-secondary:hover {
    transform: none;
  }

  .stat-card:hover,
  .service-card:hover .bg-white {
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ========================================
   Scroll-Triggered Waitlist Modal
   ======================================== */

.nf-hidden {
  display: none !important;
}

.nf-waitlist-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.33, 1, 0.68, 1);
}

.nf-waitlist-overlay.nf-open {
  opacity: 1;
  pointer-events: auto;
}

.nf-waitlist-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  padding: 32px;
  color: #1C1C1E;
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition:
    opacity 220ms cubic-bezier(0.33, 1, 0.68, 1),
    transform 220ms cubic-bezier(0.33, 1, 0.68, 1);
}

.nf-waitlist-overlay.nf-open .nf-waitlist-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.nf-waitlist-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(244, 244, 246, 0.9);
  color: #6B7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.nf-waitlist-close span {
  font-size: 18px;
  line-height: 1;
}

.nf-waitlist-close:hover {
  background: #E5E7EB;
  color: #111827;
  transform: translateY(-1px);
}

.nf-waitlist-close:active {
  transform: translateY(0);
}

.nf-waitlist-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #92400E;
  background: rgba(245, 166, 35, 0.08);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  margin-bottom: 1rem;
}

.nf-waitlist-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #F97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.3);
}

.nf-waitlist-title {
  font-size: 1.6rem;
  line-height: 1.2;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.nf-waitlist-subtitle {
  font-size: 0.95rem;
  color: #6B7280;
  margin-bottom: 1.4rem;
}

.nf-waitlist-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nf-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nf-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4B5563;
}

.nf-required {
  color: #DC2626;
  margin-left: 0.15rem;
}

.nf-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  padding: 0.7rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #111827;
  background: #FFFFFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nf-input::placeholder {
  color: #9CA3AF;
}

.nf-input:focus-visible {
  outline: 2px solid #F5A623;
  outline-offset: 0;
  border-color: #F5A623;
  box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.45);
}

.nf-input.nf-input-error {
  border-color: #DC2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.25);
}

.nf-error {
  font-size: 0.75rem;
  min-height: 1em;
  color: #DC2626;
}

.nf-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.nf-segmented-option {
  border-radius: 999px;
  border: 1px solid #E5E7EB;
  background: #F9FAFB;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #4B5563;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.nf-segmented-option:hover {
  background: #F3F4F6;
  transform: translateY(-1px);
}

.nf-segmented-option.nf-selected {
  background: rgba(245, 166, 35, 0.1);
  border-color: #F5A623;
  color: #92400E;
  box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.4);
}

.nf-waitlist-footer {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nf-microcopy {
  font-size: 0.75rem;
  color: #9CA3AF;
}

.nf-btn-primary {
  position: relative;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: #F5A623;
  color: #1C1C1E;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  overflow: hidden;
  transition:
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.nf-btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.nf-btn-primary:hover:not(:disabled) {
  background: #E5941C;
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(245, 166, 35, 0.35);
}

.nf-btn-primary:hover:not(:disabled)::before {
  transform: translateX(100%);
}

.nf-btn-primary:disabled {
  opacity: 0.7;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.nf-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: #1C1C1E;
  animation: nf-spin 0.7s linear infinite;
  display: none;
}

.nf-btn-primary.nf-loading .nf-spinner {
  display: inline-block;
}

.nf-btn-primary.nf-loading .nf-btn-label {
  opacity: 0.8;
}

@keyframes nf-spin {
  to {
    transform: rotate(360deg);
  }
}

.nf-btn-secondary {
  border-radius: 999px;
  border: 1px solid #E5E7EB;
  background: #FFFFFF;
  color: #111827;
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.nf-btn-secondary:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.nf-btn-secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.nf-waitlist-success {
  text-align: center;
  padding-top: 0.5rem;
}

.nf-success-icon {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  margin: 0 auto 0.75rem;
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.nf-success-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.nf-success-body {
  font-size: 0.9rem;
  color: #6B7280;
  margin-bottom: 1.1rem;
}

@media (max-width: 480px) {
  .nf-waitlist-modal {
    padding: 24px 20px 22px;
    border-radius: 18px;
  }

  .nf-waitlist-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
