/**
 * ToolFlux Lab - Image Studio Stylesheet
 * Responsive, bidirectional (LTR/RTL), dark-mode ready workspace styling.
 */

.studio-workspace-page {
  padding-block: var(--space-8) var(--space-16);
}

.studio-nav-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: thin;
}

.studio-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.studio-tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.studio-tab-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* Drop Zone */
.studio-drop-zone {
  border: 2px dashed var(--border);
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.studio-drop-zone:hover,
.studio-drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-2px);
}

html.dark .studio-drop-zone:hover,
html.dark .studio-drop-zone.dragover {
  background: rgba(37, 99, 235, 0.1);
}

.drop-zone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface-secondary);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.drop-zone-title {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.drop-zone-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
}

/* Active File Bar */
.active-file-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.active-file-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.active-file-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.active-file-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Two-column Studio Layout */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

@media (min-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr 1.15fr;
    align-items: start;
    gap: var(--space-8);
  }
}

/* Control Cards */
.studio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.studio-card-header {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Presets & Buttons */
.preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.btn-chip {
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-chip:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn-chip.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Preview Hub */
.preview-hub-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.preview-canvas-wrapper {
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  max-height: 520px;
}

html.dark .preview-canvas-wrapper {
  background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 20px 20px;
}

.preview-display-img {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  display: block;
}

/* Crop Canvas */
.crop-canvas-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0F172A;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

#interactiveCropCanvas {
  max-width: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* Result Stats Bar */
.result-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.stat-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-pill-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stat-pill-value {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text-primary);
}

/* Batch Table */
.batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-block: var(--space-4);
}

.batch-table th,
.batch-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  text-align: start;
}

.batch-table th {
  background: var(--surface-secondary);
  font-weight: 700;
  color: var(--text-secondary);
}

/* Range input custom styling */
input[type="range"].studio-slider {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 4px;
  outline: none;
  accent-color: var(--accent);
}

/* RTL Adjustments */
html[dir="rtl"] .studio-nav-tabs {
  direction: rtl;
}

html[dir="rtl"] .batch-table th,
html[dir="rtl"] .batch-table td {
  text-align: right;
}
