:root {
  /* TOKENS EXTRAÍDOS DE LOS ÍNDICES (StyleGuide) */
  --jem-blue: #1a365d;        /* Navy Landing */
  --jem-primary: #3b82f6;     /* Blue Pasajeros/Topo Dark */
  --jem-success: #28a745;     /* Success Topo */
  --jem-error: #dc3545;       /* Error Topo */
  --jem-warning: #ffc107;     /* Warning Topo */
  --jem-bg-light: #f8f9fa;    /* Topo Light */
  --jem-bg-pasajes: #f7f9fb;  /* Pasajes Light */
  --jem-radius: 16px;         /* Estándar Topo */
  --jem-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

/* ========================================================
   1. ESTILOS GLOBALES BASE 
   ======================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: var(--jem-bg-pasajes);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================================
   2. ESTILOS DEL LANDING (Home Público) 
   ======================================================== */
#landing-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hero-banner {
  width: 100%;
  overflow: hidden;
  position: relative;
  background: white;
}
.hero-banner img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.banner-text {
  text-align: center;
  padding: 2rem 1.5rem;
  background: white;
  position: relative;
}
.banner-text h1 {
  font-size: 2.2rem;
  color: #000;
  margin-bottom: 0.8rem;
}
.banner-text p {
  color: #333;
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}
.btn-ingresar {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1001; /* Encima de casi todo */
  background-color: rgba(255, 255, 255, 0.1); /* Ultra transparente */
  color: var(--jem-primary);
  font-weight: bold;
  padding: 15px 25px;
  border-radius: 50px;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-ingresar:hover {
  background-color: rgba(59, 130, 246, 0.2);
  transform: scale(1.05) translateY(-5px);
  border-color: var(--jem-primary);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.3);
}
.main-content-landing {
  padding: 0 2rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}
.section {
  margin-bottom: 3rem;
  text-align: center;
}
.section h2 {
  font-size: 1.8rem;
  color: var(--jem-blue);
  margin-bottom: 1.5rem;
}
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}
.card-landing {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}
.card-img-container {
  width: 100%;
  height: 220px;
  overflow: hidden;
}
.card-landing img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #f5f5f5;
}
.card-content-landing {
  padding: 1.5rem;
  flex: 1;
}
.card-content-landing h3 {
  margin-bottom: 0.8rem;
  color: var(--jem-blue);
  font-size: 1.3rem;
}
.contacto {
  background: var(--jem-blue);
  color: white;
  padding: 2.5rem;
  text-align: center;
  border-radius: 8px;
  margin-top: 2rem;
}
.contacto h2 {
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  color: white;
}
.btn-whatsapp {
  display: inline-block;
  background: #25D366;
  color: white;
  padding: 12px 25px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
}
footer {
  background: #0f1f3d;
  color: white;
  text-align: center;
  padding: 1.5rem;
  margin-top: auto;
}

@media (max-width: 768px) {
  .banner-text h1 { font-size: 1.8rem; }
  .banner-text p { font-size: 1.1rem; }
  .grid-cards { grid-template-columns: 1fr; gap: 1.5rem; }
  .card-img-container { height: 200px; }
  .contacto { padding: 2rem 1.5rem; }
}

@media (min-width: 769px) {
  .hero-banner { max-height: 400px; }
  .hero-banner img { max-height: 400px; object-fit: contain; }
}

/* ========================================================
   3. ESTILOS DEL DASHBOARD 
   ======================================================== */

.card {
  background-color: white;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, .1), 0 0px 10px -5px rgba(0, 0, 0, .04);
  transition: all .3s ease;
  border-radius: 1rem;
}

.btn-primary {
  background-color: var(--jem-primary);
  transition: background-color .3s ease;
}

.btn-primary:hover {
  background-color: #2563eb;
}

#recaptcha-container {
  margin: 10px 0;
  display: flex;
  justify-content: center;
}

.grecaptcha-badge {
  visibility: hidden !important;
}

#fixed-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #e2e8f0;
  padding: .75rem 0;
  text-align: center;
  font-size: .875rem;
  color: #4b5563;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, .05);
  z-index: 99;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.dashboard-container {
  width: 100%;
  min-height: 100vh;
  display: none;
  padding-bottom: 3rem;
  background-color: var(--jem-bg-pasajes);
}

/* LOADING SCREEN */
#app-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--jem-bg-pasajes);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--jem-primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.header {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-btn {
  cursor: pointer;
  padding: 0.2rem;
}

.menu-logo-icon {
  height: 40px;
  width: auto;
  transition: transform 0.2s;
}

.menu-btn:hover .menu-logo-icon {
  transform: scale(1.05);
}

.user-menu {
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--jem-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 0.5rem 0;
  min-width: 150px;
  display: none;
  z-index: 1000;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover { background: #f1f5f9; }

.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100%;
  background: white;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  transition: left 0.3s;
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar.show { left: 0; }

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.sidebar-overlay.show { display: block; }

@media (min-width: 1024px) {
  .sidebar {
      left: 0 !important;
      box-shadow: none;
      border-right: 1px solid #e5e7eb;
      top: 60px;
      height: calc(100% - 60px);
  }
  .sidebar-overlay { display: none !important; }
  .menu-btn { display: none; }
  .main-content-dash { margin-left: 280px; padding: 2rem; }
  .header { padding-left: 1rem; }
}

.menu-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  transition: background 0.2s;
  font-weight: 500;
  color: #374151;
}

.menu-item:hover { background: #f1f5f9; }

.menu-item.has-submenu {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.submenu {
  padding-left: 1rem;
  display: none;
}
.submenu.show { display: block; }

.main-content-dash {
  padding: 1rem;
  flex: 1;
  padding-bottom: 4rem;
}

.welcome-section {
  text-align: center;
  padding: 2rem;
  display: none;
}

.profile-modal {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.profile-field { margin-bottom: 1rem; }
.profile-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #4b5563;
}
.profile-field .value {
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 0.375rem;
}

.avatar-upload { text-align: center; margin-bottom: 1.5rem; }
.avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  border: 2px solid #e2e8f0;
}
.generic-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--jem-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  margin: 0 auto;
}

/* Modals extra para login en index Principal */
#login-modal-overlay {
  display: none;
}
.login-container-box {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 0px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 24rem; /* max-w-sm */
  padding: 2rem;
}
.login-logo { margin: 0 auto; display: block; }

/* Grills y utilidades varias (Admin/Listas) */
.admin-list-item {
  border-left: 4px solid var(--jem-primary);
  transition: all 0.2s;
}
.admin-list-item:hover {
  transform: translateX(4px);
  background-color: #f8fafc;
}
.admin-list-container {
  max-height: 600px;
  overflow-y: auto;
}
.missing-dob {
  background-color: #fef08a !important;
  border-left-color: #eab308 !important;
}

.ticket-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: #f3f4f6;
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  border: 1px solid #e5e7eb;
}

/* Historial UI */
.history-detail {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}
.history-item.active .history-detail { display: block; }
.history-item { transition: background-color 0.2s; }

.ticket-preview {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 10px;
  border: 1px solid #ccc;
  background: white;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.3s ease-out forwards; }

/* CHAT STYLES */
.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #f0f2f5;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 0.5rem 0.5rem;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-input-area {
  background: white;
  padding: 10px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #ddd;
  align-items: center;
}
.chat-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
}
.chat-input:focus { border-color: var(--jem-primary); }
.send-btn {
  background: var(--jem-primary);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.send-btn:hover { background: #2563eb; }
.message-bubble {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 15px;
  position: relative;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease;
}
.message-bubble.mine {
  align-self: flex-end;
  background: var(--jem-primary);
  color: white;
  border-bottom-right-radius: 5px;
}
.message-bubble.others {
  align-self: flex-start;
  background: white;
  color: #333;
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.message-bubble.conductor {
  border: 2px solid #fbbf24;
}
.message-info {
  font-size: 0.75rem;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  opacity: 0.8;
}
.message-bubble.mine .message-info { color: #e0e7ff; }
.message-sender {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}
