/* ── Version History Slide-Out Panel ─────────────────────── */

.vh-panel {
	position: fixed;
	top: 0;
	right: 0;
	width: 340px;
	height: 100vh;
	background: #1e1e1e;
	border-left: 1px solid #333;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.25s ease, width 0.2s ease;
	z-index: 900;
	box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
	min-width: 260px;
	max-width: 100vw;
}
.vh-panel.vh-open {
	transform: translateX(0);
}
.vh-panel.vh-maximized {
	width: 100vw !important;
}
.vh-panel.vh-resizing {
	transition: none;
}

/* ── Resize Handle ─────────────────────────────────────── */

.vh-panel-resizer {
	position: absolute;
	left: -3px;
	top: 0;
	width: 6px;
	height: 100%;
	cursor: col-resize;
	z-index: 10;
}
.vh-panel-resizer:hover,
.vh-panel-resizer.active {
	background: rgba(78, 201, 176, 0.4);
}

/* ── Header ─────────────────────────────────────────────── */

.vh-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid #333;
	flex-shrink: 0;
}
.vh-panel-header h3 {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: #e5e7eb;
}
.vh-panel-header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}
.vh-panel-maximize {
	background: none;
	border: none;
	color: #999;
	cursor: pointer;
	padding: 2px 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 3px;
}
.vh-panel-maximize:hover {
	color: #4ec9b0;
}
.vh-panel-close {
	background: none;
	border: none;
	color: #999;
	font-size: 1.3rem;
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
}
.vh-panel-close:hover {
	color: #fff;
}

/* ── Actions ────────────────────────────────────────────── */

.vh-panel-actions {
	display: flex;
	gap: 8px;
	padding: 10px 16px;
	border-bottom: 1px solid #2a2a2a;
	flex-shrink: 0;
}
.vh-btn {
	padding: 5px 12px;
	border: none;
	border-radius: 4px;
	font-size: 0.75rem;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s;
}
.vh-btn-primary {
	background: #4ec9b0;
	color: #1e1e1e;
	font-weight: 600;
}
.vh-btn-primary:hover {
	background: #3db89d;
}
.vh-btn-danger {
	background: transparent;
	color: #e74c3c;
	border: 1px solid #e74c3c;
}
.vh-btn-danger:hover {
	background: rgba(231, 76, 60, 0.15);
}

/* ── Stats ──────────────────────────────────────────────── */

.vh-panel-stats {
	display: flex;
	gap: 12px;
	padding: 6px 16px;
	font-size: 0.7rem;
	color: #777;
	border-bottom: 1px solid #2a2a2a;
	flex-shrink: 0;
	flex-wrap: wrap;
}

/* ── Timeline ───────────────────────────────────────────── */

.vh-timeline {
	flex: 1;
	overflow-y: auto;
	padding: 8px 0 8px 0;
}

.vh-empty {
	padding: 2rem;
	text-align: center;
	color: #666;
	font-size: 0.85rem;
}

/* ── Time Group ─────────────────────────────────────────── */

.vh-time-group {
	margin-bottom: 4px;
}
.vh-time-group-header {
	position: sticky;
	top: 0;
	padding: 6px 16px;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #888;
	background: #1e1e1e;
	z-index: 1;
}

/* ── Entry ──────────────────────────────────────────────── */

.vh-entry {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 16px 8px 20px;
	cursor: pointer;
	position: relative;
	transition: background 0.12s;
}
.vh-entry:hover {
	background: #2a2a2a;
}

/* Timeline dot and line */
.vh-entry-dot {
	position: absolute;
	left: 10px;
	top: 14px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	flex-shrink: 0;
}
.vh-entry::before {
	content: '';
	position: absolute;
	left: 12px;
	top: 22px;
	bottom: -2px;
	width: 1px;
	background: #333;
}
.vh-time-group .vh-entry:last-child::before {
	display: none;
}

/* Accent colors */
.vh-accent-teal .vh-entry-dot { background: #4ec9b0; }
.vh-accent-teal .vh-entry-icon { color: #4ec9b0; }

.vh-accent-gold .vh-entry-dot { background: #d4af6a; }
.vh-accent-gold .vh-entry-icon { color: #d4af6a; }

.vh-accent-red .vh-entry-dot { background: #e74c3c; }
.vh-accent-red .vh-entry-icon { color: #e74c3c; }

/* Entry content */
.vh-entry-content {
	flex: 1;
	min-width: 0;
	padding-left: 6px;
}
.vh-entry-header {
	display: flex;
	align-items: center;
	gap: 6px;
}
.vh-entry-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
}
.vh-entry-desc {
	font-size: 0.8rem;
	color: #ddd;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	min-width: 0;
}
.vh-entry-meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 2px;
}
.vh-entry-file {
	font-size: 0.7rem;
	color: #888;
	font-family: monospace;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.vh-entry-time {
	font-size: 0.7rem;
	color: #666;
	white-space: nowrap;
	margin-left: auto;
}

/* Restore button */
.vh-restore-btn {
	padding: 2px 8px;
	border: 1px solid #4ec9b0;
	border-radius: 3px;
	background: transparent;
	color: #4ec9b0;
	font-size: 0.7rem;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 0.15s;
}
.vh-restore-btn:hover {
	background: #4ec9b0;
	color: #1e1e1e;
}

/* ── Diff Viewer ────────────────────────────────────────── */

.vh-diff-viewer {
	border-top: 1px solid #333;
	flex-shrink: 0;
	max-height: 40%;
	overflow-y: auto;
	background: #252525;
}
.vh-diff-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	border-bottom: 1px solid #333;
	position: sticky;
	top: 0;
	background: #252525;
	z-index: 1;
}
.vh-diff-title {
	font-size: 0.8rem;
	color: #ccc;
	font-family: monospace;
}
.vh-diff-close {
	background: none;
	border: none;
	color: #999;
	font-size: 1.1rem;
	cursor: pointer;
	padding: 0 4px;
}
.vh-diff-close:hover {
	color: #fff;
}
.vh-diff-content {
	padding: 8px 12px;
	font-size: 0.75rem;
	font-family: monospace;
	line-height: 1.5;
}
.vh-diff-content .diff-line-delete {
	background: rgba(231, 76, 60, 0.15);
	color: #e74c3c;
}
.vh-diff-content .diff-line-insert {
	background: rgba(78, 201, 176, 0.15);
	color: #4ec9b0;
}

/* Snapshot file list in diff viewer */
.vh-snapshot-files {
	color: #bbb;
	font-size: 0.8rem;
}
.vh-snapshot-files ul {
	margin: 6px 0;
	padding-left: 20px;
}
.vh-snapshot-files li {
	padding: 2px 0;
	color: #999;
}

/* ── Toggle Button (editor header) ──────────────────────── */

.vh-toggle-btn {
	background: none;
	border: 1px solid transparent;
	color: #999;
	cursor: pointer;
	padding: 3px;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.15s, border-color 0.15s;
}
.vh-toggle-btn:hover {
	color: #4ec9b0;
	border-color: #4ec9b0;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
	.vh-panel {
		width: 100%;
	}
}
