/* ==================== VARIABLES Y RESET ==================== */
:root {
  --bg-dark: #0d1117;
  --surface-dark: #161b22;
  --text-dark: #e6edf3;
  --border-dark: rgba(255,255,255,0.08);
  --bg-light: #f6f8fa;
  --surface-light: #ffffff;
  --text-light: #1f2328;
  --border-light: rgba(0,0,0,0.1);
  --accent: #3fb950;
  --accent-dim: rgba(63,185,80,0.12);
  --muted: #7d8590;
  --radius: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding-bottom: 80px;
}

body.dark {
  --bg: var(--bg-dark);
  --surface: var(--surface-dark);
  --text: var(--text-dark);
  --border: rgba(255,255,255,0.08);
  background: var(--bg-dark);
  color: var(--text-dark);
}

body.light {
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --text: var(--text-light);
  --border: rgba(0,0,0,0.1);
  background: var(--bg-light);
  color: var(--text-light);
}

/* ==================== HEADER ==================== */
header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cross {
  width: 32px;
  height: 32px;
  position: relative;
  flex-shrink: 0;
}

.cross::before,
.cross::after {
  content: '';
  position: absolute;
  background: var(--accent);
  border-radius: 3px;
}

.cross::before {
  width: 12px;
  height: 32px;
  left: 10px;
  top: 0;
}

.cross::after {
  width: 32px;
  height: 12px;
  left: 0;
  top: 10px;
}

.app-title {
  font-family: 'Bebas Neue', 'Nunito', sans-serif;
  font-size: 32px;
  color: var(--text);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-title svg {
  height: 32px;
  width: auto;
  display: block;
}

.subtitle {
  font-size: 16px;
  color: #a3a7ac;
  margin-left: 44px;
}

/* ==================== TEMA SWITCH ==================== */
.theme-switch-wrapper {
  margin-left: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.theme-switch {
  width: 52px;
  height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  position: relative;
  cursor: pointer;
}

.theme-slider {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 3px;
  transition: transform 0.2s;
}

.theme-switch.active .theme-slider {
  transform: translateX(24px);
}

.theme-label {
  font-size: 10px;
  color: #7d8590;
}

/* ==================== MAIN ==================== */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* Grid para escritorio (dos columnas) */
@media (min-width: 768px) {
  main {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 28px;
  }
}

/* Mapa fijo en escritorio */
.col-map {
  display: none;
  position: sticky;
  top: 100px;
  align-self: start;
  z-index: 5;
}

@media (min-width: 768px) {
  .col-map {
    display: block !important;
  }
}

@media (max-width: 767px) {
  .col-map {
    display: none !important;
  }
  .map-sheet {
    display: block;
  }
}

@media (min-width: 768px) {
  .map-sheet {
    display: none !important;
  }
}

/* ==================== INTRO ==================== */
#intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.intro-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  text-align: center;
}

.stats {
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==================== TARJETAS ==================== */
#lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.card-num {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  min-width: 32px;
  text-align: center;
  padding-top: 2px;
}

.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
}

.card-address {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-badge {
  margin-top: 4px;
}

.card-phone {
  display: flex;
  align-items: center;
}

/* ==================== BADGE "HOY DE TURNO" ==================== */
.badge-hoy-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.badge-hoy-inline .circulo {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  70% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

/* ==================== MAPAS ==================== */
#map-desktop {
  width: 100%;
  height: 500px;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.map-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s;
  z-index: 1000;
}

.map-sheet.open {
  transform: translateY(0);
}

.map-sheet-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.map-sheet-close {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-sheet-close svg {
  stroke: #7d8590;
  transition: stroke 0.2s;
}

.map-sheet-close:hover svg {
  stroke: var(--accent);
}

#map-mobile-sheet {
  height: 350px;
  width: 100%;
}

/* Mapa en modo "Ver todas" - tamaño fijo */
.modo-todas .col-map {
  min-width: 518px !important;
}

.modo-todas #map-desktop {
  height: 500px !important;
  width: 518px !important;
}

/* ==================== BOTONES FLOTANTES ==================== */
.btn-todas, .btn-volver {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 140px;
  height: 48px;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-family: 'Nunito', sans-serif;
}

.btn-todas {
  background: var(--accent);
  color: white;
}

.btn-todas:hover {
  transform: translateY(-2px);
  background: #2c974b;
}

.btn-volver {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-volver:hover {
  transform: translateY(-2px);
  background: rgba(0, 0, 0, 0.85);
}

.light .btn-volver {
  background: rgba(255, 255, 255, 0.9);
  color: #1f2328;
  border-color: rgba(0, 0, 0, 0.1);
}

.scroll-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top-btn svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2.5;
}

/* ==================== BOTÓN INSTALAR ==================== */
.btn-instalar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 40px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Nunito', sans-serif;
}

.btn-instalar svg {
  stroke: white;
}

.btn-instalar:hover {
  transform: translateX(-50%) scale(1.02);
  background: #2c974b;
}

/* ==================== MODAL iOS ==================== */
.ios-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.ios-modal-content {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  max-width: 300px;
  text-align: center;
  border: 1px solid var(--border);
  position: relative;
}

.ios-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
  display: flex;
}

.ios-modal-close svg {
  stroke: #7d8590;
  width: 18px;
  height: 18px;
}

.ios-modal-content p {
  margin: 16px 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ios-modal-content ol {
  text-align: left;
  margin: 16px 0;
  padding-left: 20px;
  font-size: 13px;
}

.ios-modal-content li {
  margin: 12px 0;
}

.entendido-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  width: 100%;
}

/* ==================== FOOTER ==================== */
.footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: #7d8590;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.code-symbol {
  color: var(--accent);
  font-weight: 600;
}

/* ==================== FOOTER LINKS ==================== */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 12px 0;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-mis-proyectos {
  margin: 12px 0;
}

.footer-mis-proyectos a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.footer-mis-proyectos a:hover {
  text-decoration: underline;
}

.footer-copyright {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.badge-github {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

body.light .badge-github {
  color: #1a3d1a;
  background: rgba(63, 185, 80, 0.15);
}

.badge-github:hover {
  background: rgba(63, 185, 80, 0.25);
  transform: translateY(-1px);
  text-decoration: none;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .btn-todas, .btn-volver {
    width: 120px;
    height: 44px;
    font-size: 12px;
  }

  .scroll-top-btn {
    width: 44px;
    height: 44px;
  }

  .btn-instalar {
    bottom: 80px;
    font-size: 12px;
    padding: 8px 16px;
  }

  .card {
    flex-wrap: wrap;
  }

  .card-phone {
    margin-left: auto;
  }
  
  .footer-links {
    gap: 10px;
  }
  
  .footer-links a {
    font-size: 11px;
  }
}

/* ==================== BADGE VERSIÓN ==================== */
.badge {
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 20px;
}

/* ==================== TELÉFONO Y ENLACES ==================== */
.phone-link {
  background: var(--accent-dim);
  padding: 5px 10px;
  border-radius: 20px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.phone-link:hover {
  background: rgba(63, 185, 80, 0.2);
  transform: scale(1.02);
}

/* ==================== ICONOS SVG ==================== */
.icon-location svg,
.icon-phone svg,
.icon-intro svg,
.icon-stats svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
}

/* ==================== OFFLINE ALERT ==================== */
.offline-alert {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid #f85149;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f85149;
}

/* ==================== GOOGLE MAPS LINK ==================== */
.gmaps-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
}

.gmaps-link:hover {
  text-decoration: underline;
}

/* ==================== ACCESIBILIDAD: FOCUS VISIBLE ==================== */
.card:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 30px;
}
