/*
 * DISEÑO MOBILE-FIRST PROFESIONAL PARA GUÍAS DE VIAJE
 * Optimizado para dispositivos móviles
 */

/* ===== VARIABLES CSS ===== */
:root {
  /* Colores principales */
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --secondary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;

  /* Texto */
  --text-dark: #111827;
  --text-light: #374151;
  --text-lighter: #4b5563;

  /* Fondos */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;

  /* Bordes */
  --border: #e5e7eb;
  --border-light: #f3f4f6;

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* Radios */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Espaciado */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
}

/* ===== RESET Y BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-dark);
  background: var(--bg-secondary);
  line-height: 1.7;
  overflow-x: hidden;
  font-weight: 500;
}

/* ===== TIPOGRAFÍA ===== */
h1 {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-dark);
  font-weight: 500;
  line-height: 1.7;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
}

/* ===== CONTENEDOR ===== */
.container {
  width: 100%;
  padding: var(--spacing-md);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
    padding: var(--spacing-lg);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}

/* ===== HEADER ===== */
header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  max-width: 1024px;
  margin: 0 auto;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

.view-topbar {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
}

@media (min-width: 768px) {
  .view-topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.view-title-wrap h1 {
  margin-bottom: var(--spacing-xs);
}

.view-title-wrap p {
  margin-bottom: 0;
  color: var(--text-light);
  font-size: 0.9375rem;
}

/* ===== BOTONES ===== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 12px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.btn-primary, .create-btn {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover, .create-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-info {
  background: #0ea5e9;
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-info:hover {
  background: #0284c7;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--secondary);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.0625rem;
}

.btn-full {
  width: 100%;
}

.btn-login {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  backdrop-filter: blur(10px);
}

.btn-login:hover {
  background: white;
  color: var(--primary);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 8px 16px;
  background: var(--bg-tertiary);
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.back-button:hover {
  background: var(--border);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== TARJETAS ===== */
.card, .destination-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: var(--spacing-md);
  transition: all 0.2s;
}

.card:hover, .destination-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.destination-card h3 {
  color: var(--text-dark);
  margin-bottom: var(--spacing-sm);
}

.destination-card p {
  margin-bottom: var(--spacing-md);
  font-size: 0.9375rem;
}

.destination-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

/* ===== FORMULARIOS ===== */
.form-group {
  margin-bottom: var(--spacing-lg);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--text-dark);
  font-size: 0.9375rem;
}

input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-dark);
  transition: all 0.2s;
  font-family: inherit;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder, textarea::placeholder {
  color: var(--text-lighter);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-row {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-help {
  font-size: 0.875rem;
  color: var(--text-lighter);
  margin-top: var(--spacing-xs);
}

/* ===== HERO / BANNER ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: var(--spacing-2xl) var(--spacing-md);
  text-align: center;
  margin-bottom: var(--spacing-lg);
  border-radius: var(--radius-lg);
}

.hero h1 {
  color: white;
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
}

.hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.0625rem;
  margin-bottom: var(--spacing-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .hero {
    padding: var(--spacing-2xl);
  }

  .hero h1 {
    font-size: 2.5rem;
  }
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* ===== ALERTAS ===== */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  border-left: 4px solid;
}

.alert-info {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.alert-success {
  background: #d1fae5;
  border-color: var(--secondary);
  color: #065f46;
}

.alert-warning {
  background: #fef3c7;
  border-color: var(--accent);
  color: #92400e;
}

.alert-error {
  background: #fee2e2;
  border-color: var(--danger);
  color: #991b1b;
}

/* ===== LOADER ===== */
.loader-container {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--spacing-lg);
}

.loader {
  text-align: center;
}

.loader-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--spacing-lg);
}

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

.loader h2 {
  margin-bottom: var(--spacing-sm);
}

/* ===== SECCIONES (VIEW) ===== */
.section {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.section h2 {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-light);
}

/* ===== NAVEGACIÓN VIEW ===== */
.view-nav {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-sm) 0;
  margin-bottom: var(--spacing-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 60px;
  z-index: 90;
}

.view-nav::-webkit-scrollbar {
  display: none;
}

.sections-nav, .days-nav {
  display: flex;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-md);
  min-width: max-content;
}

.section-nav-btn, .day-nav-btn {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.section-nav-btn:hover, .day-nav-btn:hover,
.section-nav-btn.active, .day-nav-btn.active {
  background: var(--primary);
  color: white;
}

/* ===== ITINERARIO ===== */
.itinerary-day {
  margin-bottom: var(--spacing-2xl);
  scroll-margin-top: 120px;
}

.itinerary-list {
  list-style: none;
}

.itinerary-entry {
  background: var(--bg-secondary);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  border-left: 4px solid var(--primary);
}

.entry-time {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: var(--spacing-sm);
}

.entry-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-dark);
  display: block;
  margin-bottom: var(--spacing-sm);
}

.entry-desc {
  color: var(--text-light);
  margin-bottom: var(--spacing-sm);
}

.entry-location {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: var(--spacing-sm);
}

.entry-price {
  display: inline-block;
  background: var(--secondary);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: var(--spacing-sm);
}

.map-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: var(--spacing-sm);
  transition: all 0.2s;
}

.map-link:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-1px);
}

/* ===== RESTAURANTES ===== */
.restaurant-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.restaurant-card h4 {
  margin-bottom: var(--spacing-sm);
}

/* ===== LISTAS ===== */
.list {
  list-style: none;
}

.list-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

/* ===== FOOTER ===== */
footer {
  background: var(--text-dark);
  color: white;
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
  margin-top: var(--spacing-2xl);
}

footer p {
  color: var(--text-lighter);
  margin: 0;
}

/* ===== BOTÓN VOLVER ARRIBA ===== */
.back-to-top {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-4px);
}

/* ===== UTILIDADES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.875rem; }
  h3 { font-size: 1.5rem; }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --text-dark: #f9fafb;
    --text-light: #d1d5db;
    --text-lighter: #9ca3af;
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #374151;
    --border: #374151;
    --border-light: #4b5563;
  }

  .loader-container {
    background: rgba(17, 24, 39, 0.95);
  }
}

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== JOB CARDS (ASYNC GENERATION) ===== */
.job-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.job-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.job-card:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .job-card {
    padding: var(--spacing-sm);
  }
}
