/* Compare Tab Professional UI Overhaul */
.compare-view-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f8fafc;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

/* Header Section */
.compare-header {
  background: #ffffff;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.header-info h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.header-info p {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* YOLO Toggle */
.yolo-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-right: 1.5rem;
  border-right: 1px solid #e2e8f0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked+.toggle-slider {
  background-color: #3b82f6;
}

input:checked+.toggle-slider:before {
  transform: translateX(16px);
}

.toggle-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.025em;
}

/* View Mode Buttons */
.view-mode-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

.view-mode-toggle button {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.view-mode-toggle button.active {
  background: #ffffff;
  color: #3b82f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Main Layout */
.compare-main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.compare-content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1.5rem;
  min-width: 0;
  overflow: hidden;
}

/* Viewport & Side Navigation */
.viewport-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  min-height: 0;
}

.side-nav-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 20;
  flex-shrink: 0;
}

.side-nav-btn:hover:not(:disabled) {
  background: #ffffff;
  color: #3b82f6;
  transform: scale(1.1);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.side-nav-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.side-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

.side-nav-btn i {
  font-size: 1.5rem;
}

/* Image View Area */
.image-view-area {
  flex: 1;
  background: #0f172a;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  height: 100%;
}

.empty-state {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: center;
}

/* Comparison Layouts */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  height: 100%;
  padding: 1rem;
}

.compare-grid-item {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #000;
  border: 1px solid #1e293b;
  height: 100%;
  min-height: 300px;
}

.ba-slider-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: col-resize;
}

.ba-before,
.ba-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #3b82f6;
  z-index: 15;
  pointer-events: none;
}

.ba-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  z-index: 16;
}

/* Per-image navigation buttons in grid view */
.item-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-size: 20px;
  font-weight: bold;
  -webkit-appearance: none;
  appearance: none;
}

.item-nav-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #3b82f6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.item-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.item-nav-btn.left {
  left: 12px;
}

.item-nav-btn.right {
  right: 12px;
}

/* Timestamp overlay for each grid item */
.image-info-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  z-index: 15;
}

/* Control Area */
.controls-area {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.controls-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 1rem;
}

.autoplay-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.autoplay-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.autoplay-toggle input {
  display: none;
}

.autoplay-toggle .toggle-slider {
  position: relative;
  width: 32px;
  height: 18px;
  display: inline-block;
}

.autoplay-toggle .label-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

.speed-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.speed-select select {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #3b82f6;
  outline: none;
}

.frame-counter {
  background: #eff6ff;
  color: #3b82f6;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  border: 1px solid #dbeafe;
}

.sliders-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.range-row {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.range-header .label {
  font-size: 0.65rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.range-header .badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
}

.range-header .badge.t1 {
  background: #eff6ff;
  color: #3b82f6;
}

.range-header .badge.t2 {
  background: #eef2ff;
  color: #6366f1;
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

#idx2::-webkit-slider-thumb {
  border-color: #6366f1;
}

/* Right Panel */
.compare-right-panel {
  width: 360px;
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.tab-headers {
  display: flex;
  background: #f8fafc;
  padding: 0.5rem;
  gap: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.tab-headers button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.tab-headers button.active {
  background: #ffffff;
  color: #3b82f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-headers button i {
  font-size: 1rem;
}

.tab-content-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-pane {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 1.25rem;
  gap: 1.25rem;
  overflow-y: auto;
}

.tab-pane.active {
  display: flex;
}

/* Config Cards */
.config-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  overflow: hidden;
}

.card-header {
  background: #ffffff;
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-header i {
  font-size: 1.1rem;
  color: #3b82f6;
}

.card-header h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.input-group label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  padding-left: 0.25rem;
}

.input-group select,
.input-group input,
.input-group textarea {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1e293b;
  outline: none;
  transition: all 0.2s;
}

.input-group select:focus,
.input-group input:focus,
.input-group textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.875rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.primary-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn.dark {
  background: #0f172a;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.2);
}

.primary-btn.dark:hover {
  background: #000000;
}

/* Ticket Logs */
.ticket-logs {
  flex: 1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.ticket-logs .card-header {
  justify-content: space-between;
}

#ticket-status-filter {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 800;
  color: #3b82f6;
  text-transform: uppercase;
  outline: none;
}

.log-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #ffffff;
}

.ticket-card {
  padding: 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  transition: all 0.2s;
}

.ticket-card:hover {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.ticket-header .id {
  font-weight: 800;
  font-size: 0.75rem;
  color: #475569;
}

.status-badge {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.open .status-badge {
  background: #dcfce7;
  color: #166534;
}

.wip .status-badge {
  background: #eff6ff;
  color: #1e40af;
}

.close .status-badge {
  background: #f1f5f9;
  color: #475569;
}

.ticket-card .desc {
  font-size: 0.75rem;
  color: #334155;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ticket-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
}

.empty-logs,
.error-msg {
  text-align: center;
  padding: 2rem;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}