/* Custom styles with smooth transitions */
:root {
  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --secondary: #059669;
  --secondary-dark: #047857;
}

/* Accessibility: Skip Navigation Links */
.skip-links {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 1000;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: top 0.3s ease;
  z-index: 1001;
}

.skip-link:focus {
  top: 6px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Accessibility: Focus Management */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Accessibility: High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --primary: #0000ff;
    --secondary: #008000;
  }

  .skip-link {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
  }
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile-First Enhancements */
.mobile-optimized {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Touch-friendly buttons */
@media (max-width: 768px) {

  button,
  a,
  [role="button"] {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
    /* Prevents zoom on iOS */
  }
}

/* Mobile navigation enhancements */
@media (max-width: 768px) {
  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: white;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .mobile-menu:not(.hidden) {
    transform: translateX(0);
  }

  .mobile-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .mobile-menu-backdrop:not(.hidden) {
    opacity: 1;
    visibility: visible;
  }
}

/* Mobile splash screen */
#mobile-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}

/* Pull-to-refresh indicator */
#pull-to-refresh {
  position: fixed;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
  transition: top 0.3s ease;
}

/* Mobile touch feedback */
.touchable {
  transition: transform 0.1s ease;
}

.touchable:active {
  transform: scale(0.95);
}

/* Mobile-specific animations */
@media (max-width: 768px) {
  * {
    --animation-duration: 0.3s;
  }

  [class*="animate"] {
    animation-duration: 0.3s !important;
  }
}

/* Mobile orientation support */
.portrait {
  /* Portrait-specific styles */
}

.landscape {
  /* Landscape-specific styles */
}

/* Mobile keyboard handling */
@media (max-width: 768px) {

  input:focus,
  textarea:focus,
  select:focus {

    transform: translateY(-10px);
    transition: transform 0.3s ease;
  }
}

/* Mobile image optimization */
@media (max-width: 768px) {
  img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
  }

  img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
  }

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

/* Mobile form enhancements */
@media (max-width: 768px) {
  .form-input {
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 8px;
  }

  .form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
  }
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
  .mobile-optimized {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
  }
}

* {
  scroll-behavior: smooth;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Enhanced Navigation */
.navbar-scrolled {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.97);
  transform: translateY(0);
}

.nav-link {
  position: relative;
  padding: 0.5rem 0;
  transition: all 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

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

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

/* Enhanced mobile menu */
.mobile-menu {
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  transform-origin: top;
  opacity: 0;
  transform: scaleY(0) translateY(-20px);
  display: none;
}

.mobile-menu.open {
  display: flex;
  opacity: 1;
  transform: scaleY(1) translateY(0);
}

/* Enhanced CTA button */
.cta-button {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  z-index: 1;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: all 0.6s ease;
  z-index: -1;
}

.cta-button:hover::before {
  left: 100%;
}

/* Logo animation */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.logo:hover {
  animation: pulse 1s infinite;
}

/* Mobile menu button animation */
.menu-line {
  transition: all 0.3s ease;
}

.menu-open .menu-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-open .menu-line:nth-child(2) {
  opacity: 0;
}

.menu-open .menu-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Hero section overlay gradient */
.hero-overlay {
  background: linear-gradient(to right, rgba(30, 64, 175, 0.8), rgba(5, 150, 105, 0.7));
}

/* Service cards hover effect */
.service-card {
  transition: all 0.3s ease;
}

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

/* Testimonial carousel */
.testimonial-container {
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

.testimonial-slide {
  scroll-snap-align: start;
  flex: 0 0 auto;
}

/* Form validation styles */
.form-input:invalid {
  border-color: #f87171;
}

.form-input:valid {
  border-color: #34d399;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* Loading animation */
.loading-dots {
  display: inline-flex;
}

.loading-dots span {
  animation: loading 1.4s infinite ease-in-out both;
  background-color: currentColor;
  border-radius: 50%;
  display: inline-block;
  height: 8px;
  margin: 0 2px;
  width: 8px;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loading {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Live chat styles - Fixed for mobile */
#chat-box {
  transition: all 0.3s ease;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Responsive hero image */
.hero-image {
  background-image: url('https://images.unsplash.com/photo-1581578731548-c64695cc6952?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=600&q=80');
  background-size: cover;
  background-position: center;
}

@media (min-width: 640px) {
  .hero-image {
    background-image: url('https://images.unsplash.com/photo-1581578731548-c64695cc6952?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80');
  }
}

@media (min-width: 768px) {
  .hero-image {
    background-image: url('https://images.unsplash.com/photo-1581578731548-c64695cc6952?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1000&q=80');
  }
}

@media (min-width: 1024px) {
  .hero-image {
    background-image: url('https://images.unsplash.com/photo-1581578731548-c64695cc6952?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1200&q=80');
  }
}

@media (min-width: 1280px) {
  .hero-image {
    background-image: url('https://images.unsplash.com/photo-1581578731548-c64695cc6952?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1600&q=80');
  }
}

/* Improved accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus styles for better accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Improved contrast for accessibility */
.text-blue-100 {
  color: rgb(219, 234, 254);
}

/* Mobile sticky CTA fix */
.sticky-cta {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}

/* WebSocket Chat Styles */
.typing-dots {
  display: inline-flex;
  align-items: center;
  height: 20px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  margin: 0 1px;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

.chat-message {
  max-width: 80%;
  word-wrap: break-word;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
}

.chat-message.guest {
  background: #f1f5f9;
  border-radius: 18px 18px 18px 4px;
  margin-right: auto;
  text-align: left;
}

.chat-message.admin {
  background: #1e40af;
  color: white;
  border-radius: 18px 18px 4px 18px;
  margin-left: auto;
  text-align: right;
}

.chat-message.system {
  background: #e5e7eb;
  border-radius: 12px;
  margin: 8px auto;
  text-align: center;
  font-style: italic;
  max-width: 90%;
}

.chat-timestamp {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 4px;
  display: block;
}

#typing-indicator {
  transition: all 0.3s ease;
}

.unread-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  background: #1e40af;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  color: white;
}

.chat-toggle:hover {
  background: #1e3a8a;
  transform: scale(1.05);
}

.connection-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid white;
  transition: all 0.3s ease;
}

.connection-indicator.connected {
  background: #10b981;
}

.unread-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
}

.chat-window {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 350px;
  height: 450px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: none;
}

.chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  display: flex;
}

.chat-header {
  background: #1e40af;
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-status {
  font-size: 12px;
  opacity: 0.9;
}

.chat-header-actions {
  display: flex;
  gap: 5px;
}

.minimize-btn,
.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.minimize-btn:hover,
.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8fafc;
}

.message {
  margin-bottom: 15px;
  animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-content {
  max-width: 85%;
  padding: 10px 15px;
  border-radius: 18px;
  word-wrap: break-word;
  line-height: 1.4;
}

.user-message .message-content {
  background: #1e40af;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.admin-message .message-content {
  background: white;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.system-message .message-content {
  background: #f3f4f6;
  color: #6b7280;
  margin: 0 auto;
  text-align: center;
  border-radius: 12px;
  font-size: 14px;
}

.message-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 5px;
  text-align: right;
}

.user-message .message-time {
  text-align: right;
}

.admin-message .message-time {
  text-align: left;
}

.typing-indicator {
  padding: 15px;
  background: white;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
  display: none;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingDot {

  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.typing-text {
  font-size: 12px;
  color: #6b7280;
}

.chat-input-container {
  background: white;
  border-top: 1px solid #e5e7eb;
}

.user-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  display: none;
}

.user-info input {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}

.user-info input:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.user-info button {
  background: #1e40af;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.user-info button:hover {
  background: #1e3a8a;
}

.chat-input-area {
  display: flex;
  padding: 15px;
  gap: 10px;
  align-items: flex-end;
}

#chat-input-enhanced {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 40px;
}

#chat-input-enhanced:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

#chat-send-enhanced {
  background: #1e40af;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#chat-send-enhanced:hover:not(:disabled) {
  background: #1e3a8a;
  transform: scale(1.05);
}

#chat-send-enhanced:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

/* Responsive Testimonials Section */
@media (max-width: 768px) {
  #testimonials {
    padding: 2rem 1rem;
  }

  #testimonials h2 {
    font-size: 1.75rem;
  }

  #testimonials .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #reviews-container {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .testimonial-card {
    padding: 1.5rem !important;
    margin-bottom: 1rem;
  }

  .testimonial-card img {
    width: 60px !important;
    height: 60px !important;
    margin-top: -2rem !important;
  }

  .testimonial-card p {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  /* Google Rating Section */
  #testimonials .flex.items-center {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

  #testimonials .flex.items-center span {
    font-size: 0.875rem;
  }

  /* Submit Review Button */
  #submit-review-btn {
    width: 100%;
    max-width: 300px;
    padding: 0.875rem 1.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  #testimonials h2 {
    font-size: 1.5rem;
  }

  #testimonials p {
    font-size: 0.875rem;
  }

  .testimonial-card {
    padding: 1rem !important;
  }

  .testimonial-card p {
    font-size: 0.85rem;
  }
}

/* Responsive Container and Spacing */
@media (max-width: 768px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  section {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .chat-widget-enhanced {
    bottom: 90px !important;
    /* Position above sticky buttons */
    right: 15px;
    z-index: 60;
    /* Higher than sticky CTA */
  }

  .chat-window {
    width: calc(100vw - 30px) !important;
    right: -15px !important;
    height: 400px;
    bottom: 75px !important;
  }

  .chat-toggle {
    width: 55px;
    height: 55px;
  }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.connection-status {
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 10px;
  border-radius: 5px;
  z-index: 10000;
  font-weight: bold;
}

.connection-status.connected {
  background: #4CAF50;
  color: white;
}

.connection-status.disconnected {
  background: #f44336;
  color: white;
}

.connection-status.connecting {
  background: #ff9800;
  color: white;
}

/* Remove conflicting styles */
#chat-widget,
#chat-box,
.desktop-chat-toggle,
.mobile-chat-toggle,
#chat-toggle,
#chat-toggle-mobile {
  all: unset;
}