/* styles.css */

/* Core styles */
:root {
  --transition-speed: 0.3s;
  --primary-color: #007BFF;
  --secondary-color: #0056b3;
}

/* Performance optimizations */
* {
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* General Styles */
body {
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape */
}

.container {
  max-width: 1200px;
}

/* Ensure links are tappable */
a {
  -webkit-tap-highlight-color: rgba(0,0,0,0); /* Remove tap highlight */
  touch-action: manipulation; /* Improve tap responsiveness */
}

/* Dark mode transitions */
html.dark,
.dark body,
.dark input,
.dark select,
.dark textarea,
.dark .bg-white {
  transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

/* Dark mode styles */
.dark body {
  background-color: #1a202c;
  color: #e2e8f0;
}

/* Form inputs in dark mode */
.dark input,
.dark select,
.dark textarea {
  background-color: #374151;
  border-color: #4b5563;
  color: #e2e8f0;
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.dark input,
.dark select,
.dark textarea {
  background-color: #374151;
  border-color: #4b5563;
  color: #e2e8f0;
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

/* Ensure buttons are visible in dark mode */
.dark .bg-blue-600 {
  background-color: #2563eb;
}

.dark .bg-blue-600:hover {
  background-color: #1d4ed8;
}

/* Improved dark mode */
.dark {
  color-scheme: dark;
}

/* Header and Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  transition: all 0.3s ease-in-out;
}

/* Light mode header */
header {
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header nav ul li a {
  color: #1a202c;
  transition: color 0.3s ease-in-out;
}

/* Navigation styles */
header nav ul li a {
  color: #1a202c;
  transition: all 0.3s ease-in-out;
  position: relative;
  text-decoration: none;
  padding: 0.5rem 0;
}

header nav ul li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  background-color: #3b82f6;
  transition: width 0.3s ease, left 0.3s ease;
}

header nav ul li a:hover::after {
  width: 100%;
  left: 0;
}

.dark header nav ul li a {
  color: #e2e8f0;
}

.dark header nav ul li a::after {
  background-color: #60a5fa;
}

/* Mobile menu adjustments */
@media (max-width: 768px) {
  header nav ul li a::after {
    display: none;
  }
  
  header nav ul li a {
    padding: 0.5rem;
    display: inline-block;
    width: 100%;
  }
  
  header nav ul li a:hover {
    background-color: rgba(59, 130, 246, 0.1);
  }
}

/* Dark mode header */
.dark header {
  background-color: #1a202c;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dark header nav ul li a {
  color: #e2e8f0;
}

.dark header .text-gray-800 {
  color: #e2e8f0;
}

.dark header nav ul li a:hover {
  color: #60a5fa;
}

/* Mobile menu in dark mode */
.dark header nav ul {
  background-color: #1a202c;
  border: 1px solid #374151;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

header .logo {
  flex: 1;
}

header nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

header .theme-toggle {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  header nav {
    position: static;
    transform: none;
  }
}

/* Hero Section */
#inicio {
  min-height: 400px; /* Asegura una altura mínima para la sección hero */
  display: flex;
  align-items: center;
  justify-content: center;
}

#inicio .container > div {
  padding: 4rem 2rem;
}

/* "¿Cómo funciona?" Section */
#funcionamiento .grid-cols-3 > div {
  border-radius: 0.5rem;
}

#funcionamiento i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #e0f2f7; /* Light blue background for icons */
  color: #007BFF;
  margin-bottom: 1rem;
}

/* "Consultas y Soluciones" Section */
#consultas .grid-cols-2 > div {
  border-radius: 0.5rem;
}

/* Soporte Form Section */
#soporte .max-w-3xl {
  border-radius: 0.5rem;
}

#soporte label {
  display: block;
  margin-bottom: 0.5rem;
}

#soporte input[type="text"],
#soporte input[type="tel"],
#soporte input[type="email"],
#soporte select,
#soporte textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: inherit;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#soporte input[type="text"]:focus,
#soporte input[type="tel"]:focus,
#soporte input[type="email"]:focus,
#soporte select:focus,
#soporte textarea:focus {
  border-color: #007BFF;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

#soporte input[type="file"] + div {
  padding: 2rem;
}

/* Enhanced form styles */
.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-group label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-50%) scale(0.8);
  background: var(--bg-color);
  padding: 0 0.5rem;
  transition: all var(--transition-speed);
}

/* Loading spinner */
.loading-indicator {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-top: 3px solid #007BFF;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* FAQ Section */
#faq details {
  border-radius: 0.5rem;
}

#faq summary::marker {
  font-size: 0; /* Hide the default marker */
}

#faq summary::before {
  content: "\f059"; /* Font Awesome question mark icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 0.5rem;
  color: #007BFF;
}

#faq summary {
  list-style: none; /* Remove default arrow */
}

#faq summary::-webkit-details-marker {
  display: none; /* Remove the triangle in Chrome and Safari */
}

/* Contact Section */
#contacto .grid-cols-2 > div {
  border-radius: 0.5rem;
}

#contacto i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: #e0f2f7; /* Light blue background for icons */
  color: #007BFF;
  margin-bottom: 1rem;
}

#contacto a i {
  transition: color 0.3s ease-in-out;
}

#contacto a:hover i {
  opacity: 0.8;
}

/* Footer */
footer {
  font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header nav ul {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    width: 100%;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    display: none; /* Hide by default on smaller screens */
  }

  header nav ul.open {
    display: flex; /* Show when the 'open' class is added (if you implement a mobile menu toggle) */
  }

  header nav ul li {
    margin-bottom: 0.5rem;
  }

  header nav ul li:last-child {
    margin-bottom: 0;
  }

  #funcionamiento .grid-cols-1,
  #funcionamiento .grid-cols-3 {
    grid-template-columns: 1fr;
  }

  #consultas .grid-cols-1,
  #consultas .grid-cols-2 {
    grid-template-columns: 1fr;
  }

  #contacto .grid-cols-1,
  #contacto .grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* Scroll behavior (optional, but good for smooth scrolling) */
html.scroll-smooth {
  scroll-behavior: smooth;
}

/* Back-to-top button */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: none;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 50%;
  padding: 10px 15px;
  cursor: pointer;
  z-index: 1000;
}

#backToTop:hover {
  background-color: #0056b3;
}

/* Animations */
.fade-in {
  animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Enhanced animations */
@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.slide-in {
  animation: slideIn 0.5s ease-out forwards;
}

/* Lazy loading styles */
.lazyload {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.lazyload.lazyloaded {
  opacity: 1;
}

/* Testimonials Section */
#testimonials .grid-cols-3 > div {
  border-radius: 0.5rem;
}

/* Our Services Section */
#services {
  padding: 4rem 0;
  background-color: #f8fafc;
}
#services .service-item {
  background-color: #fff;
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  transition: transform 0.3s ease-in-out;
}
#services .service-item:hover {
  transform: translateY(-10px);
}

/* Theme transition improvements */
.theme-transition,
.theme-transition *,
.theme-transition *:before,
.theme-transition *:after {
  transition: all 0.3s !important;
  transition-delay: 0 !important;
}