* {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

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

/* Header styles */
header {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

header.scrolled {
  padding-top: 8px;
  padding-bottom: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#refresh-btn {
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#refresh-btn:active i {
  animation: spin 0.8s ease-in-out;
}

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

.search-input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.stop-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #e5e7eb;
}

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

.favorite-btn {
  transition: all 0.2s ease;
}

.favorite-btn:hover {
  transform: scale(1.05);
}

.favorite-btn.active {
  color: #f59e0b;
}

.modern-nav {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 5;
  margin-bottom: 8px;
}

.nav-tabs-container {
  position: relative;
  z-index: 2;
}

.nav-tab {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.nav-tab i {
  font-size: 1.1em;
  transition: transform 0.2s ease;
}

.nav-tab:hover i {
  transform: scale(1.15);
}

.nav-tab.active {
  color: #e8a317;
  font-weight: 600;
}

#nav-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: linear-gradient(to right, #e8a317, #f0b94f);
  border-radius: 3px 3px 0 0;
  width: 25%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
}

.empty-state {
  background: radial-gradient(circle at center, #f8fafc 0%, #f1f5f9 100%);
}

.loading-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Remove any card-like animations for cleaner look */
.bus-time-item {
  transition: background-color 0.15s ease;
}

.bus-time-item:hover {
  background-color: #f9fafb;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile responsive for carousel */
@media (max-width: 640px) {
  .carousel-slide {
    min-width: 260px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .quick-action-btn {
    padding: 12px;
  }

  .welcome-section {
    padding: 20px;
  }
}

/* Estados visuales para tiempos de autobús */
.bus-arriving {
  color: #ef4444 !important;
  font-weight: 600;
  animation: pulse 2s infinite;
}

.bus-soon {
  color: #f59e0b !important;
  font-weight: 500;
}

.bus-later {
  color: #10b981 !important;
}

.bus-unknown {
  color: #6b7280 !important;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Chips de líneas de autobús */
.bus-line-chip {
  display: inline-flex;
  align-items: center;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  margin-right: 0.25rem;
  margin-bottom: 0.125rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.bus-line-chip:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bus-lines-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.125rem;
  margin-top: 0.25rem;
  max-width: 100%;
  overflow: hidden;
}

/* Indicadores de líneas de autobús */
.bus-lines {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Estilo para cuando hay demasiados chips */
.bus-lines-container.many-lines {
  max-height: 3rem;
  overflow: hidden;
  position: relative;
}

.bus-lines-container.many-lines .bus-line-chip:nth-child(n + 8) {
  display: none;
}

@media (max-width: 640px) {
  .bus-lines-container.many-lines .bus-line-chip:nth-child(n + 6) {
    display: none;
  }
}

/* Optimizaciones móvil */
@media (max-width: 768px) {
  .container {
    padding: 0.5rem;
  }

  .stop-card {
    margin-bottom: 0.5rem;
  }

  .search-input {
    font-size: 16px;
    /* Evita zoom en iOS */
  }

  /* Mejoras para chips de líneas en móvil */
  .bus-line-chip {
    font-size: 0.55rem;
    padding: 0.1rem 0.3rem;
    margin-right: 0.2rem;
    margin-bottom: 0.1rem;
    min-width: auto;
    max-width: 3rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bus-lines-container {
    gap: 0.1rem;
    margin-top: 0.2rem;
    line-height: 1.2;
    max-height: 2.5rem;
    overflow: hidden;
    position: relative;
  }

  /* Gradiente de fade-out para indicar que hay más chips */
  .bus-lines-container::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1rem;
    background: linear-gradient(to right, transparent, #f9fafb);
    pointer-events: none;
  }
}

.route-section {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: all 0.2s ease;
}

.route-section:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.route-header {
  background: #f9fafb;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.route-header:hover {
  background: #f3f4f6;
}

.route-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.route-icon {
  transition: transform 0.2s ease;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Carousel styles */
.carousel-container {
  position: relative;
  overflow: hidden;
  -webkit-overflow-scrolling: touch; /* Mejora el desplazamiento suave en iOS */
  touch-action: pan-y; /* Permite el desplazamiento vertical pero previene el zoom */
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
  touch-action: pan-x; /* Permite el desplazamiento horizontal */
  -webkit-user-select: none; /* Evita selección de texto */
  user-select: none;
}

.carousel-slide {
  min-width: 280px;
  margin-right: 16px;
  flex-shrink: 0;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #d1d5db;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.carousel-dot.active {
  background-color: #3b82f6;
}

.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s ease;
}

.carousel-prev:hover,
.carousel-next:hover {
  background-color: #3b82f6;
  color: white;
}

.carousel-prev {
  left: 5px;
}

.carousel-next {
  right: 5px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #d1d5db;
  cursor: pointer;
  transition: background-color 0.2s;
}

.carousel-dot.active {
  background-color: #3b82f6;
}

/* Welcome screen styles */
.welcome-section {
  background: url("../katanga.jpg") center/cover no-repeat;
  position: relative;
  color: white;
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.welcome-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1;
}

.welcome-content {
  position: relative;
  z-index: 2;
  margin-bottom: 20px;
}

.welcome-section h2,
.welcome-section p {
  position: relative;
  z-index: 2;
}

.welcome-section h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.welcome-section p {
  opacity: 1;
  font-size: 15px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Welcome section quick action buttons */
.welcome-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  position: relative;
  z-index: 2;
  margin-top: 10px;
}

.welcome-action-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.welcome-action-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.welcome-action-btn:active {
  transform: translateY(1px);
}

.welcome-action-btn i {
  font-size: 22px;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.welcome-action-btn span {
  font-size: 15px;
  font-weight: 600;
  color: #222;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
