/* ==========================================================================
   translator.css - Manga Studio Translation & Typesetting Stylesheet
   ========================================================================== */

/* Overall Page Layout */
.translator-page {
  background-color: var(--bg-main, #000000);
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-family, 'Prompt', 'Inter', sans-serif);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
}

/* ==========================================================================
   Top Header Navigation
   ========================================================================== */
.studio-header {
  height: 54px;
  background: rgba(10, 11, 13, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary, #94a3b8);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 8px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--transition-fast, 0.18s);
}

.nav-back-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.studio-brand h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  margin-left: 6px;
}

.studio-brand h1 span {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--accent-primary, #f43f5e);
  margin-left: 4px;
  background: rgba(244, 63, 94, 0.12);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

/* History and Zoom Controls in Header */
.history-actions, .zoom-controls {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm, 8px);
  padding: 2px 4px;
  gap: 2px;
}

.studio-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  border-radius: 6px;
  padding: 6px 10px;
  transition: all var(--transition-fast, 0.18s);
}

.studio-btn:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.studio-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.studio-btn.icon-only {
  width: 28px;
  height: 28px;
  padding: 0;
}

.studio-btn.pill-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
}

.zoom-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
  padding: 0 6px;
  min-width: 44px;
  text-align: center;
}

.studio-btn.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #f8fafc);
}

.studio-btn.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.studio-btn.primary-btn {
  background: var(--accent-primary, #f43f5e);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 10px var(--accent-glow, rgba(244, 63, 94, 0.35));
}

.studio-btn.primary-btn:hover {
  background: var(--accent-hover, #fb7185);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow, rgba(244, 63, 94, 0.45));
}

.studio-btn.highlight-btn {
  padding: 7px 14px;
  border-radius: 8px;
  letter-spacing: -0.01em;
}

/* Dropdown Menu */
.dropdown-wrapper {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #14161d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  display: none;
  flex-direction: column;
  min-width: 190px;
  padding: 6px;
  z-index: 120;
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-menu button {
  background: transparent;
  border: none;
  color: var(--text-primary, #f8fafc);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 8px 12px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Main Workspace Grid Layout
   ========================================================================== */
.studio-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   1. Left Panel: Pages Sidebar (Thumbnails)
   ========================================================================== */
.pages-sidebar {
  width: 200px;
  background: #090a0d;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease;
  z-index: 40;
}

.pages-sidebar.collapsed {
  width: 0;
  border-right: none;
  overflow: hidden;
}

.pages-header {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
}

.pages-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pages-title-row h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
}

.pages-title-row h3 span {
  color: #fff;
}

.sidebar-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  border-radius: 4px;
}

.sidebar-collapse-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.pages-action-row {
  display: flex;
  gap: 6px;
}

.add-page-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s;
}

.add-page-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-primary, #f43f5e);
}

.clear-pages-btn {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: #fb7185;
  font-size: 0.75rem;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
}

.clear-pages-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #fff;
}

/* Pages List Thumbnails */
.pages-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-pages-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted, #64748b);
  gap: 8px;
}

.empty-pages-hint p {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
}

.empty-pages-hint span {
  font-size: 0.72rem;
}

/* Individual Page Item */
.page-thumb-card {
  position: relative;
  background: #121319;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 240px;
}

.page-thumb-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.page-thumb-card.active {
  border-color: var(--accent-primary, #f43f5e);
  box-shadow: 0 0 12px var(--accent-glow, rgba(244, 63, 94, 0.35));
}

.page-thumb-img-wrapper {
  position: relative;
  width: 100%;
  height: 205px;
  min-height: 205px;
  flex-shrink: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.page-thumb-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-num-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.page-edited-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent-primary, #f43f5e);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
}

.page-thumb-footer {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.75rem;
}

.page-thumb-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
  color: var(--text-secondary, #94a3b8);
}

.page-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 4px;
  border-radius: 4px;
}

.page-remove-btn:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.15);
}

/* ==========================================================================
   2. Floating Tool Palette (Toolbar)
   ========================================================================== */
.tool-palette {
  position: absolute;
  top: 20px;
  left: 216px;
  display: flex;
  flex-direction: column;
  background: rgba(18, 20, 26, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 6px;
  gap: 4px;
  z-index: 50;
  transition: left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pages-sidebar.collapsed ~ .tool-palette,
.pages-sidebar.collapsed + .tool-palette {
  left: 20px;
}

.tool-btn {
  position: relative;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.tool-btn.active {
  background: var(--accent-primary, #f43f5e);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow, rgba(244, 63, 94, 0.35));
}

.tool-key {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 0.55rem;
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
}

.tool-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 2px;
}

.tool-btn.danger-hover:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ==========================================================================
   3. Center Canvas Viewport
   ========================================================================== */
.canvas-viewport {
  flex: 1;
  position: relative;
  background: #040507;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.canvas-viewport.panning {
  cursor: grab !important;
}

.canvas-viewport.panning:active {
  cursor: grabbing !important;
}

/* Canvas Dropzone Overlay */
.canvas-dropzone {
  position: absolute;
  inset: 20px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: rgba(10, 11, 16, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: none;
  transition: all 0.2s;
}

.canvas-dropzone.drag-active {
  display: flex;
  border-color: var(--accent-primary, #f43f5e);
  background: rgba(244, 63, 94, 0.06);
}

.dropzone-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-align: center;
}

.dropzone-box svg {
  color: var(--accent-primary, #f43f5e);
}

.dropzone-box h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

.dropzone-box p {
  color: var(--text-secondary, #94a3b8);
  font-size: 0.85rem;
}

/* Canvas Outer & Inner */
.canvas-container-outer {
  position: relative;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  background: #fff;
  display: flex;
}

/* Bottom Floating Navigation HUD */
.bottom-page-hud {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(18, 20, 26, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-full, 9999px);
  padding: 6px 14px;
  z-index: 45;
}

.hud-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 20px;
  transition: all 0.16s;
}

.hud-nav-btn:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.hud-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary, #94a3b8);
}

.page-indicator input {
  width: 44px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 0.8rem;
}

.page-indicator strong {
  color: #fff;
}

/* ==========================================================================
   4. Right Panel: Properties Inspector
   ========================================================================== */
.inspector-sidebar {
  width: 280px;
  background: #090a0d;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 40;
}

.inspector-section {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.prop-group label {
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
}

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

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Studio Inputs */
.studio-input, .studio-select, .studio-textarea {
  background: #14161f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.18s;
}

.studio-input:focus, .studio-select:focus, .studio-textarea:focus {
  border-color: var(--accent-primary, #f43f5e);
}

.studio-textarea {
  resize: vertical;
  line-height: 1.4;
}

/* Sliders */
.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-label-row span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-primary, #f43f5e);
}

.studio-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.studio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary, #f43f5e);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow, rgba(244, 63, 94, 0.35));
}

/* Color Picker Boxes */
.color-picker-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #14161f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
}

.color-picker-box span {
  font-size: 0.75rem;
  color: var(--text-secondary, #94a3b8);
}

.color-picker-box input[type="color"] {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

/* Brush Previews */
.brush-size-preview-wrapper {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050608;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-top: 4px;
}

.brush-preview-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.1s ease;
}

.color-palette-presets {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-preset-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-preset-btn:hover {
  transform: scale(1.1);
}

.color-preset-btn.active {
  border-color: var(--accent-primary, #f43f5e);
  box-shadow: 0 0 6px var(--accent-glow, rgba(244, 63, 94, 0.35));
}

.custom-color-wrapper input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

/* Button Group Row (Alignment / Formatting) */
.btn-group-row {
  display: flex;
  align-items: center;
  background: #14161f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.format-btn {
  flex: 1;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
}

.format-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.format-btn.active {
  background: var(--accent-primary, #f43f5e);
  color: #fff;
}

.group-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 2px;
}

.studio-btn.compact-btn {
  padding: 6px 8px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.studio-btn.compact-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Hotkey Reference List */
.hotkey-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hotkey-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8);
}

.hotkey-list kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
}

/* ==========================================================================
   5. Modal & Progress Overlay
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 90%;
  max-width: 440px;
  background: #12141c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.modal-card p {
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
}

.modal-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.modal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary, #f43f5e), #38bdf8);
  transition: width 0.2s ease;
}

.modal-percent-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #181b24;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  display: none;
  z-index: 300;
  animation: toastFade 0.25s ease;
}

.toast.show {
  display: block;
}

@keyframes toastFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbar for sidebars */
.pages-list::-webkit-scrollbar,
.inspector-sidebar::-webkit-scrollbar {
  width: 6px;
}

.pages-list::-webkit-scrollbar-thumb,
.inspector-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.pages-list::-webkit-scrollbar-thumb:hover,
.inspector-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}
