/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Modo Diurno */
  --bg-primary: rgba(255, 255, 255, 0.95);
  --bg-secondary: rgba(248, 250, 252, 0.9);
  --bg-tertiary: rgba(255, 255, 255, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --text-primary: #1d1d1f;
  --text-secondary: #515154;
  --text-tertiary: #86868b;
  --accent-blue: #007aff;
  --accent-blue-light: rgba(0, 122, 255, 0.1);
  --accent-orange: #ff9500;
  --accent-orange-light: rgba(255, 149, 0, 0.1);
  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.2);
  --blur-amount: blur(20px);
}

[data-theme="dark"] {
  /* Modo Nocturno */
  --bg-primary: rgba(28, 28, 30, 0.95);
  --bg-secondary: rgba(44, 44, 46, 0.9);
  --bg-tertiary: rgba(58, 58, 60, 0.8);
  --bg-glass: rgba(28, 28, 30, 0.7);
  --text-primary: #ffffff;
  --text-secondary: #d1d1d6;
  --text-tertiary: #8e8e93;
  --accent-blue: #0a84ff;
  --accent-blue-light: rgba(10, 132, 255, 0.15);
  --accent-orange: #ff9f0a;
  --accent-orange-light: rgba(255, 159, 10, 0.15);
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --blur-amount: blur(20px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Estilo general */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

html[data-theme="dark"] body {
  background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%) !important;
}

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 20px 20px;
}

/* Headers */
.main-header, .instructions-header {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px 30px;
  margin-bottom: 30px;
  text-align: center;
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  box-shadow: 0 20px 60px var(--shadow-light);
}

.main-header .logo {
  max-width: 500px;
  width: 100%;
  height: auto;
  margin-bottom: 20px;
  transition: transform 0.3s ease;
}

.main-header .logo:hover {
  transform: scale(1.05);
}

.header-text h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--accent-orange);
  margin: 10px 0;
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-wrap: break-word;
  hyphens: auto;
}

/* Instructions Header */
.instructions-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.route-logo {
  background: linear-gradient(135deg, var(--accent-blue) 0%, #0056b3 100%);
  color: white;
  font-size: 1.8rem;
  font-weight: 900;
  padding: 12px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
}

.route-description {
  color: var(--accent-blue);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.instructions-text h1 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-wrap: break-word;
  hyphens: auto;
}

/* Navegación - Botón de retroceso y theme switch */
.back-button {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: var(--blur-amount);
  text-decoration: none;
  z-index: 1000;
  box-shadow: 0 4px 15px var(--shadow-light);
}

.back-button:hover {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.2);
}

.hidden {
  opacity: 0 !important;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* Theme Switch */
.theme-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
}

.theme-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.theme-toggle {
  position: relative;
  width: 60px;
  height: 32px;
  background: var(--bg-tertiary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  box-shadow: 0 4px 16px var(--shadow-light);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateX(26px);
  background: #1c1c1e;
}

.sun-icon {
  color: var(--accent-orange);
}

.moon-icon {
  color: #5E5CE6;
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: flex;
}

/* Container principal */
.container {
  margin: 40px 0;
}

/* Grid de líneas */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  padding: 0 20px;
}

.line-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px var(--shadow-light);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  text-decoration: none;
  backdrop-filter: var(--blur-amount);
  transform-origin: center;
}

.line-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 50px var(--shadow-medium);
}

.line-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: all 0.4s ease;
}

.line-card:hover img {
  transform: scale(1.05);
}

.line-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 20px;
  transform: translateY(100%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.line-card:hover .line-overlay {
  transform: translateY(0);
}

.line-info {
  color: white;
  text-align: center;
}

.line-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.line-info p {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 15px;
  opacity: 0.9;
}

.line-info i {
  font-size: 1.5rem;
  color: var(--accent-orange);
}

/* Footers */
.consultation-footer, .contact-footer, .copyright-footer {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  margin: 30px 20px;
  backdrop-filter: var(--blur-amount);
  -webkit-backdrop-filter: var(--blur-amount);
  box-shadow: 0 10px 30px var(--shadow-light);
}

.consultation-footer {
  padding: 30px;
  text-align: center;
}

.consulta-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.consulta-text i {
  font-size: 1.8rem;
}

.contact-footer {
  padding: 40px 30px;
}

.footer-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-item:hover {
  background: var(--bg-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow-light);
}

.contact-item i {
  color: var(--accent-blue);
  font-size: 20px;
  width: 24px;
  flex-shrink: 0;
}

.contact-item div {
  display: flex;
  flex-direction: column;
}

.contact-location {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.contact-number {
  font-weight: 700;
  color: var(--accent-blue);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.email-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.email-link:hover {
  color: var(--accent-orange);
  text-decoration: underline;
}

.copyright-footer {
  padding: 20px 30px;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Botón ir arriba */
#toTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  background: var(--accent-blue);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: var(--blur-amount);
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
  z-index: 1000;
}

#toTop:hover {
  background: #0056b3;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 35px rgba(0, 122, 255, 0.4);
}

/* Botón de teléfono flotante */
.phone-button {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 56px;
  height: 56px;
  background: #28a745;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: var(--blur-amount);
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
  z-index: 1001;
}

.phone-button:hover {
  background: #218838;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
}

.phone-button.active {
  background: #dc3545;
  transform: rotate(45deg);
}

.phone-button.active:hover {
  background: #c82333;
}

/* Números de teléfono */
.phone-numbers {
  position: fixed;
  bottom: 170px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  z-index: 1000;
}

.phone-numbers.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.phone-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: var(--blur-amount);
  box-shadow: 0 4px 15px var(--shadow-light);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  min-width: 200px;
}

.phone-item:hover {
  background: var(--bg-secondary);
  transform: translateY(-2px) translateX(-4px);
  box-shadow: 0 8px 25px var(--shadow-medium);
  color: var(--accent-blue);
}

.phone-item svg {
  color: var(--accent-blue);
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.phone-item:hover svg {
  transform: scale(1.1);
  color: var(--accent-orange);
}

/* Animaciones de entrada */
.main-header, .instructions-header {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-header.loaded, .instructions-header.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablets y pantallas medianas */
@media (max-width: 768px) {
  .main-container {
    padding: 70px 15px 15px;
  }

  .main-header, .instructions-header {
    padding: 30px 20px;
    margin-bottom: 20px;
    border-radius: 20px;
  }

  .header-text h1 {
    font-size: clamp(1.3rem, 5vw, 2rem);
    line-height: 1.1;
  }

  .instructions-text h1 {
    font-size: clamp(1rem, 4vw, 1.5rem);
    line-height: 1.2;
  }

  .route-logo {
    font-size: 1.5rem;
    padding: 10px 16px;
  }

  .route-description {
    font-size: 0.9rem;
  }

  .back-button, .theme-icon {
    width: 38px;
    height: 38px;
    top: 15px;
    font-size: 16px;
  }

  .back-button {
    left: 15px;
  }

  .theme-switch {
    top: 15px;
    right: 15px;
    gap: 8px;
  }

  .theme-toggle {
    width: 50px;
    height: 28px;
  }

  .theme-toggle::before {
    width: 20px;
    height: 20px;
  }

  [data-theme="dark"] .theme-toggle::before {
    transform: translateX(20px);
  }

  .image-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 0 10px;
  }

  .consultation-footer, .contact-footer, .copyright-footer {
    margin: 20px 10px;
    border-radius: 16px;
  }

  .consultation-footer {
    padding: 25px 20px;
  }

  .consulta-text {
    font-size: 1.3rem;
    flex-direction: column;
    gap: 8px;
  }

  .contact-footer {
    padding: 30px 20px;
  }

  .footer-contacts {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .contact-item {
    padding: 16px;
  }

  #toTop, .phone-button {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
    font-size: 18px;
  }

  .phone-button {
    bottom: 80px;
  }

  .phone-numbers {
    bottom: 140px;
    right: 20px;
  }

  .phone-item {
    padding: 10px 12px;
    font-size: 13px;
    min-width: 180px;
  }
}

/* Móviles pequeños */
@media (max-width: 600px) {
  .main-container {
    padding: 60px 10px 10px;
  }

  .main-header, .instructions-header {
    padding: 25px 15px;
    margin-bottom: 15px;
    border-radius: 18px;
  }

  .header-text h1 {
    font-size: clamp(1.1rem, 6vw, 1.8rem);
    line-height: 1.1;
    margin: 8px 0;
  }

  .instructions-text h1 {
    font-size: clamp(0.9rem, 4.5vw, 1.3rem);
    line-height: 1.2;
  }

  .instructions-content {
    gap: 15px;
  }

  .logo-section {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .image-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 0 5px;
  }

  .line-card img {
    height: 180px;
  }
}

/* Móviles muy pequeños */
@media (max-width: 400px) {
  .main-container {
    padding: 60px 10px 10px;
  }

  .main-header, .instructions-header {
    padding: 20px 12px;
    margin-bottom: 15px;
    border-radius: 16px;
  }

  .header-text h1 {
    font-size: clamp(1rem, 7vw, 1.5rem);
    line-height: 1.1;
    margin: 6px 0;
  }

  .instructions-text h1 {
    font-size: clamp(0.8rem, 5vw, 1.1rem);
    line-height: 1.2;
  }

  .back-button, .theme-icon {
    width: 32px;
    height: 32px;
    top: 12px;
    font-size: 14px;
  }

  .back-button {
    left: 12px;
  }

  .theme-switch {
    top: 12px;
    right: 12px;
    gap: 6px;
  }

  .theme-toggle {
    width: 44px;
    height: 24px;
  }

  .theme-toggle::before {
    width: 18px;
    height: 18px;
  }

  [data-theme="dark"] .theme-toggle::before {
    transform: translateX(18px);
  }

  .route-logo {
    font-size: 1.2rem;
    padding: 8px 12px;
  }

  .route-description {
    font-size: 0.8rem;
  }

  .main-header .logo {
    max-width: 100%;
  }

  .line-card img {
    height: 160px;
  }

  .consulta-text {
    font-size: 1.1rem;
  }

  .contact-item {
    padding: 12px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  #toTop, .phone-button {
    width: 44px;
    height: 44px;
    bottom: 16px;
    right: 16px;
    font-size: 16px;
  }

  .phone-button {
    bottom: 70px;
  }

  .phone-numbers {
    bottom: 120px;
    right: 16px;
  }

  .phone-item {
    padding: 8px 10px;
    font-size: 12px;
    min-width: 160px;
  }
}