/* altcss/note-history-modal.css */

note-history-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}

.note-history-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: backdropFadeIn 0.3s ease-out;
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.note-history-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 1400px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: containerSlideIn 0.3s ease-out;
}

@keyframes containerSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.note-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 12px 12px 0 0;
}

.note-history-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.note-history-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.note-history-close:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Body - Split layout */
.note-history-body {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 1px;
  background: var(--border-color);
}

/* Left section - History list (1/3) */
.history-list-section {
  flex: 0 0 33.333%;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  min-width: 0;
}

.history-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.history-list-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 300px;
}

.history-list-item {
  padding: 12px 16px;
  margin-bottom: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-list-item:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
}

.history-list-item.selected {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.history-list-item.selected .history-item-date,
.history-list-item.selected .history-item-time {
  color: white;
}

.history-item-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.history-item-time {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Right section - Preview (2/3) */
.history-preview-section {
  flex: 0 0 66.666%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
  overflow: hidden;
}

.history-preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 400px;
}

.history-preview-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.history-preview-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

.history-preview-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.history-preview-language {
  padding: 4px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.history-preview-body {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.history-preview-body pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  background: transparent;
}

.history-preview-body code {
  font-family: 'Courier New', Consolas, Monaco, monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Loading/empty states */
.history-loading,
.history-empty,
.history-error,
.history-preview-loading,
.history-preview-empty,
.history-preview-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-tertiary);
  font-size: 14px;
  text-align: center;
}

.history-error,
.history-preview-error {
  color: #ef4444;
}

/* Footer */
.note-history-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 0 0 12px 12px;
}

.history-action-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.history-restore-btn {
  background: var(--accent-color);
  color: white;
}

.history-restore-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.history-delete-btn {
  background: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.history-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  transform: translateY(-1px);
}

.history-action-btn:active {
  transform: translateY(0);
}

/* Scrollbar styling */
.history-list::-webkit-scrollbar,
.history-preview-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.history-list::-webkit-scrollbar-track,
.history-preview-content::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.history-list::-webkit-scrollbar-thumb,
.history-preview-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover,
.history-preview-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Responsive design */
@media (max-width: 1024px) {
  .note-history-container {
    max-width: 95vw;
    height: 90vh;
  }
}

@media (max-width: 768px) {
  .note-history-backdrop {
    padding: 10px;
  }

  .note-history-container {
    height: 95vh;
  }

  .note-history-body {
    flex-direction: column;
  }

  .history-list-section {
    flex: 0 0 200px;
    max-height: 200px;
  }

  .history-list {
    min-height: 150px;
  }

  .history-preview-section {
    flex: 1;
  }

  .history-preview-content {
    padding: 16px;
    min-height: 200px;
  }

  .history-preview-title {
    font-size: 20px;
  }

  .note-history-footer {
    flex-wrap: nowrap;
  }

  .history-action-btn {
    flex: 0 1 auto;
    min-width: 100px;
  }
}

@media (max-width: 480px) {
  .note-history-header {
    padding: 16px;
  }

  .note-history-title {
    font-size: 18px;
  }

  .note-history-container {
    height: 98vh;
  }

  .history-list-section {
    flex: 0 0 150px;
    max-height: 150px;
  }

  .history-list {
    min-height: 100px;
  }

  .history-preview-content {
    padding: 12px;
    min-height: 150px;
  }

  .history-preview-title {
    font-size: 18px;
  }

  .history-preview-body code {
    font-size: 13px;
  }

  .note-history-footer {
    padding: 12px 16px;
    gap: 8px;
  }

  .history-action-btn {
    min-width: 80px;
    padding: 8px 12px;
    font-size: 13px;
  }
}
