/**
 * Audit Trail Styles
 * Styles for AuditViewer, AuditWidget, and related components
 */

/* ========================================
   VIEWER CONTAINER
   ======================================== */

.audit-viewer {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.audit-viewer.full-page {
  padding: 24px;
  margin: 20px;
}

.audit-viewer.embedded {
  padding: 16px;
}

.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E2E8F0;
}

.audit-header h2 {
  margin: 0;
  color: #2D3748;
  font-size: 24px;
}

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

/* ========================================
   FILTERS
   ======================================== */

.audit-filters {
  background: #F7FAFC;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

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

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

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: #4A5568;
  text-transform: uppercase;
}

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

.filter-group.search-group {
  flex-grow: 1;
}

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

/* ========================================
   STATS
   ======================================== */

.audit-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  padding: 16px;
  background: #F7FAFC;
  border-radius: 8px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #2D3748;
}

.stat-label {
  font-size: 12px;
  color: #718096;
  text-transform: uppercase;
}

.stat-item.critical .stat-value { color: #E53E3E; }
.stat-item.high .stat-value { color: #DD6B20; }
.stat-item.medium .stat-value { color: #3182CE; }

/* ========================================
   TIMELINE VIEW
   ======================================== */

.audit-timeline {
  padding: 0;
}

.timeline-date {
  margin-bottom: 24px;
}

.timeline-date h4 {
  color: #4A5568;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #E2E8F0;
}

.timeline-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-entry {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.timeline-entry:hover {
  background: #F7FAFC;
  border-color: #CBD5E0;
}

.entry-indicator {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  margin-right: 12px;
}

.entry-content {
  flex-grow: 1;
}

.entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.entry-icon {
  font-size: 16px;
}

.entry-action {
  font-weight: 600;
  color: #2D3748;
}

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

.entry-details {
  font-size: 13px;
  color: #4A5568;
}

.entry-actor {
  font-weight: 500;
}

.entry-entity {
  color: #718096;
}

/* ========================================
   TABLE VIEW
   ======================================== */

.audit-table {
  width: 100%;
  border-collapse: collapse;
}

.audit-table th {
  text-align: left;
  padding: 12px 16px;
  background: #F7FAFC;
  color: #4A5568;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  border-bottom: 2px solid #E2E8F0;
}

.audit-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #E2E8F0;
  font-size: 14px;
}

.audit-table tr.clickable {
  cursor: pointer;
}

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

/* ========================================
   LEVEL & RESULT BADGES
   ======================================== */

.level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.level-CRITICAL, .level-badge.level-CRITICAL {
  background: #FED7D7;
  color: #C53030;
}

.level-HIGH, .level-badge.level-HIGH {
  background: #FEEBC8;
  color: #C05621;
}

.level-MEDIUM, .level-badge.level-MEDIUM {
  background: #BEE3F8;
  color: #2B6CB0;
}

.level-LOW, .level-badge.level-LOW {
  background: #E2E8F0;
  color: #4A5568;
}

.level-INFO, .level-badge.level-INFO {
  background: #E2E8F0;
  color: #718096;
}

.result-SUCCESS { color: #38A169; }
.result-FAILURE { color: #E53E3E; }
.result-PARTIAL { color: #DD6B20; }

/* ========================================
   DETAIL MODAL
   ======================================== */

.audit-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
}

.audit-detail-modal .modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.audit-detail-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
}

.audit-detail-modal .modal-header h3 {
  margin: 0;
  color: #2D3748;
}

.audit-detail-modal .modal-header button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #718096;
}

.audit-detail-modal .modal-body {
  padding: 20px;
}

.detail-row {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #EDF2F7;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row strong {
  color: #4A5568;
  display: inline-block;
  min-width: 120px;
}

.detail-row pre {
  background: #F7FAFC;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0 0 0;
}

/* ========================================
   DASHBOARD WIDGET
   ======================================== */

.audit-widget {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

.audit-widget-header,
.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #E2E8F0;
}

.audit-widget-header h3,
.widget-header h4 {
  margin: 0;
  font-size: 14px;
  color: #2D3748;
}

.audit-widget-header a,
.widget-header a {
  font-size: 12px;
  color: #3182CE;
  text-decoration: none;
}

.widget-entries {
  padding: 8px 0;
}

.widget-entry {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 12px;
}

.widget-entry:hover {
  background: #F7FAFC;
}

.widget-icon {
  font-size: 16px;
}

.widget-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.widget-action {
  font-size: 13px;
  color: #2D3748;
}

.widget-time {
  font-size: 11px;
  color: #718096;
}

.widget-empty,
.widget-error {
  padding: 20px;
  text-align: center;
  color: #718096;
}

/* ========================================
   UTILITIES
   ======================================== */

.loading {
  padding: 40px;
  text-align: center;
  color: #718096;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: #718096;
}

.error {
  padding: 40px;
  text-align: center;
  color: #E53E3E;
}
