.drivers-with-tabs-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--background);
}

// Estilos para conteúdo das abas
.drivers-list-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  
  app-data-table {
    flex: 1;
    min-height: 0; // Importante para flex funcionar corretamente
  }
}

.main-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 1rem 0;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 1rem;
  
  h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
  }
}

.drivers-count {
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--surface);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--divider);
}

// Estilos para edição de motorista
.driver-edit-content {
  height: 100%;
  padding: 1rem;
}

.driver-form-container {
  max-width: 800px;
  margin: 0 auto;
  
  h3 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
  }
}

.driver-details {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.detail-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid var(--divider);
  
  h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  
  label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  span {
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--divider);
  }
}

// Loading state
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 1rem;
  
  p {
    color: var(--text-secondary);
    font-size: 0.9rem;
  }
}

// 🎯 ESTILOS PARA BADGES DE CATEGORIA CNH COM CORES VARIADAS
::ng-deep .category-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  margin: 0.125rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  
  &:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  }
  
  // 🏍️ Categoria A - Motocicletas (Azul)
  &.category-a {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: 1px solid #1d4ed8;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    }
  }
  
  // 🚗 Categoria B - Carros (Verde)
  &.category-b {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: white;
    border: 1px solid #047857;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
    }
  }
  
  // 🚛 Categoria C - Caminhões (Laranja)
  &.category-c {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: 1px solid #d97706;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
    }
  }
  
  // 🚌 Categoria D - Ônibus (Roxo)
  &.category-d {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: 1px solid #7c3aed;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
    }
  }
  
  // 🚚 Categoria E - Carretas (Vermelho)
  &.category-e {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid #dc2626;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    }
  }
  
  // ⚠️ Badge de alerta para categorias vazias
  &.category-empty {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid #dc2626;
    animation: pulse-warning 2s infinite;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    }
    
    &::before {
      content: "⚠️ ";
      margin-right: 0.25rem;
    }
  }
  
  // 🎯 Fallback para categorias não mapeadas (IDT Yellow)
  &:not(.category-a):not(.category-b):not(.category-c):not(.category-d):not(.category-e):not(.category-empty) {
    background: linear-gradient(135deg, var(--idt-primary-color) 0%, #e6b800 100%);
    color: #1a1a1a;
    border: 1px solid #e6b800;
    
    &:hover {
      box-shadow: 0 2px 6px rgba(255, 200, 46, 0.4);
    }
  }
}

// 🚨 Animação de pulsação para chamar atenção
@keyframes pulse-warning {
  0% {
    transform: scale(1);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
  }
}

// 🌙 Dark theme support para badges com cores variadas
.dark-theme ::ng-deep .category-badge {
  // As cores permanecem as mesmas no tema escuro para manter a identidade visual
  // mas com sombras mais suaves
  
  &.category-a {
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(59, 130, 246, 0.5);
    }
  }
  
  &.category-b {
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(16, 185, 129, 0.5);
    }
  }
  
  &.category-c {
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(245, 158, 11, 0.5);
    }
  }
  
  &.category-d {
    box-shadow: 0 1px 3px rgba(139, 92, 246, 0.3);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(139, 92, 246, 0.5);
    }
  }
  
  &.category-e {
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    }
  }
  
  // ⚠️ Badge de alerta no tema escuro
  &.category-empty {
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.4);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(239, 68, 68, 0.6);
    }
  }
  
  // Fallback no tema escuro
  &:not(.category-a):not(.category-b):not(.category-c):not(.category-d):not(.category-e):not(.category-empty) {
    box-shadow: 0 1px 3px rgba(255, 200, 46, 0.3);
    
    &:hover {
      box-shadow: 0 2px 6px rgba(255, 200, 46, 0.5);
    }
  }
}

// Responsividade
@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .main-content {
    padding: 0;
  }
  
  .drivers-list-content {
    padding: 0;
  }

  .driver-edit-content {
    padding: 0;
  }

  .drivers-with-tabs-container {
    margin: 0;
    padding: 0;
  }

  .section-header {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
  }

  .detail-section {
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    border-left: none;
    border-right: none;
  }

  .driver-form-container {
    max-width: 100%;
    margin: 0;
    
    h3 {
      margin: 0 0 1rem 0;
      padding: 0.5rem;
    }
  }

  ::ng-deep app-data-table {
    margin: 0;
    padding: 0;
    
    .table-menu {
      padding: 0.25rem 0.5rem;
      margin: 0;
      border-radius: 0;
      border-left: none;
      border-right: none;
    }

    .data-table-container {
      border-left: none;
      border-right: none;
      border-radius: 0;
      margin: 0;
    }

    .pagination {
      padding: 0.75rem 0.5rem;
      margin: 0;
      border-left: none;
      border-right: none;
    }

    .table-header,
    .table-footer {
      padding: 0.5rem;
      margin: 0;
    }

    table {
      margin: 0;
      
      th, td {
        &:first-child {
          padding-left: 0.5rem;
        }
        &:last-child {
          padding-right: 0.5rem;
        }
      }
    }
  }

  ::ng-deep app-custom-tabs {
    margin-top: 0;
    padding-top: 0;
    
    .nav-tabs {
      margin-top: 0;
      padding-top: 0;
      border-radius: 0;
    }
    
    .tab-content {
      margin: 0;
      padding: 0;
    }
  }

  .domain-container {
    padding: 0.25rem;
  }
}

// Dark theme support
@media (prefers-color-scheme: dark) {
  .drivers-with-tabs-container {
    background-color: #121212;

    .drivers-list-section,
    .drivers-tabs-section {
      background: #1e1e1e;
      color: #e0e0e0;

      .section-header {
        background: #2a2a2a;
        border-bottom-color: #333;

        h2 {
          color: #e0e0e0;
        }

        .drivers-count,
        .tabs-info {
          background: #0d47a1;
          border-color: #1565c0;
          color: #e3f2fd;
        }
      }
    }

    .driver-tab-content {
      .tab-driver-header {
        background: #2a2a2a;
        border-bottom-color: #333;

        .driver-details {
          h3 {
            color: #e0e0e0;
          }

          p {
            color: #bbb;
          }
        }
      }

      .driver-form-container {
        .form-section {
          ::ng-deep {
            .mat-mdc-card {
              background: #2a2a2a;
              color: #e0e0e0;
            }

            .mat-mdc-text-field-wrapper {
              background-color: #333 !important;
            }

            input[readonly] {
              color: #e0e0e0 !important;
            }

            .mat-mdc-form-field-label {
              color: #bbb !important;
            }
          }
        }
      }

      .loading-state {
        color: #bbb;
      }
    }
  }
}

.domain-container {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

app-tab-system {
  flex: 1;
  min-height: 0;
}
