/* ===== AUDIT TRAIL ===== */

.aud-container {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.aud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.aud-header-left h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  display: flex;
  align-items: center;
  gap: 10px;
}

.aud-header-left h2 i { color: #8b5cf6; }

.aud-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
  margin-top: 2px;
  display: block;
}

.aud-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(15, 17, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #e2e8f0);
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.aud-btn-secondary:hover { border-color: #8b5cf6; }

/* ===== STATS CARDS ===== */

.aud-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.aud-stat-card {
  background: rgba(15, 17, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s;
}

.aud-stat-card:hover { border-color: rgba(139, 92, 246, 0.2); transform: translateY(-1px); }

.aud-stat-card i {
  font-size: 1.3rem;
  color: #8b5cf6;
  margin-bottom: 8px;
}

.aud-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary, #e2e8f0);
}

.aud-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #94a3b8);
  font-weight: 600;
  margin-top: 2px;
}

/* ===== FILTERS ===== */

.aud-filters {
  background: rgba(15, 17, 30, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.aud-filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.aud-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aud-filter-group.search { flex: 1; min-width: 180px; }

.aud-filter-group label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.aud-filter-group select,
.aud-filter-group input {
  background: rgba(15, 17, 30, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 8px;
  color: var(--text-primary, #e2e8f0);
  padding: 7px 10px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.aud-filter-group select:focus,
.aud-filter-group input:focus { border-color: #8b5cf6; }

.aud-btn-clear {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
  color: #f87171;
  cursor: pointer;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.aud-btn-clear:hover { background: rgba(239, 68, 68, 0.12); }

/* ===== TABLE ===== */

.aud-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.aud-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.aud-table thead th {
  background: rgba(15, 17, 30, 0.6);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.aud-table tbody td {
  padding: 10px 14px;
  color: var(--text-primary, #e2e8f0);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.aud-table tbody tr:hover td { background: rgba(139, 92, 246, 0.03); }

.aud-date {
  font-size: 0.75rem;
  color: var(--text-secondary, #94a3b8) !important;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

.aud-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8) !important;
}

.aud-details {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-secondary, #cbd5e1) !important;
}

.aud-user-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.aud-user-cell i { color: #8b5cf6; font-size: 0.85rem; }

/* Action badges */
.aud-action-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.aud-action-badge i { font-size: 0.6rem; }

.aud-action-badge.create { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.aud-action-badge.update { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.aud-action-badge.delete { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.aud-action-badge.toggle { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.aud-action-badge.grant { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.aud-action-badge.cancel { background: rgba(239, 68, 68, 0.08); color: #f87171; }
.aud-action-badge.login { background: rgba(34, 211, 238, 0.1); color: #22d3ee; }
.aud-action-badge.default { background: rgba(148, 163, 184, 0.1); color: #94a3b8; }

/* Entity badges */
.aud-entity-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary, #94a3b8);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.aud-entity-badge i { font-size: 0.65rem; color: #8b5cf6; }

/* ===== PAGINATION ===== */

.aud-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
}

.aud-page-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 17, 30, 0.4);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aud-page-btn:hover:not(:disabled) { border-color: #8b5cf6; }
.aud-page-btn.active { background: rgba(139, 92, 246, 0.2); border-color: #8b5cf6; color: #a78bfa; font-weight: 700; }
.aud-page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.aud-dots { color: var(--text-secondary, #94a3b8); padding: 0 4px; }

/* Loading & Empty */
.aud-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary, #94a3b8);
}

.aud-loading i { margin-right: 8px; color: #8b5cf6; }

.aud-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary, #94a3b8);
}

.aud-empty i { font-size: 3rem; color: rgba(139, 92, 246, 0.3); margin-bottom: 16px; }
.aud-empty p { margin-top: 8px; font-size: 0.9rem; }


/* ===== LIGHT THEME ===== */

[data-theme="light"] .aud-header-left h2 { color: #1e293b; }
[data-theme="light"] .aud-subtitle { color: #64748b; }

[data-theme="light"] .aud-stat-card { background: #fff; border-color: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
[data-theme="light"] .aud-stat-value { color: #0f172a; }
[data-theme="light"] .aud-stat-label { color: #475569; }

[data-theme="light"] .aud-filters { background: #f8fafc; border-color: #e2e8f0; }
[data-theme="light"] .aud-filter-group label { color: #475569; }
[data-theme="light"] .aud-filter-group select,
[data-theme="light"] .aud-filter-group input { background: #fff; border-color: #cbd5e1; color: #1e293b; }

[data-theme="light"] .aud-table-wrapper { border-color: #e2e8f0; }
[data-theme="light"] .aud-table thead th { background: #f8fafc; color: #475569; border-bottom-color: #e2e8f0; }
[data-theme="light"] .aud-table tbody td { color: #1e293b; border-bottom-color: #f1f5f9; }
[data-theme="light"] .aud-table tbody tr:hover td { background: rgba(139, 92, 246, 0.04); }
[data-theme="light"] .aud-date { color: #64748b !important; }
[data-theme="light"] .aud-details { color: #475569 !important; }

[data-theme="light"] .aud-page-btn { background: #fff; border-color: #e2e8f0; color: #334155; }

[data-theme="light"] .aud-btn-secondary { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
[data-theme="light"] .aud-empty { color: #475569; }
[data-theme="light"] .aud-loading { color: #475569; }


/* ===== RESPONSIVO ===== */

@media (max-width: 768px) {
  .aud-container { padding: 16px; }
  .aud-filter-row { flex-direction: column; }
  .aud-stats { grid-template-columns: 1fr 1fr; }
  .aud-table { font-size: 0.75rem; }
  .aud-details { max-width: 160px; }
}
