/**
 * Change History Styles
 */

/* History Panel */
.history-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.history-header h5 {
  margin: 0;
  font-size: 14px;
  color: #374151;
}

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

.export-history-btn,
.clear-history-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.export-history-btn:hover,
.clear-history-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.clear-history-btn:hover {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

/* History Timeline */
.history-timeline {
  position: relative;
  padding: 20px 0;
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 36px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e5e7eb;
}

.history-item {
  position: relative;
  padding: 0 0 24px 60px;
}

.history-item:last-child {
  padding-bottom: 0;
}

.history-timeline-marker {
  position: absolute;
  left: 28px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  border: 3px solid #6f86cf;
  z-index: 1;
}

.history-item.create .history-timeline-marker {
  background: #10b981;
  border-color: #10b981;
}

.history-item.update .history-timeline-marker {
  background: #6f86cf;
  border-color: #6f86cf;
}

.history-item.rollback .history-timeline-marker {
  background: #f59e0b;
  border-color: #f59e0b;
}

.history-content {
  background: #f9fafb;
  border-radius: 8px;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.history-action {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-action.create {
  background: #d1fae5;
  color: #065f46;
}

.history-action.update {
  background: #dbeafe;
  color: #1e40af;
}

.history-action.rollback {
  background: #fef3c7;
  color: #92400e;
}

.history-user {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

.history-date {
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}

/* Changes List */
.changes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.change-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  padding: 8px;
  background: white;
  border-radius: 6px;
}

.field-name {
  font-weight: 500;
  color: #374151;
  min-width: 120px;
}

.change-arrow {
  color: #9ca3af;
  font-weight: bold;
}

.change-values {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.old-value {
  background: #fee2e2;
  color: #991b1b;
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: line-through;
  font-size: 12px;
}

.new-value {
  background: #d1fae5;
  color: #065f46;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.change-separator {
  color: #9ca3af;
  font-size: 11px;
}

.no-changes {
  color: #9ca3af;
  font-size: 13px;
  font-style: italic;
}

/* History Actions Row */
.history-actions-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.rollback-btn {
  padding: 6px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rollback-btn:hover {
  background: #f3f4f6;
  border-color: #6f86cf;
  color: #6f86cf;
}

/* History Empty */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #9ca3af;
}

.history-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.history-empty p {
  margin: 0;
  font-size: 14px;
}

/* Dark Theme */
body.dark-theme .history-panel {
  background: transparent;
}

body.dark-theme .history-header {
  background: #1e293b;
  border-bottom-color: #334155;
}

body.dark-theme .history-header h5 {
  color: #e2e8f0;
}

body.dark-theme .export-history-btn,
body.dark-theme .clear-history-btn {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .export-history-btn:hover,
body.dark-theme .clear-history-btn:hover {
  background: #475569;
}

body.dark-theme .clear-history-btn:hover {
  background: #7f1d1d;
  border-color: #dc2626;
  color: #fca5a5;
}

body.dark-theme .history-timeline::before {
  background: #334155;
}

body.dark-theme .history-timeline-marker {
  background: #1e293b;
}

body.dark-theme .history-content {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .history-user {
  color: #e2e8f0;
}

body.dark-theme .change-row {
  background: #0f172a;
}

body.dark-theme .field-name {
  color: #e2e8f0;
}

body.dark-theme .old-value {
  background: #7f1d1d;
  color: #fca5a5;
}

body.dark-theme .new-value {
  background: #064e3b;
  color: #6ee7b7;
}

body.dark-theme .history-action.create {
  background: #064e3b;
  color: #6ee7b7;
}

body.dark-theme .history-action.update {
  background: #1e3a5f;
  color: #93c5fd;
}

body.dark-theme .history-action.rollback {
  background: #78350f;
  color: #fcd34d;
}

body.dark-theme .rollback-btn {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-theme .rollback-btn:hover {
  background: #475569;
  border-color: #6f86cf;
  color: #6f86cf;
}

body.dark-theme .history-empty {
  color: #64748b;
}
