/**
 * EnRuta Taxi + Tabler overrides y compatibilidad con vistas legacy.
 */

:root {
  --enruta-yellow: #ffc107;
  --enruta-yellow-dark: #ffb300;
  --enruta-black: #111111;
  --tblr-primary: #ffc107;
  --tblr-primary-rgb: 255, 193, 7;
  --tblr-primary-fg: #111111;
  --tblr-link-color: #b8860b;
  --tblr-link-hover-color: #8a6508;
}

body {
  background: #f1f5f9;
}

/* Sidebar brand */
.enruta-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
}
.enruta-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.4rem;
  background: var(--enruta-yellow);
  color: #111;
  font-weight: 800;
  font-size: 0.95rem;
}
.enruta-brand-text {
  font-weight: 700;
  letter-spacing: 0.01em;
}
.enruta-nav-section {
  font-size: 0.68rem !important;
  letter-spacing: 0.06em;
  opacity: 0.55;
  padding-bottom: 0.15rem !important;
}
.navbar-vertical .nav-link.active {
  background: rgba(255, 193, 7, 0.14);
  color: var(--enruta-yellow) !important;
  font-weight: 600;
}

.enruta-topbar {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  min-height: 3.5rem;
  margin-bottom: 0;
}
.enruta-saldo {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.7rem;
}

/* Botones: primary = amarillo EnRuta */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus {
  --tblr-btn-color: #111;
  --tblr-btn-bg: var(--enruta-yellow);
  --tblr-btn-border-color: var(--enruta-yellow);
  --tblr-btn-hover-bg: var(--enruta-yellow-dark);
  --tblr-btn-hover-border-color: var(--enruta-yellow-dark);
  --tblr-btn-hover-color: #111;
  color: #111;
  background-color: var(--enruta-yellow);
  border-color: var(--enruta-yellow);
}
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}
.btn-block {
  display: block;
  width: 100%;
}

/* ---- Compatibilidad con clases legacy de admin-enruta ---- */
.page-header {
  margin-bottom: 1.25rem;
}
.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.page-header p {
  color: var(--tblr-secondary);
  margin-bottom: 0;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 500;
}
.alert-success,
.alert-error,
.alert-danger,
.alert-warning,
.alert-info {
  border-left: 4px solid transparent;
}
.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left-color: #4caf50;
}
.alert-error,
.alert-danger {
  background: #ffebee;
  color: #c62828;
  border-left-color: #f44336;
}
.alert-warning {
  background: #fff3e0;
  color: #e65100;
  border-left-color: #ff9800;
}
.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border-left-color: #2196f3;
}

.route-card {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--enruta-yellow);
  margin-bottom: 1.25rem;
}

.drivers-table-container {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}
.drivers-table {
  width: 100%;
  border-collapse: collapse;
}
.drivers-table thead {
  background: #f8fafc;
}
.drivers-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.drivers-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}
.drivers-table tbody tr:hover {
  background: #f8fafc;
}
.drivers-table tbody tr.expired {
  background: #ffebee;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success {
  background: #e8f5e9;
  color: #2e7d32;
}
.badge-danger {
  background: #ffebee;
  color: #c62828;
}
.badge-warning {
  background: #fff3e0;
  color: #e65100;
}
.badge-info,
.badge-secondary {
  background: #e3f2fd;
  color: #1565c0;
}

.form-group {
  margin-bottom: 1.15rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.form-control {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.9375rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: var(--enruta-yellow);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.25);
}
.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #64748b;
}
.form-readonly {
  padding: 0.55rem 0.75rem;
  background: #f1f5f9;
  border-radius: 0.4rem;
}

.text-center {
  text-align: center;
}
.text-danger {
  color: #c62828;
  font-weight: 600;
}
.text-warning {
  color: #e65100;
  font-weight: 600;
}
.text-success {
  color: #2e7d32;
  font-weight: 600;
}

/* Modales legacy */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  align-items: center;
  justify-content: center;
}
.modal.active {
  display: flex;
}
.modal-content {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}
.modal-header h3 {
  font-size: 1.15rem;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
}
.modal form {
  padding: 1.25rem;
}
.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid #e2e8f0;
}

/* Evitar títulos duplicados grandes en páginas con page-header + topbar */
.page-body .page-header h2 {
  font-size: 1.25rem;
}

@media (max-width: 768px) {
  .drivers-table {
    min-width: 900px;
  }
}
