/* Version History Panel Styles */

.history-panel {
  width: 320px;
  min-width: 320px;
  height: 100%;
  background: #fff;
  border-left: 1px solid #dedede;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-right: -320px;
  transition: margin-right 0.2s ease;
}

.history-panel.open {
  margin-right: 0;
}

/* Panel Header */
.history-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}

.history-panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #141414;
}

.panel-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.panel-close-btn:hover {
  color: #141414;
}

/* History List */
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.history-item {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.history-item:hover {
  border-color: #0969da;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.current-version-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #0969da;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.history-item-date {
  font-size: 13px;
  font-weight: 600;
  color: #141414;
}

.history-item-sha {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 11px;
  color: #6b7280;
  background: #f6f8fa;
  padding: 2px 6px;
  border-radius: 4px;
}

.history-item-message {
  font-size: 13px;
  color: #141414;
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-item-author {
  font-size: 12px;
  color: #6b7280;
}

.loading-history,
.history-error,
.history-empty {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.history-error {
  color: #d4145a;
}

/* History Overlay (Full Screen) */
.history-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-overlay > .history-overlay-inner {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 90vw;
  max-width: 1400px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.history-overlay-title {
  font-size: 16px;
  font-weight: 600;
  color: #141414;
}

.history-overlay-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-secondary {
  padding: 8px 16px;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #141414;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}

.btn-primary {
  padding: 8px 16px;
  border: 1px solid #0969da;
  background: #0969da;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: #0550ae;
  border-color: #0550ae;
}

.btn-icon {
  padding: 8px;
  border: none;
  background: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: #141414;
}

/* Overlay Content */
.history-overlay-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Single Version View */
.single-version-view {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

.version-content {
  flex: 1;
  overflow: auto;
}

.version-content pre {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  color: #141414;
}

.loading-version,
.version-error {
  padding: 40px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.version-error {
  color: #d4145a;
}

/* Comparison View */
.comparison-view {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.comparison-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overflow-y: auto;
  border-right: 1px solid #e5e5e5;
}

.comparison-column:last-child {
  border-right: none;
}

.comparison-left {
  background: #fef8f8;
}

.comparison-right {
  background: #f0f8f0;
}

.comparison-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: rgba(255, 255, 255, 0.5);
}

.version-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 13px;
  color: #141414;
  background: #fff;
  cursor: pointer;
}

.version-select:focus {
  outline: none;
  border-color: #0969da;
}

/* Diff Content */
.diff-content {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  padding: 16px;
}

.diff-line {
  padding: 2px 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 1.6em;
}

.diff-added {
  background: #d1f4d1;
  color: #0e5814;
}

.diff-removed {
  background: #ffd7d5;
  color: #86181d;
}

.diff-empty {
  background: #f6f8fa;
  color: #6b7280;
}

/* Scrollbar Styling */
.history-list::-webkit-scrollbar,
.version-content::-webkit-scrollbar,
.single-version-view::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-track,
.version-content::-webkit-scrollbar-track,
.single-version-view::-webkit-scrollbar-track {
  background: #f6f8fa;
}

.history-list::-webkit-scrollbar-thumb,
.version-content::-webkit-scrollbar-thumb,
.single-version-view::-webkit-scrollbar-thumb {
  background: #d0d7de;
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.version-content::-webkit-scrollbar-thumb:hover,
.single-version-view::-webkit-scrollbar-thumb:hover {
  background: #afb8c1;
}
