/* gj/sprite.css */

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.frames-panel h3 {
  justify-content: flex-start;
  gap: 4px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text);
  background: var(--input-bg);
}

.tab-btn.active {
  color: #fff;
  background: var(--btn-primary-bg);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Mode Tabs (Right Panel) */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--input-bg);
  padding: 4px;
  border-radius: var(--radius-md);
}

.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.active {
  color: #fff;
  background: var(--btn-primary-bg);
  box-shadow: var(--shadow-sm);
}

/* Tool Controls (Import Bar) */
.tool-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--input-bg);
  padding: 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.file-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
}

#videoUrlInput {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  min-width: 200px;
}

#videoUrlInput:focus {
  border-color: var(--accent);
}

/* Video Preview Area */
.video-preview-wrapper {
  margin-bottom: 24px;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.video-preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player {
  width: 100%;
  height: 100%;
  max-height: 60vh;
  display: block;
  object-fit: contain;
}

/* File Drop Area (for Images tab) */
.file-drop-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--input-bg);
}

.file-drop-area:hover {
  border-color: var(--accent);
  background: var(--input-focus-bg);
}

.drop-text .icon {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
}

.drop-text p {
  margin: 0;
  font-weight: 500;
  color: var(--text);
}

.drop-text small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

/* Controls */
.control-group {
  margin-top: 20px;
}

.control-group.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Capture Modules Layout */
.capture-modules-container {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.capture-module {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.module-title {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.auto-capture-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: flex;
  gap: 12px;
}

.col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.col label {
  font-size: 12px;
  color: var(--muted);
}

.col input, .col select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* Progress Bar */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 3px;
  margin-top: auto; /* Push to bottom */
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--success);
  width: 0%;
  transition: width 0.2s;
}

/* Frame Grid */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding: 4px;
}

.frame-item {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--thumb-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: grab;
}

.frame-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.frame-item .delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.frame-item:hover .delete-btn {
  opacity: 1;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--muted);
  background: var(--input-bg);
  border-radius: var(--radius-md);
}

/* Settings */
.setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent flex/grid overflow */
}

/* Compact inputs for settings */
.setting-grid input,
.setting-grid select {
  padding: 8px 10px !important; /* Override global style */
  font-size: 13px;
  height: 36px; /* Fixed height for consistency */
}

.setting-grid label {
  font-size: 12px;
  margin-bottom: 4px;
  white-space: nowrap; /* Prevent label wrapping */
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
}

.color-input-wrapper input[type="color"] {
  padding: 0 !important;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 0 !important;
}

/* Preview Panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.canvas-container {
  background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2MzYzVjNyIgZmlsbC1vcGFjaXR5PSIwLjEiPjxyZWN0IHdpZHRoPSIxMCIgaGVpZ2h0PSIxMCIvPjxyZWN0IHg9IjEwIiB5PSIxMCIgd2lkdGg9IjEwIiBoZWlnaHQ9IjEwIi8+PC9zdmc+');
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

#previewCanvas {
  max-width: 100%;
  max-height: 500px;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

#previewCanvas:hover {
  transform: scale(1.02);
}

.preview-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* New Fingerprint Settings Styles */
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-row.vertical {
    gap: 15px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group label {
  font-size: 12px;
  color: var(--muted);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.visual-settings {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.4;
}

.hidden {
    display: none !important;
}

/* Image Preview Modal */
.modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  position: relative;
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: 95vh;
}

.modal-content img {
  display: block;
  max-width: 100%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 5px 30px rgba(0,0,0,0.5);
}

.close-modal {
  position: absolute;
  top: -40px;
  right: -10px;
  color: #fff;
  font-size: 36px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
}

.close-modal:hover {
  color: var(--accent);
}