/**
 * providers.css - Tracking v2.0
 * Estilos específicos para la página de administración de proveedores GPS.
 * Importar DESPUÉS de variables.css, common.css y layout.css
 */

/* ========================================
   CONTADOR DEL HEADER
   ======================================== */
.count {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  background: var(--hover-color);
  padding: 2px 10px;
  border-radius: var(--border-radius-full);
  font-weight: 600;
}

/* ========================================
   FILTER BAR
   ======================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-bar .form-input {
  max-width: 280px;
}

/* ========================================
   TOGGLE SWITCH (Polling)
   ======================================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--green-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* ========================================
   URL TAGS
   ======================================== */
.url-tag {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--font-size-xs);
  background: var(--hover-color);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--border-radius-sm);
  margin: 1px 0;
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

/* ========================================
   VEHICLES COUNT
   ======================================== */
.vehicles-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.detail-row {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

/* ========================================
   ICONOS PEQUEÑOS (lucide)
   ======================================== */
.icon-xs {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.icon-sm {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ========================================
   MODAL - FORM GRID
   ======================================== */
.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.modal-form-grid .full-width {
  grid-column: 1 / -1;
}

/* ========================================
   MODAL SECTIONS
   ======================================== */
.modal-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.modal-section h3 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ========================================
   MODAL - VEHÍCULOS (XL)
   ======================================== */
.modal--xl {
  max-width: 95vw;
  width: 1100px;
}

.veh-modal-body {
  padding: 0.75rem 1rem 0.25rem;
  max-height: 78vh;
  overflow-y: auto;
}

/* Sticky top wrapper */
.veh-sticky-top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-primary);
  padding-bottom: 0.35rem;
}

/* ========================================
   STATS BAR
   ======================================== */
.veh-stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--hover-color);
  border-radius: var(--border-radius-md);
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
}

.veh-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-primary);
}

.veh-stat i {
  color: var(--green-primary);
}

.veh-stat span {
  font-weight: 700;
}

/* ========================================
   SEARCH BAR
   ======================================== */
.veh-search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.veh-search-bar input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.veh-search-bar input:focus {
  border-color: var(--green-primary);
  box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.veh-search-count {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

/* ========================================
   NEW URL FORM
   ======================================== */
.veh-new-url-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-md);
  border: 1px dashed var(--border-color);
}

.veh-new-url-form input {
  flex: 1;
  min-width: 120px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.veh-new-url-form input:focus {
  border-color: var(--green-primary);
}

/* ========================================
   URL BLOCKS
   ======================================== */
.veh-url-block {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  margin-bottom: 0.5rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
  background: var(--bg-secondary);
}

.veh-url-block:hover {
  box-shadow: 0 1px 4px var(--shadow);
}

.veh-url-block.is-hidden {
  display: none;
}

/* URL Header */
.veh-url-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--hover-color);
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-bottom: 1px solid transparent;
}

.veh-url-header:hover {
  background: var(--border-color);
}

.veh-url-header .veh-url-toggle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.veh-url-header .veh-url-toggle-icon.is-collapsed {
  transform: rotate(-90deg);
}

.veh-url-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.veh-url-tag {
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 1px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  font-weight: 500;
  margin-left: auto;
}

/* URL Body */
.veh-url-body {
  padding: 0.5rem 0.65rem;
  transition: max-height 0.2s ease, padding 0.2s ease;
}

.veh-url-body.is-collapsed {
  display: none;
}

/* ========================================
   SUBSECTIONS (Users / Vehicles)
   ======================================== */
.veh-subsection {
  margin: 0.4rem 0;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.veh-subsection:last-child {
  border-bottom: none;
}

.veh-subtitle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.veh-subtitle i {
  color: var(--green-primary);
}

/* ========================================
   USER ROWS
   ======================================== */
.veh-user-list,
.veh-veh-list {
  margin-bottom: 0.15rem;
}

.veh-user-row,
.veh-veh-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
  transition: background 0.1s ease;
}

.veh-user-row:hover,
.veh-veh-row:hover {
  background: var(--hover-color);
}

.veh-user-row.is-hidden,
.veh-veh-row.is-hidden {
  display: none;
}

.veh-user-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
  width: 16px;
  height: 16px;
}

.veh-user-name {
  min-width: 100px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ========================================
   VEHICLE ROWS
   ======================================== */
.veh-veh-plate {
  min-width: 75px;
  font-family: 'Courier New', 'Fira Code', monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.veh-veh-user {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 100px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ========================================
   INLINE FORMS
   ======================================== */
.veh-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0;
}

.veh-inline-input,
.veh-inline-select {
  padding: 0.3rem 0.45rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-width: 70px;
  outline: none;
  transition: border-color 0.2s ease;
}

.veh-inline-input:focus,
.veh-inline-select:focus {
  border-color: var(--green-primary);
  box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.08);
}

/* ========================================
   PASSWORD DISPLAY
   ======================================== */
.veh-password {
  font-family: 'Courier New', 'Fira Code', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: var(--hover-color);
  padding: 1px 8px;
  border-radius: var(--border-radius-sm);
  transition: background 0.15s ease;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.veh-password:hover {
  background: var(--border-color);
  border-color: var(--border-color);
}

.veh-password.visible {
  letter-spacing: normal;
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

/* ========================================
   STATUS INDICATORS
   ======================================== */
.veh-status-indicator {
  font-size: 0.68rem;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: var(--border-radius-full);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.status-ok {
  color: var(--status-success);
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.2);
}

.status-warn {
  color: var(--status-error);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

/* Status dot indicator */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-ok .status-dot {
  background: var(--status-success);
}

.status-warn .status-dot {
  background: var(--status-error);
}

/* ========================================
   DETECTED VEHICLES SECTION
   ======================================== */
.veh-detected-section {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.veh-detected-section summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.3rem 0;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.veh-detected-section summary:hover {
  color: var(--text-primary);
}

/* Detected search bar */
.veh-detected-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  margin: 0.25rem 0 0.4rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
}

.veh-detected-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: var(--font-primary);
  outline: none;
  padding: 0.2rem 0;
}

.veh-detected-search input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.veh-detected-count {
  font-size: 0.68rem;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

.veh-unconfig-container {
  max-height: 180px;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius-md);
  margin-top: 0.4rem;
  border: 1px solid var(--border-color);
}

.veh-unconfig-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.5rem;
  flex-wrap: wrap;
  transition: background 0.1s;
}

.veh-unconfig-item.is-hidden {
  display: none;
}

.veh-unconfig-item:last-child {
  border-bottom: none;
}

.veh-unconfig-item:hover {
  background: var(--hover-color);
  border-radius: var(--border-radius-sm);
}

.veh-unconfig-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* ========================================
   SMALL BUTTONS
   ======================================== */
.btn-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.btn-icon-sm:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-xs {
  padding: 2px 8px;
  font-size: 0.68rem;
  line-height: 1.5;
  border-radius: var(--border-radius-sm);
}

/* ========================================
   BUTTON WITH ICON
   ======================================== */
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-with-icon i {
  width: 14px;
  height: 14px;
}

/* ========================================
   SCROLLBAR (Vehicle modal)
   ======================================== */
.veh-modal-body::-webkit-scrollbar {
  width: 6px;
}

.veh-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.veh-modal-body::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.veh-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

/* ========================================
   NAV ICONS (sidenav)
   ======================================== */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

body.dark-theme .sidenav img.nav-icon.nav-icon-dark-target {
  filter: brightness(0) invert(1);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
  .modal--xl {
    width: 98vw;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .veh-stats-bar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
}

@media (max-width: 768px) {
  .filter-bar .form-input {
    max-width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .veh-new-url-form {
    flex-direction: column;
  }
}

/* ========================================
   DARK THEME ADJUSTMENTS
   ======================================== */
body.dark-theme .veh-url-header .veh-url-toggle-icon {
  color: rgba(255, 255, 255, 0.6);
}

body.dark-theme .veh-veh-plate {
  color: var(--dark-text-primary);
}

body.dark-theme .veh-password {
  background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .veh-password:hover {
  background: rgba(255, 255, 255, 0.1);
}
