/* ============================================================
   AutoDeal360 — Módulo Vehículos
   Calcado del módulo de Clientes (misma identidad y comportamiento)
   ============================================================ */

.module-title {
  font-size: 24px;
  color: #004B94;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ----- FILTROS ----- */
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.placa-container { position: relative; width: 150px; }
.search-container { position: relative; flex-grow: 1; }

.search-container::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 14px;
  pointer-events: none;
}

#busquedaInput { padding-left: 35px; }

.filter-field {
  width: 100%;
  height: 42px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  padding: 0 12px;
  box-sizing: border-box;
}

#placaInput {
  text-transform: uppercase;
  font-family: 'Roboto Mono', monospace;
  font-weight: 500;
  letter-spacing: 1px;
  text-align: center;
}

#sugerenciasPlacas {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 100;
  display: none;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.sugerencia-placa {
  padding: 9px 12px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
  letter-spacing: 1px;
  text-align: center;
  transition: background-color 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.sugerencia-placa:hover { background-color: #fffbea; color: #004B94; font-weight: 600; }

/* ----- BOTONES ----- */
.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  height: 42px;
}

.btn-primary { background-color: #004B94; color: white; }
.btn-primary:hover { background-color: #20376A; transform: translateY(-1px); box-shadow: 0 4px 6px rgba(67,97,238,0.2); }
.btn-secondary { background-color: white; border: 1px solid #ddd; color: #495057; }
.btn-secondary:hover { background-color: #f8f9fa; border-color: #ced4da; }

/* ----- ESTADÍSTICAS (idéntico a clientes) ----- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  text-align: center;
  border: 1px solid #e9ecef;
  transition: all 0.3s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

.stat-value { font-size: 28px; font-weight: 700; color: #004B94; margin-bottom: 5px; }
.stat-label { font-size: 13px; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }

/* ----- TABLA ----- */
.table-wrapper {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  overflow: hidden;
  border: 1px solid #e9ecef;
  margin-top: 20px;
}

.table-container { overflow-x: auto; border-radius: 8px; background: white; width: 100%; }

#vehiculosTable { width: 100%; border-collapse: collapse; font-size: 14px; }

#vehiculosTable th {
  background: #004B94;
  color: white;
  padding: 14px 16px;
  text-align: left;
  position: sticky;
  top: 0;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
}

#vehiculosTable td {
  padding: 0 16px;
  height: 44px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

#vehiculosTable tr:nth-child(even) { background-color: #f8f9fa; }
#vehiculosTable tr:hover { background-color: #fffbea; }

/* Acciones */
.action-btn { background: none; border: none; color: #004B94; cursor: pointer; font-size: 16px; margin: 0 5px; transition: all 0.2s; }
.action-btn:hover { color: #20376A; transform: scale(1.1); }

/* ----- PAGINACIÓN (idéntico a clientes) ----- */
.table-controls { margin-top: 20px; padding-top: 15px; border-top: 1px solid #e9ecef; }
.pagination-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.rows-per-page { display: flex; align-items: center; gap: 10px; }
.rows-per-page select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.pagination-buttons { display: flex; align-items: center; gap: 8px; }
.page-btn { padding: 6px 10px; min-width: 32px; border: 1px solid #ddd; border-radius: 4px; background: white; cursor: pointer; }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- LOADING ----- */
.loading { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.8); display: none; justify-content: center; align-items: center; z-index: 1000; }
.spinner { border: 4px solid rgba(0,0,0,0.1); border-radius: 50%; border-top: 4px solid #004B94; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ----- RESPONSIVE ----- */
@media (max-width: 992px) { .stats-bar { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .filters { flex-direction: column; align-items: stretch; }
  .placa-container, .search-container { width: 100%; }
  .stats-bar { grid-template-columns: 1fr; }
  .btn-primary, .btn-secondary { width: 100%; }
}

/* ── Layout sticky (IGUAL QUE CLIENTES) ── */
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding: 15px;
    box-sizing: border-box;
    background: #f5f7fa;
}

.module-header { display: none; }

.card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 20px;
}

.filters    { flex-shrink: 0; }
.stats-bar  { flex-shrink: 0; margin: 10px 0; }
.table-controls { flex-shrink: 0; }

.table-wrapper { flex: 1; min-height: 0; overflow: hidden; margin-top: 10px; }
.table-container { height: 100%; overflow: hidden; display: flex; flex-direction: column; }

#vehiculosTable { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
#vehiculosTable thead { display: table; width: 100%; table-layout: fixed; }
#vehiculosTable tbody {
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 320px);
}
#vehiculosTable tbody tr { display: table; width: 100%; table-layout: fixed; }

#vehiculosTable td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Anchos de columnas (12) */
#vehiculosTable th:nth-child(1),  #vehiculosTable td:nth-child(1)  { width: 45px;  text-align: center; }
#vehiculosTable th:nth-child(2),  #vehiculosTable td:nth-child(2)  { width: 90px;  }
#vehiculosTable th:nth-child(3),  #vehiculosTable td:nth-child(3)  { width: 130px; }
#vehiculosTable th:nth-child(4),  #vehiculosTable td:nth-child(4)  { width: 105px; }
#vehiculosTable th:nth-child(5),  #vehiculosTable td:nth-child(5)  { width: 55px;  }
#vehiculosTable th:nth-child(6),  #vehiculosTable td:nth-child(6)  { width: 90px;  }
#vehiculosTable th:nth-child(7),  #vehiculosTable td:nth-child(7)  { width: 105px; }
#vehiculosTable th:nth-child(8),  #vehiculosTable td:nth-child(8)  { width: 105px; }
#vehiculosTable th:nth-child(9),  #vehiculosTable td:nth-child(9)  { width: 90px;  }
#vehiculosTable th:nth-child(10), #vehiculosTable td:nth-child(10) { width: 90px;  }
#vehiculosTable th:nth-child(11), #vehiculosTable td:nth-child(11) { width: 150px; }
#vehiculosTable th:nth-child(12), #vehiculosTable td:nth-child(12) { width: 85px; text-align: center; }

/* Badge de placa (padding reducido para no engordar la fila) */
.placa-badge {
  display: inline-block;
  background: #004B94;
  color: #fff;
  font-family: 'Roboto Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Fechas vencidas */
.fecha-vencida { color: #dc3545 !important; font-weight: 600; }
.fecha-vencida::after { content: ' \f071'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 10px; }

/* Botones de acción en tabla */
.col-acciones { text-align: center; white-space: nowrap; }
.btn-historial, .btn-ficha {
  background: none; border: none; color: #004B94; cursor: pointer;
  font-size: 16px; margin: 0 4px; padding: 2px; border-radius: 5px; transition: all 0.2s;
}
.btn-historial:hover, .btn-ficha:hover { color: #20376A; transform: scale(1.1); }

/* ----- BOTÓN CREAR ----- */
.btn-crear {
  background-color: #198754;
}
.btn-crear:hover {
  background-color: #146c43;
}

/* ----- MODAL CREAR (iframe) ----- */
.crear-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}
.crear-modal-overlay.show { display: flex; }

.crear-modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.crear-modal-header {
  background: #20376A;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.crear-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.crear-modal-title i { color: #FECA05; }

.crear-modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color .2s, transform .2s;
}
.crear-modal-close:hover { color: #f72585; transform: rotate(90deg); }

.crear-modal-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}