/**
 * 🎨 FinesListComponent Styles
 * 
 * Estilos para o componente reutilizável de lista de multas
 * Utiliza sistema global de status de _status.scss
 */

.fines-list-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

// ========================================
// 📋 HEADER
// ========================================

.fines-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 2px solid var(--divider);
  background: var(--surface-variant);

  .fines-title {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    i {
      color: var(--primary);
      font-size: 1.1rem;
    }
  }

  .new-fine-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background: var(--primary-dark);
      transform: translateY(-1px);
    }

    i {
      font-size: 0.9rem;
    }
  }
}

// ========================================
// 🏷️ ABAS DE FILTRO
// ========================================

.filter-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;

  .filter-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;

    &:hover {
      background: var(--surface-variant-subtle);
      color: var(--text-primary);
    }

    &.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
      background: var(--surface-variant-subtle);
    }

    .tab-count {
      background: var(--primary);
      color: white;
      padding: 0.25rem 0.5rem;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 600;
      min-width: 1.5rem;
      text-align: center;
    }

    .tab-total {
      background: var(--success);
      color: white;
      padding: 0.25rem 0.5rem;
      border-radius: 12px;
      font-size: 0.7rem;
      font-weight: 600;
      margin-left: 0.25rem;
    }
  }
}

// ========================================
// 💰 RESUMO DE VALORES TOTAIS
// ========================================

.totals-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--surface-variant-light), var(--surface-variant));
  border-bottom: 1px solid var(--divider);
  gap: 1rem;

  .total-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;

    .total-label {
      font-size: 0.75rem;
      font-weight: 500;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .total-value {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text-primary);
    }

    &.total-general {
      .total-value {
        color: var(--primary);
        font-size: 1.25rem;
      }
    }

    &.total-filtered {
      .total-value {
        color: var(--success);
      }
    }
  }
}

// ========================================
// 📊 CONTEÚDO PRINCIPAL
// ========================================

.fines-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

// ========================================
// 📋 TABELA DE MULTAS
// ========================================

.fines-table-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fines-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface-variant-light);
  border-bottom: 1px solid var(--divider);

  .summary-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
  }

  .summary-total {
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 700;
    background: rgba(var(--success-rgb), 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(var(--success-rgb), 0.2);
  }
}

.table-responsive {
  flex: 1;
  overflow: auto;
}

.fines-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);

  thead {
    background: var(--surface-variant);
    position: sticky;
    top: 0;
    z-index: 10;

    th {
      padding: 1rem;
      text-align: left;
      font-weight: 600;
      color: var(--text-primary);
      border-bottom: 2px solid var(--divider);
      white-space: nowrap;

      &.sortable {
        cursor: pointer;
        user-select: none;
        transition: background-color 0.2s ease;

        &:hover {
          background: var(--surface-variant-subtle);
        }

        .sort-icon {
          margin-left: 0.5rem;
          opacity: 0.5;
          font-size: 0.75rem;
        }
      }
    }
  }

  tbody {
    .fine-row {
      border-bottom: 1px solid var(--divider);
      transition: background-color 0.2s ease;

      &:hover {
        background: var(--surface-variant-subtle);
      }

      td {
        padding: 1rem;
        vertical-align: top;
      }
    }
  }
}

// ========================================
// 📋 COLUNAS ESPECÍFICAS
// ========================================

.fine-date {
  font-weight: 500;
  color: var(--text-primary);
  min-width: 100px;
}

.fine-location {
  .location-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;

    .location-main {
      font-weight: 500;
      color: var(--text-primary);
    }

    .location-org {
      font-size: 0.75rem;
      color: var(--text-secondary);
      text-transform: uppercase;
      font-weight: 500;
    }
  }
}

.fine-infraction {
  .infraction-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;

    .infraction-description {
      color: var(--text-primary);
      line-height: 1.4;
    }

    .fine-number {
      font-size: 0.75rem;
      color: var(--text-secondary);
      font-weight: 500;
    }
  }
}

.fine-driver {
  font-weight: 500;
  color: var(--text-primary);
}

.fine-value {
  .value-amount {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
  }
}

.fine-status {
  // Usa estilos globais de _status.scss
}

.fine-actions {
  .action-btn {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;

    &:hover {
      background: var(--primary);
      color: white;
      text-decoration: none;
    }
  }
}

// ========================================
// 📄 PAGINAÇÃO
// ========================================

.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--divider);
  background: var(--surface-variant-light);

  .pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
  }

  .pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    .btn {
      padding: 0.5rem;
      min-width: 2.5rem;
      height: 2.5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--divider);
      background: var(--surface);
      color: var(--text-primary);
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover:not(:disabled) {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
      }

      &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      &.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
      }
    }

    .page-numbers {
      display: flex;
      gap: 0.25rem;

      .page-btn {
        min-width: 2.5rem;
      }
    }
  }
}

// ========================================
// 📱 RESPONSIVIDADE
// ========================================

@media (max-width: 768px) {
  .fines-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;

    .new-fine-btn {
      justify-content: center;
    }
  }

  .filter-tabs {
    .filter-tab {
      padding: 0.75rem 1rem;
      font-size: 0.875rem;
      flex-direction: column;
      gap: 0.25rem;

      .tab-total {
        font-size: 0.65rem;
        margin-left: 0;
      }
    }
  }

  .totals-summary {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;

    .total-item {
      .total-label {
        font-size: 0.7rem;
      }

      .total-value {
        font-size: 1rem;
      }

      &.total-general .total-value {
        font-size: 1.1rem;
      }
    }
  }

  .fines-summary {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;

    .summary-total {
      text-align: center;
    }
  }

  .fines-table {
    font-size: 0.875rem;

    thead th,
    tbody td {
      padding: 0.75rem 0.5rem;
    }

    // Ocultar algumas colunas em mobile
    .fine-location,
    .fine-infraction {
      display: none;
    }
  }

  .pagination-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;

    .pagination-controls {
      justify-content: center;
    }
  }
}

@media (max-width: 480px) {
  .fines-list-container {
    border-radius: 0;
    box-shadow: none;
  }

  .fines-header {
    padding: 1rem;

    .fines-title {
      font-size: 1.1rem;
    }
  }

  .filter-tabs {
    .filter-tab {
      padding: 0.5rem 0.75rem;
      font-size: 0.8rem;
    }
  }

  .fines-summary {
    padding: 0.75rem 1rem;
  }

  // Mostrar apenas colunas essenciais em telas muito pequenas
  .fines-table {
    .fine-driver,
    .fine-actions {
      display: none;
    }
  }
}

// ========================================
// 🌙 DARK MODE
// ========================================

@media (prefers-color-scheme: dark) {
  .fines-list-container {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .new-fine-btn {
    &:hover {
      box-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
    }
  }

  .filter-tabs {
    .filter-tab {
      &.active {
        background: rgba(241, 196, 15, 0.1);
      }
    }
  }
}

// ========================================
// 🎯 ESTADOS ESPECÍFICOS
// ========================================

// Estados vazios, erro e loading já estão definidos globalmente em _status.scss
// Apenas ajustes específicos se necessário

.fines-content {
  .empty-state,
  .error-state,
  .loading-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
  }
}
