/**
 * Estilos específicos para o Sistema de Rastreadores
 * MV Locadora - 2025
 */

/* Estilos específicos apenas para a funcionalidade de rastreadores */
/* CSS do sidebar e layout global é gerenciado pelos arquivos padrão do sistema */

/* CSS específico removido para manter consistência do sidebar */

/* Responsividade da tabela */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .rastreadores-table {
    /* evita scroll horizontal do layout da página (tabela já está dentro de .table-responsive) */
    min-width: 0;
  }
  
  .rastreadores-table th,
  .rastreadores-table td {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Melhorias nos botões de ação */
.action-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.btn-action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
}

.btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Estados dos status */
.status-ativo {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border: 1px solid #16a34a;
}

.status-inativo {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border: 1px solid #dc2626;
}

.status-manutencao {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #f59e0b;
}

/* Animações para os cards */
.info-card {
  transition: all 0.3s ease;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.info-card .value {
  transition: all 0.3s ease;
}

.info-card:hover .value {
  transform: scale(1.05);
}

/* Melhorias no painel de comandos */
.comandos-panel {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.comando-item {
  position: relative;
  overflow: hidden;
}

.comando-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.comando-item:hover::before {
  left: 100%;
}

/* Melhorias no modal */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.form-control {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.form-control:invalid {
  border-color: #ef4444;
}

/* Textarea específico */
textarea.form-control {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* Melhorias nos filtros */
.filtros-container {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

/* Loading states */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Estados vazios */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state h3 {
  margin: 0 0 10px 0;
  color: #374151;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

/* Melhorias de acessibilidade */
.btn-action:focus,
.form-control:focus,
.btn-primary:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Tooltips */
[title] {
  position: relative;
}

[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 5px;
}

[title]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  z-index: 1000;
}

/* Animações de entrada */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rastreadores-table tbody tr {
  animation: fadeInUp 0.3s ease-out;
}

.info-card {
  animation: fadeInUp 0.3s ease-out;
}

/* Responsividade avançada */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .comandos-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .page-header h1 {
    font-size: 24px;
  }
  
  .info-card .value {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  
  .rastreadores-container {
    padding: 10px;
  }
  
  .page-header {
    padding: 20px;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 4px;
  }
}

/* Dark mode support (futuro) */
@media (prefers-color-scheme: dark) {
  /* Preparado para implementação futura */
}

/* Print styles */
@media print {
  .mv-sidebar,
  .comandos-panel,
  .filtros-container,
  .action-buttons {
    display: none !important;
  }
  
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .rastreadores-table {
    font-size: 12px;
  }
}

/* =========================
   Paginação (Rastreadores)
   ========================= */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.pagination-info {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-pages {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-page {
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
  border-color: #3b82f6;
  color: #1e40af;
}

.btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-page-num {
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  color: #374151;
  min-width: 40px;
  transition: all 0.2s ease;
}

.btn-page-num.is-active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.page-ellipsis {
  color: #9ca3af;
  font-weight: 700;
  padding: 0 4px;
}

@media (max-width: 768px) {
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .pagination-controls {
    justify-content: space-between;
  }
  .pagination-pages {
    display: none;
  }
}