/**
 * Audit Viewer Styles
 * @version 1.0.0
 */

/* Main Container */
.audit-viewer {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.audit-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #1a365d;
  font-size: 1.5rem;
}

.audit-actions {
  display: flex;
  gap: 10px;
}

/* Filters */
.audit-filters {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  color: #4a5568;
  font-weight: 500;
}

.filter-group select,
.filter-group input {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  min-width: 150px;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* View Toggle */
.audit-view-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #4a5568;
  transition: all 0.2s;
}

.toggle-btn:hover {
  background: #f7fafc;
}

.toggle-btn.active {
  background: #3182ce;
  color: white;
  border-color: #3182ce;
}

.entry-count {
  margin-left: auto;
  font-size: 14px;
  color: #718096;
}

/* Timeline View */
.audit-timeline {
  position: relative;
}

.timeline-date {
  font-weight: 600;
  color: #2d3748;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 12px;
  margin-top: 16px;
}

.timeline-date:first-child {
  margin-top: 0;
}

.timeline-entry {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.timeline-entry:last-child {
  border-bottom: none;
}

.timeline-indicator {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-indicator svg {
  width: 18px;
  height: 18px;
  color: white;
}

.timeline-content {
  flex: 1;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.timeline-action {
  font-weight: 600;
  color: #2d3748;
}

.timeline-time {
  font-size: 12px;
  color: #a0aec0;
}

.timeline-actor {
  font-size: 14px;
  color: #4a5568;
}

.timeline-entity {
  font-size: 13px;
  color: #718096;
  margin-top: 2px;
}

.timeline-details {
  font-size: 12px;
  color: #a0aec0;
  margin-top: 6px;
}

.detail-item {
  margin-right: 12px;
}

/* Table View */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.audit-table th {
  background: #f7fafc;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #4a5568;
  border-bottom: 2px solid #e2e8f0;
}

.audit-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.audit-table tr:hover {
  background: #f7fafc;
}

.action-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.result-success { color: #38a169; }
.result-failure { color: #e53e3e; }

/* Pagination */
.audit-pagination {
  margin-top: 20px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.page-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.page-btn:hover {
  background: #f7fafc;
}

.page-info {
  color: #718096;
  font-size: 14px;
}

/* States */
.audit-loading,
.audit-empty,
.audit-error {
  text-align: center;
  padding: 40px;
  color: #718096;
}

.audit-error {
  color: #e53e3e;
}

/* Widget Styles (for dashboard) */
.audit-widget {
  padding: 8px 0;
}

.widget-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.widget-entry:last-of-type {
  border-bottom: none;
}

.widget-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.widget-text {
  flex: 1;
  font-size: 13px;
  color: #4a5568;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-time {
  font-size: 12px;
  color: #a0aec0;
  flex-shrink: 0;
}

.widget-link {
  display: block;
  text-align: center;
  padding: 10px;
  color: #3182ce;
  font-size: 13px;
  text-decoration: none;
  margin-top: 8px;
}

.widget-link:hover {
  text-decoration: underline;
}

.widget-empty,
.widget-error {
  text-align: center;
  padding: 20px;
  color: #a0aec0;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .audit-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-group select,
  .filter-group input {
    width: 100%;
  }

  .audit-table {
    font-size: 12px;
  }

  .audit-table th,
  .audit-table td {
    padding: 8px;
  }
}


/* Category Pills - Quick Filter */
.audit-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-pill:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.category-pill.active {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  border-color: #0d9488;
  color: white;
}

.category-pill[data-category="security"].active {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border-color: #dc2626;
}

.category-pill[data-category="user_management"].active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-color: #2563eb;
}

.category-pill[data-category="data_sync"].active {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  border-color: #0d9488;
}

.category-pill[data-category="reviewer_management"].active {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  border-color: #7c3aed;
}

.category-pill[data-category="campaign_management"].active {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #059669;
}

.category-pill[data-category="configuration"].active {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border-color: #d97706;
}

/* Category badges in timeline */
.timeline-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
}

.timeline-category-badge.security {
  background: #fee2e2;
  color: #991b1b;
}

.timeline-category-badge.user_management {
  background: #dbeafe;
  color: #1e40af;
}

.timeline-category-badge.data_sync {
  background: #ccfbf1;
  color: #115e59;
}

.timeline-category-badge.reviewer_management {
  background: #ede9fe;
  color: #5b21b6;
}

.timeline-category-badge.campaign_management {
  background: #d1fae5;
  color: #065f46;
}

.timeline-category-badge.configuration {
  background: #fef3c7;
  color: #92400e;
}

.timeline-category-badge.general {
  background: #f1f5f9;
  color: #475569;
}


/* Audit Header with Back Button */
.audit-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.audit-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.audit-back-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.audit-back-btn i {
  width: 16px;
  height: 16px;
}
