/* ==========================================================================
   DESIGN SYSTEM & VARIABLES - PREMIUM LIGHT THEME
   ========================================================================== */
:root {
  --bg-primary: #f5f6fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8f9fa;
  
  --border-color: #e2e8f0;
  --border-focus: rgba(79, 70, 229, 0.4);
  
  --text-main: #2d3748;
  --text-muted: #718096;
  --text-dark: #a0aec0;

  /* Premium Accents - Indigo & Rose */
  --accent-crimson: #e11d48;
  --accent-crimson-glow: rgba(225, 29, 72, 0.12);
  --accent-gold: #4f46e5;
  --accent-gold-glow: rgba(79, 70, 229, 0.12);
  
  /* Status Colors */
  --status-untranslated: #e11d48;
  --status-translated: #d97706; /* Amber */
  --status-edited: #059669; /* Emerald */
  
  --font-title: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  
  --transition-smooth: all 0.2s ease-in-out;
  --border-radius: 8px;
}

/* ==========================================================================
   GLOBAL STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  z-index: 10;
}

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

.brand-logo {
  font-size: 24px;
  color: var(--accent-gold);
  filter: drop-shadow(0 0 6px var(--accent-gold-glow));
  animation: float 4s ease-in-out infinite;
}

.brand-name {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #1a202c;
}

.brand-name span {
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--accent-gold);
  text-transform: uppercase;
  margin-left: 4px;
  letter-spacing: 0.5px;
}

.file-loader {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-grow: 1;
  max-width: 600px;
  margin: 0 40px;
}

.file-loader input {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

.file-loader input:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 8px var(--accent-gold-glow);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  padding: 10px 18px;
  border-radius: var(--border-radius);
  border: none;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  outline: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none !important;
}

.primary-btn {
  background-color: var(--accent-gold);
  color: #ffffff;
  font-weight: 600;
}

.primary-btn:hover:not(:disabled) {
  background-color: #3b31db;
  box-shadow: 0 4px 12px var(--accent-gold-glow);
}

.secondary-btn {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.secondary-btn:hover:not(:disabled) {
  background-color: var(--bg-primary);
  border-color: var(--text-muted);
}

.action-btn {
  background: linear-gradient(135deg, var(--accent-crimson), #be123c);
  color: #ffffff;
  font-weight: 600;
  width: 100%;
}

.action-btn:hover:not(:disabled) {
  box-shadow: 0 4px 12px var(--accent-crimson-glow);
  transform: translateY(-1px);
}

.success-btn {
  background: linear-gradient(135deg, var(--status-edited), #047857);
  color: #ffffff;
  font-weight: 600;
}

.success-btn:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.icon-btn {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  background-color: #ffffff;
}

.block-btn {
  width: 100%;
}

/* ==========================================================================
   APP CONTAINER LAYOUT
   ========================================================================== */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar Control Panel */
.app-sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.sidebar-card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.sidebar-card h3 {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 12px;
  letter-spacing: 0.8px;
}

/* Progress bar */
.progress-bar-container {
  height: 8px;
  background-color: #edf2f7;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-crimson), var(--accent-gold));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.status-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.status-stats strong {
  color: var(--text-main);
}

/* Form Groups */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group select,
.form-group input[type="number"],
.form-group input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

.form-group select:focus,
.form-group input:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--border-focus);
}

/* Filters Custom Radio/Checkbox */
.filter-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
  transition: var(--transition-smooth);
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-mark {
  position: absolute;
  left: 0;
  height: 16px;
  width: 16px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.checkbox-container:hover input ~ .radio-mark {
  border-color: var(--text-muted);
}

.checkbox-container input:checked ~ .radio-mark {
  background-color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.radio-mark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .radio-mark:after {
  display: block;
}

.checkbox-container .radio-mark:after {
  left: 5px;
  top: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ffffff;
}

.checkbox-container:hover {
  color: var(--text-main);
}

/* ==========================================================================
   WORKSPACE GRID & SUBTITLE ROWS
   ========================================================================== */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-primary);
}

.workspace-header {
  display: grid;
  grid-template-columns: 50px 180px 1fr 1fr 1.2fr;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.workspace-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

/* Subtitle Row style */
.sub-row {
  display: grid;
  grid-template-columns: 50px 180px 1fr 1fr 1.2fr;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 0;
  gap: 16px;
  align-items: start;
  transition: var(--transition-smooth);
  position: relative;
}

.sub-row::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: transparent;
  transition: var(--transition-smooth);
}

.sub-row:hover {
  background-color: rgba(0, 0, 0, 0.01);
}

.sub-row.active {
  background-color: rgba(79, 70, 229, 0.03);
}

.sub-row.active::before {
  background: linear-gradient(180deg, var(--accent-gold), var(--accent-crimson));
  box-shadow: 0 0 6px var(--accent-gold-glow);
}

.sub-row .cell {
  align-self: center;
}

/* Indicators */
.col-id {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-title);
  color: var(--text-muted);
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.untranslated { background-color: var(--status-untranslated); box-shadow: 0 0 4px var(--accent-crimson-glow); }
.status-dot.translated { background-color: var(--status-translated); box-shadow: 0 0 4px rgba(217, 119, 6, 0.3); }
.status-dot.edited { background-color: var(--status-edited); box-shadow: 0 0 4px rgba(5, 150, 105, 0.3); }

.col-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.col-original {
  color: var(--text-main);
  font-size: 15px;
  padding-right: 12px;
}

.col-literal {
  color: var(--text-muted);
  font-size: 14px;
  padding-right: 12px;
}

/* Textarea in cell */
.col-optimized textarea {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--border-radius);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  resize: vertical;
  min-height: 48px;
  transition: var(--transition-smooth);
}

.col-optimized textarea:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--border-focus);
}

/* Empty State / Loading */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  height: 100%;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: float 4s ease-in-out infinite;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.status-msg {
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   MODAL DIALOG
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 650px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--accent-gold);
}

.close-btn {
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

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

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--border-radius);
  padding: 12px;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
}

.modal-body textarea:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
}

.modal-footer {
  padding: 16px 24px;
  background-color: #f8f9fa;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

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

@keyframes translatingGlow {
  0% { background-color: rgba(79, 70, 229, 0.01); }
  50% { background-color: rgba(225, 29, 72, 0.03); }
  100% { background-color: rgba(79, 70, 229, 0.01); }
}

/* Spinner for Loading */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  border-top-color: var(--accent-gold);
  animation: spin 1s ease-in-out infinite;
  display: inline-block;
  margin-right: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Helper Utility Classes */
.hidden {
  display: none !important;
}

.translating-glowing {
  animation: translatingGlow 1.5s infinite ease-in-out;
  border-left: 2px solid var(--accent-gold) !important;
}

.success-text {
  color: var(--status-edited) !important;
  font-weight: 500;
}

.error-text {
  color: var(--status-untranslated) !important;
  font-weight: 600;
}

.info-text {
  color: var(--accent-gold) !important;
  font-weight: 500;
}

/* ==========================================================================
   WORKSPACE TOOLBAR & FILE CONFIGURATION GRID
   ========================================================================== */
.workspace-toolbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Quick Load Row --- */
.toolbar-quick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.browse-file-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 0 18px;
  height: 38px;
  border-radius: var(--border-radius);
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  transition: var(--transition-smooth);
}

.browse-file-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

.toolbar-or-divider {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.toolbar-drag-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.toolbar-drag-hint code {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.toolbar-spacer {
  flex: 1;
}

.advanced-toggle-btn {
  font-size: 12px;
  padding: 0 12px;
  height: 32px;
  border-radius: 8px;
  gap: 6px;
  white-space: nowrap;
}

/* --- Advanced Server-Path Panel (collapsible) --- */
.advanced-panel {
  display: none;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  margin-top: 2px;
  animation: slideDown 0.2s ease;
}

.advanced-panel.open {
  display: grid;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toolbar-grid {
  grid-template-columns: 1.2fr 1fr 1.2fr 1fr auto;
  gap: 16px;
  align-items: flex-end;
}

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

.form-group-inline label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.form-group-inline input,
.form-group-inline select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  outline: none;
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition-smooth);
}

.form-group-inline input:focus,
.form-group-inline select:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--border-focus);
}

.toolbar-grid .btn {
  height: 38px;
  align-self: flex-end;
}

/* --- Drag & Drop Zone (empty state redesign) --- */
.workspace-body.empty-state {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  margin: 16px;
  transition: border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.workspace-body.drag-over {
  border-color: #4f46e5 !important;
  background-color: rgba(79, 70, 229, 0.04) !important;
  box-shadow: inset 0 0 0 3px rgba(79, 70, 229, 0.12) !important;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.drop-zone-icon {
  font-size: 52px;
  margin-bottom: 8px;
  animation: float 4s ease-in-out infinite;
}

.drop-zone-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.drop-zone-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.drop-zone-badge {
  margin-top: 10px;
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* --- Download Button --- */
.download-btn {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 0 18px;
  height: 36px;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.25);
  transition: var(--transition-smooth);
  gap: 6px;
}

.download-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.35);
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   TABBED SETTINGS MODAL LAYOUT (1.5X LARGER & PREMIUM SCALING)
   ========================================================================== */
.modal-content-tabbed {
  display: flex;
  height: 720px; /* 1.5x taller + premium spacing */
  background-color: var(--bg-secondary);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.12), 0 0 40px rgba(79, 70, 229, 0.04);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 95%;
  max-width: 1200px; /* 1.5x wider */
}

.modal-sidebar {
  width: 300px;
  background-color: #f8fafc;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 32px 0 24px 0;
}

.modal-sidebar-header {
  padding: 0 24px 20px 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.modal-sidebar-header h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.modal-tab-btn {
  background: none;
  border: none;
  padding: 16px 24px;
  margin: 4px 16px;
  text-align: left;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-smooth);
  border-left: 4px solid transparent;
}

.modal-tab-btn:hover {
  background-color: rgba(79, 70, 229, 0.05);
  color: var(--accent-gold);
}

.modal-tab-btn.active {
  background-color: #ffffff;
  color: var(--accent-gold);
  border-left-color: var(--accent-gold);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.06), 0 1px 3px rgba(79, 70, 229, 0.02);
  border-radius: 8px 10px 10px 8px;
}

.modal-body-tabbed {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 40px 48px;
  overflow: hidden;
  background-color: #ffffff;
  position: relative;
}

.modal-close-container {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 10;
}

.close-btn {
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close-btn:hover {
  background-color: #f1f5f9;
  color: var(--accent-crimson);
}

.tab-content-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
  overflow-y: auto;
}

/* Form Styling within tabbed body */
.tab-panel .panel-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.tab-panel .panel-desc {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-body-tabbed label {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}

.modal-body-tabbed input[type="text"],
.modal-body-tabbed input[type="password"],
.modal-body-tabbed input[type="number"] {
  width: 100%;
  max-width: 700px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background-color: #f8fafc;
  color: #1e293b;
  font-size: 15px;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.modal-body-tabbed input:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.modal-body-tabbed .form-group {
  margin-bottom: 24px;
}

.modal-body-tabbed .textarea-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  overflow: hidden;
  min-height: 0;
}

.modal-body-tabbed textarea {
  width: 100%;
  min-height: 300px;
  background-color: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #1e293b;
  border-radius: 12px;
  padding: 18px;
  font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  flex: 1;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  overflow-y: auto;
}

.modal-body-tabbed textarea:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.modal-footer-actions {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.save-settings-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  transition: all 0.2s ease-in-out;
  outline: none;
}

.save-settings-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.save-settings-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

/* ==========================================================================
   PROMPT TEMPLATE MANAGER
   ========================================================================== */
.template-manager {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.template-manager-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.template-select-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-select-group label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background-color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.template-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

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

.template-name-row label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  margin: 0;
}

.template-name-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #1e293b;
  outline: none;
  transition: all 0.2s ease;
}

.template-name-row input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.template-delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.06) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #ef4444 !important;
}

/* ==========================================================================
   TRANSLATION HISTORY SIDEBAR CARD
   ========================================================================== */
.history-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item:hover {
  background-color: rgba(79, 70, 229, 0.04);
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.05);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 18px; /* Leave space for delete button */
}

.history-item-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.history-item:hover .history-item-delete {
  opacity: 1;
}

.history-item-delete:hover {
  background-color: rgba(225, 29, 72, 0.1);
  color: var(--accent-crimson) !important;
}

.history-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.history-item-progress-stats {
  font-weight: 500;
  color: var(--text-main);
}

.history-progress-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-progress-bar-bg {
  height: 4px;
  background-color: #edf2f7;
  border-radius: 2px;
  overflow: hidden;
}

.history-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--status-translated), var(--status-edited));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.history-empty {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 16px 0;
}

/* ==========================================================================
   BATCH GROUP ACCORDIONS
   ========================================================================== */
.batch-group {
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--bg-secondary);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: var(--transition-smooth);
}

.batch-header {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  background-color: #f8fafc;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid transparent;
  transition: var(--transition-smooth);
}

.batch-header:hover {
  background-color: #f1f5f9;
}

.batch-group.expanded .batch-header {
  border-bottom-color: var(--border-color);
  background-color: #f1f5f9;
}

.batch-toggle-icon {
  margin-right: 8px;
  transition: transform 0.2s ease;
  font-size: 10px;
  color: var(--text-muted);
}

.batch-group.collapsed .batch-toggle-icon {
  transform: rotate(-90deg);
}

.batch-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.batch-content {
  padding: 0 18px;
  transition: max-height 0.3s ease-out;
}

.batch-group.collapsed .batch-content {
  display: none;
}

/* ==========================================================================
   AI SELF-CHECK CHAT ASSISTANT PANEL & BUBBLE
   ========================================================================== */

/* The Chat Sidebar occupying 4/10 width */
.ai-chat-panel {
  width: 40%;
  max-width: 550px;
  min-width: 320px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.2s ease;
  z-index: 99;
  position: relative;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
}

.ai-chat-panel.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  border-right: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

/* Chat Header */
.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
}

.chat-title-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-icon {
  font-size: 24px;
}

.chat-header-text h3 {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.2;
}

.chat-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  display: inline-block;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.chat-minimize-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.chat-minimize-btn:hover {
  background-color: #f1f5f9;
  color: var(--accent-crimson);
}

.chat-new-btn {
  background: none;
  border: 1px solid var(--border-color);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-gold);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  margin-right: 4px;
}

.chat-new-btn:hover {
  background-color: var(--accent-gold-glow);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: rotate(90deg);
}

/* Quick Action Buttons */
.chat-quick-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.quick-action-btn {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.quick-action-btn:hover {
  border-color: var(--accent-gold);
  background-color: var(--accent-gold-glow);
  color: var(--accent-gold);
}

/* Chat Message List */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: #f8fafc;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeIn 0.25s ease-out;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg.model, .chat-msg.system {
  align-self: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.chat-msg.user .msg-avatar {
  background: linear-gradient(135deg, var(--accent-gold), #3b31db);
  color: #ffffff;
  border: none;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  word-break: break-word;
}

.chat-msg.user .msg-bubble {
  background-color: var(--accent-gold);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.chat-msg.model .msg-bubble {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
}

.chat-msg.system .msg-bubble {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  border-top-left-radius: 4px;
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px;
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-input-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.permission-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.permission-select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  font-size: 11.5px;
  outline: none;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.permission-select:focus {
  border-color: var(--accent-gold);
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  resize: none;
  max-height: 120px;
  background-color: var(--bg-input);
  transition: var(--transition-smooth);
}

.chat-input-row textarea:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 2px var(--border-focus);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-gold);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background-color: #3b31db;
  transform: scale(1.05);
}

/* Review Mode Recommendation Card Styles */
.review-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  font-size: 12px;
  width: 100%;
}

.review-card-title {
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
  font-size: 13px;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.review-table th, .review-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.review-table th {
  font-weight: 600;
  color: var(--text-muted);
}

.review-row-id {
  font-weight: 700;
  color: var(--text-muted);
}

.review-text-old {
  color: #94a3b8;
  text-decoration: line-through;
}

.review-text-new {
  color: var(--status-edited);
  font-weight: 500;
}

.review-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.review-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
}

.review-btn.approve {
  background-color: var(--status-edited);
  color: #ffffff;
}

.review-btn.approve:hover {
  background-color: #047857;
}

.review-btn.reject {
  background-color: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.review-btn.reject:hover {
  background-color: #e2e8f0;
}

/* Floating Chat Assistant Bubble */
.ai-chat-bubble {
  position: fixed;
  bottom: 10px;
  left: 10px; /* Put at the very bottom left corner */
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), #3b31db);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  z-index: 999999;
  transition: var(--transition-smooth);
}

.ai-chat-bubble.hidden {
  display: none !important;
}

.ai-chat-bubble:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5), 0 0 0 3px rgba(255, 255, 255, 1);
}

.bubble-notification-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background-color: var(--status-untranslated);
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 6px rgba(225, 29, 72, 0.6);
  display: none; /* Can be turned on dynamically */
}

/* Text Streaming Cursor Animation */
.typing-indicator {
  display: inline-block;
  width: 4px;
  height: 14px;
  background-color: var(--accent-gold);
  margin-left: 4px;
  animation: blink 0.8s infinite;
  vertical-align: middle;
}

@keyframes blink {
  50% { opacity: 0; }
}

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

/* ==========================================================================
   GLOBAL SUMMARY CARD - PREMIUM COLLAPSIBLE INTERFACE
   ========================================================================== */
.global-summary-card {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.01);
  overflow: hidden;
}

.global-summary-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.02);
}

.global-summary-card.expanded {
  max-height: 600px;
}

.global-summary-card.collapsed {
  max-height: 38px;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* Compact Recreate/Refresh Title Button styling */
.compact-refresh-btn {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--accent-gold);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition-smooth);
  height: 24px;
}
.compact-refresh-btn:hover:not(:disabled) {
  background-color: var(--accent-gold-glow);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}
.compact-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.refresh-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}
.spinning-animation {
  animation: spin-refresh 1s linear infinite;
}
@keyframes spin-refresh {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.summary-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  height: 30px;
}

.summary-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-card-icon {
  font-size: 16px;
  background: var(--accent-gold-glow);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-card-header-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-card-header-text h3 {
  font-family: var(--font-title);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

/* Status Badge */
.summary-status-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-status-badge.empty {
  background-color: #f1f5f9;
  color: var(--text-muted);
}

.summary-status-badge.analyzing {
  background-color: var(--accent-gold-glow);
  color: var(--accent-gold);
  animation: pulse 1.5s infinite ease-in-out;
}

.summary-status-badge.ready {
  background-color: rgba(5, 150, 105, 0.1);
  color: var(--status-edited);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Actions */
.summary-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-btn {
  padding: 4px 8px;
  font-size: 11px;
  height: 26px;
}

.summary-card-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.summary-card-toggle-btn:hover {
  background-color: var(--bg-primary);
  color: var(--text-main);
}

.global-summary-card.expanded .toggle-icon {
  transform: rotate(180deg);
}

.toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 10px;
}

/* Card Body */
.summary-card-body {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.2s ease;
}

.global-summary-card.collapsed .summary-card-body {
  opacity: 0;
  pointer-events: none;
}

.global-summary-card.expanded .summary-card-body {
  opacity: 1;
}

.summary-card-body textarea {
  width: 100%;
  height: 180px;
  resize: vertical;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  transition: var(--transition-smooth);
}

.summary-card-body textarea:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--border-focus);
}

.summary-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.summary-hint {
  color: var(--text-muted);
  font-style: italic;
}

.summary-save-indicator {
  color: var(--status-edited);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.summary-save-indicator.visible {
  opacity: 1;
}

/* Glow animation when loading */
.global-summary-card.analyzing-glow {
  border-bottom: 1px solid var(--accent-gold);
  box-shadow: 0 0 15px var(--accent-gold-glow);
}

/* YouTube Metadata Card Styling */
#youtubeMetadataCard.expanded {
  max-height: 1200px;
}

.youtube-metadata-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 12px;
}

.youtube-metadata-grid textarea {
  width: 100%;
  min-height: 90px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--border-radius);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition: var(--transition-smooth);
}

.youtube-metadata-grid textarea:focus {
  border-color: var(--accent-gold);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px var(--border-focus);
}

.youtube-metadata-grid textarea#youtubeDescriptionInput {
  min-height: 280px;
}

/* ==========================================================================
   SPEECH RATE INDICATOR & WARNING STYLES
   ========================================================================== */
.speech-rate-info {
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: var(--transition-smooth);
}

.speech-rate-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.speech-rate-info .rate-stats {
  font-family: monospace;
  font-weight: 500;
}

.speech-rate-info .rate-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.speech-rate-info.safe {
  color: var(--text-muted);
}
.speech-rate-info.safe .rate-badge {
  background-color: rgba(5, 150, 105, 0.08);
  color: var(--status-edited);
}

.speech-rate-info.warning {
  color: var(--status-untranslated);
}
.speech-rate-info.warning .rate-badge {
  background-color: rgba(225, 29, 72, 0.08);
  color: var(--status-untranslated);
  animation: glow-pulse-border 2s infinite ease-in-out;
}

.speech-rate-warning-msg {
  font-size: 11px;
  font-weight: 500;
  color: var(--status-untranslated);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}

@keyframes glow-pulse-border {
  0% { box-shadow: 0 0 2px rgba(225, 29, 72, 0.2); }
  50% { box-shadow: 0 0 6px rgba(225, 29, 72, 0.4); }
  100% { box-shadow: 0 0 2px rgba(225, 29, 72, 0.2); }
}

.col-optimized textarea.rate-warning {
  border-color: var(--status-untranslated) !important;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15) !important;
  background-color: rgba(225, 29, 72, 0.01) !important;
}

/* Sidebar Custom Rate Config Display */
.custom-cps-container {
  margin-top: 8px;
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}
.custom-cps-container.show {
  display: block;
}

/* Translation error highlights */
.sub-row.translation-error-row {
  border-left: 4px solid #f43f5e !important;
  background-color: rgba(244, 63, 94, 0.02) !important;
}
.sub-row.translation-error-row.active {
  background-color: rgba(244, 63, 94, 0.05) !important;
}

/* ==========================================================================
   SAAS REDESIGN & BILLING STYLES (PAY-AS-YOU-GO) - LIGHT THEME
   ========================================================================== */

:root {
  --saas-bg-main: #f5f6fa;
  --saas-bg-card: #ffffff;
  --saas-border: #e2e8f0;
  --saas-text-dim: #718096;
  --font-title: 'Outfit', 'Inter', sans-serif;
  --card-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --gold-glow: 0 0 15px rgba(79, 70, 229, 0.1);
}

.saas-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--saas-bg-main);
  color: var(--text-main);
}

/* Sidebar Navigation */
.saas-sidebar {
  width: 160px;
  background: #ffffff;
  border-right: 1px solid var(--saas-border);
  display: flex;
  flex-direction: column;
  padding: 24px 6px;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.02);
}

.saas-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  margin-bottom: 12px;
}

.saas-logo {
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.2));
}

.saas-title {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin: 0;
}

.saas-title span {
  color: #4f46e5;
}

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

.saas-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--saas-text-dim);
  font-weight: 500;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.saas-nav .nav-item:hover {
  background: rgba(79, 70, 229, 0.05);
  color: #4f46e5;
  transform: translateX(4px);
}

.saas-nav .nav-item.active {
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
  font-weight: 600;
  border-left: 3px solid #4f46e5;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  box-shadow: inset 4px 0 8px rgba(79, 70, 229, 0.02);
}

.saas-nav .nav-icon {
  font-size: 16px;
}

.saas-user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--saas-border);
  border-radius: 12px;
  margin-top: auto;
}

.saas-user-profile .user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.saas-user-profile .user-info {
  display: flex;
  flex-direction: column;
}

.saas-user-profile .user-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 13px;
}

.saas-user-profile .user-tier {
  font-size: 11px;
  color: #fb823c;
  font-weight: 600;
}

/* Main Content Area */
.saas-main-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: var(--saas-bg-main);
}

.saas-main-container .app-header {
  border-bottom: 1px solid var(--saas-border);
  padding: 16px 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  z-index: 10;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.header-title-container h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.credit-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: #4f46e5;
  font-weight: 600;
  transition: all 0.3s ease;
}

.credit-badge:hover {
  background: rgba(79, 70, 229, 0.12);
  box-shadow: 0 0 12px rgba(79, 70, 229, 0.2);
}

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

/* Views Visibility */
.saas-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow-y: auto;
}

.saas-view.active {
  display: flex;
  flex-direction: column;
}

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

/* Editor Specific Layout inside view */
#view-editor {
  overflow: hidden;
}

#view-editor .app-container {
  display: flex;
  flex-direction: row;
  height: 100%;
  background-color: var(--bg-primary);
}

/* Dashboard Panel Container */
.dashboard-container {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.dashboard-welcome {
  background: linear-gradient(105deg, rgba(79, 70, 229, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid var(--saas-border);
  padding: 28px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
}

.dashboard-welcome::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.welcome-text h2 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
}

.welcome-text p {
  color: var(--saas-text-dim);
  margin: 0;
  font-size: 14px;
}

.premium-badge {
  background: linear-gradient(90deg, #f59e0b 0%, #fb923c 100%);
  color: #ffffff;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--saas-bg-card);
  border: 1px solid var(--saas-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.01);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.03);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: rgba(79, 70, 229, 0.05);
}

.stat-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.stat-info h3 {
  font-size: 13px;
  color: var(--saas-text-dim);
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-number {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.stat-sub {
  font-size: 12px;
  color: #4f46e5;
  margin-top: 4px;
  font-weight: 500;
}

.compact-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  height: 26px;
}

.dashboard-row-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .dashboard-row-layout {
    grid-template-columns: 1fr;
  }
}

.dashboard-panel-card {
  background: var(--saas-bg-card);
  border: 1px solid var(--saas-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.01);
}

.dashboard-panel-card h3 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--saas-border);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.dash-history-item:hover {
  background: rgba(79, 70, 229, 0.03);
  border-color: rgba(79, 70, 229, 0.2);
}

.dash-history-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-history-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 13px;
}

.dash-history-path {
  font-size: 11px;
  color: var(--saas-text-dim);
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-history-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
}

.dash-history-item .btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  height: auto;
}

.history-empty {
  text-align: center;
  padding: 40px;
  color: var(--saas-text-dim);
  font-size: 13px;
  border: 1px dashed var(--saas-border);
  border-radius: 10px;
}

.dashboard-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--saas-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.shortcut-item:hover {
  background: rgba(79, 70, 229, 0.03);
  border-color: rgba(79, 70, 229, 0.2);
  transform: translateY(-2px);
}

.shortcut-icon {
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcut-item:hover .shortcut-icon {
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
}

.shortcut-text h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.shortcut-text p {
  font-size: 11px;
  color: var(--saas-text-dim);
  margin: 0;
}

/* Billing Tab Styles */
.billing-container {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.billing-top-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
}

@media (max-width: 850px) {
  .billing-top-row {
    grid-template-columns: 1fr;
  }
}

.billing-card-wrapper {
  perspective: 1000px;
}

.glass-credit-card {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 15px 30px rgba(79, 70, 229, 0.15);
}

.glass-credit-card::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

.card-chip {
  width: 38px;
  height: 28px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
}

.card-brand {
  position: absolute;
  top: 24px;
  right: 24px;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #ffffff;
}

.card-balance-section {
  margin-top: 12px;
}

.balance-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.balance-amount {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  margin: 4px 0 0 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-number {
  font-family: monospace;
  font-size: 14px;
  letter-spacing: 2px;
  color: #fff;
  opacity: 0.9;
}

.card-holder {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.8);
}

.billing-topup-panel {
  background: var(--saas-bg-card);
  border: 1px solid var(--saas-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.billing-topup-panel h3 {
  font-family: var(--font-title);
  font-size: 16px;
  margin: 0 0 8px 0;
  color: var(--text-main);
}

.panel-desc {
  font-size: 12px;
  color: var(--saas-text-dim);
  margin: 0 0 20px 0;
  line-height: 1.4;
}

.top-up-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 500px) {
  .top-up-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.topup-pack-btn {
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--saas-border);
  border-radius: 12px;
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topup-pack-btn:hover {
  background: rgba(79, 70, 229, 0.05);
  border-color: rgba(79, 70, 229, 0.2);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.02);
}

.pack-price {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.topup-pack-btn:hover .pack-price {
  color: #4f46e5;
}

.pack-chars {
  font-size: 10px;
  color: var(--saas-text-dim);
  text-align: center;
  font-weight: 500;
}

/* SVG Chart */
.usage-chart-card {
  padding-bottom: 12px;
}

.chart-wrapper {
  margin-top: 15px;
  background: rgba(0,0,0,0.01);
  border-radius: 10px;
  border: 1px solid var(--saas-border);
  padding: 10px;
}

#usage-chart .bar {
  fill: url(#barGradient);
  rx: 3;
  transition: height 0.3s ease, y 0.3s ease;
}

#usage-chart .bar:hover {
  fill: #06b6d4;
  filter: drop-shadow(0 2px 4px rgba(6, 182, 212, 0.3));
  cursor: pointer;
}

#usage-chart .grid-line {
  stroke: rgba(0, 0, 0, 0.05);
  stroke-width: 1;
}

#usage-chart .axis-text {
  fill: var(--saas-text-dim);
  font-size: 10px;
  font-family: sans-serif;
}

#usage-chart .tooltip-text {
  fill: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
}

/* SaaS Tables */
.transaction-table-wrapper {
  overflow-x: auto;
  margin-top: 10px;
}

.saas-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.saas-table th {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--saas-border);
  color: var(--saas-text-dim);
  font-weight: 600;
}

.saas-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--saas-border);
  color: var(--text-main);
}

.saas-table tr:hover {
  background: rgba(79, 70, 229, 0.02);
}

.saas-table tr:last-child td {
  border-bottom: none;
}

.badge-status {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-status.success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-status.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.table-btn {
  background: transparent;
  border: 1px solid var(--saas-border);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--saas-text-dim);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

.table-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-main);
  border-color: rgba(0, 0, 0, 0.15);
}

/* Full history screen layout */
.history-view-container {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.full-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.full-history-card {
  background: var(--saas-bg-card);
  border: 1px solid var(--saas-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 160px;
  transition: all 0.2s ease;
}

.full-history-card:hover {
  border-color: rgba(79, 70, 229, 0.3);
  background: rgba(79, 70, 229, 0.02);
  transform: translateY(-2px);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.history-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.4;
  word-break: break-all;
}

.history-card-date {
  font-size: 11px;
  color: var(--saas-text-dim);
  margin-top: 4px;
}

.history-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--saas-text-dim);
  margin-top: auto;
  padding-top: 15px;
  border-top: 1px solid var(--saas-border);
}

.history-card-stats span strong {
  color: var(--text-main);
}

.history-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.history-card-actions .btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  height: auto;
}

/* Block buttons */
.block-btn {
  width: 100%;
}

/* Responsive adjustment for main layout */
@media (max-width: 768px) {
  .saas-sidebar {
    width: 68px;
    padding: 20px 8px;
  }
  .saas-sidebar .saas-title,
  .saas-sidebar .saas-user-profile .user-info {
    display: none;
  }
  .saas-sidebar .saas-brand {
    justify-content: center;
    margin-bottom: 24px;
  }
  .saas-nav .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .saas-nav .nav-item span:not(.nav-icon) {
    display: none;
  }
  .saas-sidebar .saas-user-profile {
    justify-content: center;
    padding: 8px;
  }
}

/* Settings View Styling (Embedded SaaS Version) */
#view-settings {
  display: none;
  width: 100%;
  height: 100%;
  flex: 1;
}

#view-settings.active {
  display: flex;
}

.settings-view-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
  background-color: var(--saas-bg-main);
}

.settings-view-wrapper .modal-content-tabbed {
  display: flex;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
  animation: none;
  background-color: var(--saas-bg-main);
}

.settings-view-wrapper .modal-sidebar {
  width: 280px;
  background-color: var(--saas-bg-card);
  border-right: 1px solid var(--saas-border);
  padding: 24px 0;
  flex-shrink: 0;
}

.settings-view-wrapper .modal-body-tabbed {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--saas-bg-main);
  padding: 24px 32px;
  overflow-y: auto;
  height: 100%;
}

.settings-view-wrapper .tab-content-container {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 24px;
}

.settings-view-wrapper .tab-panel {
  display: none;
}

.settings-view-wrapper .tab-panel.active {
  display: block;
}

.settings-view-wrapper .modal-tab-btn {
  background: none;
  border: none;
  padding: 14px 24px;
  margin: 2px 16px;
  text-align: left;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--saas-text-muted);
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-smooth);
}

.settings-view-wrapper .modal-tab-btn:hover {
  background-color: rgba(79, 70, 229, 0.04);
  color: var(--saas-primary);
}

.settings-view-wrapper .modal-tab-btn.active {
  background-color: rgba(79, 70, 229, 0.08);
  color: var(--saas-primary);
  font-weight: 600;
}

/* Light Theme Styling for Forms and inputs in Settings */
.settings-view-wrapper .form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-view-wrapper .form-group label {
  font-weight: 600;
  font-size: 13px;
  color: var(--saas-text-main);
}

.settings-view-wrapper .form-group input[type="text"],
.settings-view-wrapper .form-group input[type="password"],
.settings-view-wrapper .form-group input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--saas-border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  background-color: var(--saas-bg-card);
  color: var(--saas-text-main);
  transition: var(--transition-smooth);
}

.settings-view-wrapper .form-group input:focus {
  outline: none;
  border-color: var(--saas-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.settings-view-wrapper .textarea-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.settings-view-wrapper textarea {
  width: 100%;
  height: 350px;
  padding: 16px;
  border: 1px solid var(--saas-border);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background-color: var(--saas-bg-card);
  color: var(--saas-text-main);
  resize: vertical;
  transition: var(--transition-smooth);
}

.settings-view-wrapper textarea:focus {
  outline: none;
  border-color: var(--saas-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.settings-view-wrapper .panel-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: var(--saas-text-main);
  margin-bottom: 6px;
}

.settings-view-wrapper .panel-desc {
  font-size: 13px;
  color: var(--saas-text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.settings-view-wrapper .modal-footer-actions {
  padding-top: 16px;
  border-top: 1px solid var(--saas-border);
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.settings-view-wrapper .save-settings-btn {
  background-color: var(--saas-primary);
  color: #ffffff;
  font-weight: 600;
  padding: 12px 32px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.settings-view-wrapper .save-settings-btn:hover {
  background-color: #4338ca;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Premium Table for History view */
.premium-history-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--saas-border);
  background-color: var(--saas-bg-card);
}

.premium-history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-family: var(--font-body);
}

.premium-history-table th {
  padding: 16px 20px;
  background-color: var(--saas-bg-main);
  border-bottom: 1px solid var(--saas-border);
  font-weight: 600;
  font-size: 13px;
  color: var(--saas-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.premium-history-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--saas-border);
  vertical-align: middle;
}

.premium-history-table tbody tr:last-child td {
  border-bottom: none;
}

.premium-history-table tbody tr {
  transition: var(--transition-smooth);
}

.premium-history-table tbody tr:hover {
  background-color: rgba(79, 70, 229, 0.01);
}

/* Column styles */
.col-filename {
  min-width: 300px;
}

.col-progress {
  min-width: 250px;
}

.col-time {
  width: 150px;
}

.col-actions {
  width: 200px;
}

/* Cell contents */
.filename-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filename-cell .file-icon {
  font-size: 24px;
  color: var(--saas-primary);
}

.filename-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.filename-text {
  font-weight: 600;
  font-size: 14px;
  color: var(--saas-text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.filepath-text {
  font-size: 11px;
  color: var(--saas-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.progress-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.status-translating {
  background-color: rgba(245, 158, 11, 0.08);
  color: #d97706;
}

.status-completed {
  background-color: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.status-new {
  background-color: rgba(79, 70, 229, 0.08);
  color: var(--saas-primary);
}

.progress-percent-text {
  font-weight: 700;
  font-size: 13px;
  color: var(--saas-text-main);
}

.progress-bar-outer {
  width: 100%;
  height: 6px;
  background-color: var(--saas-bg-main);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--saas-primary), var(--saas-accent));
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-inner.bar-completed {
  background: linear-gradient(90deg, #10b981, #059669);
}

.progress-count-text {
  font-size: 11px;
  color: var(--saas-text-muted);
}

.time-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.time-relative {
  font-weight: 500;
  font-size: 13px;
  color: var(--saas-text-main);
}

.time-absolute {
  font-size: 11px;
  color: var(--saas-text-muted);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.danger-btn-text {
  background-color: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  transition: var(--transition-smooth);
}

.danger-btn-text:hover {
  background-color: rgba(239, 68, 68, 0.05);
  border-color: #ef4444;
  color: #ef4444;
}

/* Hover effects for recent dashboard cards */
.dash-history-card-item:hover {
  border-color: rgba(79, 70, 229, 0.3) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  background-color: #ffffff !important;
}

/* ==========================================================================
   WORKSPACE SELECTOR & MODAL STYLES
   ========================================================================== */
.workspace-selector-container {
  margin: 0 2px 16px 2px;
  position: relative;
  font-family: var(--font-body);
}

.workspace-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.workspace-select-trigger:hover {
  border-color: var(--accent-gold);
  background-color: var(--accent-gold-glow);
}

.ws-icon {
  font-size: 14px;
  color: var(--accent-gold);
}

.ws-active-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-chevron {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.workspace-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  padding: 6px 0;
  animation: fadeIn 0.15s ease-out;
}

.workspace-dropdown-menu.show {
  display: block;
}

.workspace-list {
  max-height: 220px;
  overflow-y: auto;
}

.workspace-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.workspace-item:hover {
  background-color: #f8fafc;
}

.workspace-item.active {
  background-color: var(--accent-gold-glow);
}

.workspace-item.active .ws-item-name {
  color: var(--accent-gold);
  font-weight: 600;
}

.ws-item-name {
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-item-check {
  font-size: 12px;
  color: var(--accent-gold);
  display: none;
}

.workspace-item.active .ws-item-check {
  display: block;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 6px 0;
}

.create-workspace-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% - 16px);
  margin: 4px 8px;
  padding: 8px 12px;
  background-color: var(--bg-primary);
  border: 1px dashed var(--accent-gold);
  border-radius: 8px;
  color: var(--accent-gold);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.create-workspace-btn:hover {
  background-color: var(--accent-gold-glow);
  color: var(--accent-gold);
}

/* ==========================================================================
   FILE MANAGER — Desktop File Explorer Style
   ========================================================================== */
.fm-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #f0f2f5;
  user-select: none;
}

/* --- Toolbar (Address bar + actions) --- */
.fm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  border-bottom: 1px solid #d1d5db;
  flex-shrink: 0;
  gap: 8px;
}

.fm-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.fm-nav-buttons {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.fm-nav-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.fm-nav-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

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

/* Breadcrumb / Address bar */
.fm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.fm-breadcrumb::-webkit-scrollbar { height: 0; }

.fm-bc-item {
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  color: #4f46e5;
  font-weight: 500;
  transition: background 0.12s ease;
  flex-shrink: 0;
}

.fm-bc-item:hover {
  background: rgba(79, 70, 229, 0.08);
}

.fm-bc-item.fm-bc-active {
  color: #1f2937;
  font-weight: 600;
  cursor: default;
}

.fm-bc-item.fm-bc-active:hover {
  background: transparent;
}

.fm-bc-sep {
  color: #9ca3af;
  font-size: 10px;
  flex-shrink: 0;
  padding: 0 1px;
}

/* Right toolbar */
.fm-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.fm-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.fm-search-icon {
  position: absolute;
  left: 8px;
  font-size: 12px;
  color: #9ca3af;
  pointer-events: none;
}

.fm-search-box input {
  width: 180px;
  height: 30px;
  padding: 0 10px 0 28px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-body);
  background: #ffffff;
  color: #1f2937;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fm-search-box input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
  width: 240px;
}

.fm-view-toggle {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}

.fm-view-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.fm-view-btn + .fm-view-btn {
  border-left: 1px solid #d1d5db;
}

.fm-view-btn:hover {
  background: #f3f4f6;
}

.fm-view-btn.active {
  background: #4f46e5;
  color: #ffffff;
}

.fm-toolbar-divider {
  width: 1px;
  height: 20px;
  background: #d1d5db;
  flex-shrink: 0;
}

.fm-tool-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.fm-tool-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.fm-upload-btn {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
}

.fm-upload-btn:hover {
  background: #4338ca;
  border-color: #4338ca;
}

/* --- Status Bar --- */
.fm-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px;
  background: #e5e7eb;
  border-top: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  font-size: 11.5px;
  color: #6b7280;
  flex-shrink: 0;
}

/* --- Content Area --- */
.fm-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  background: #ffffff;
  margin: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  position: relative;
}

/* Drop overlay */
.fm-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(79, 70, 229, 0.06);
  border: 2px dashed #4f46e5;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
}

.fm-drop-overlay-icon { font-size: 48px; margin-bottom: 8px; }
.fm-drop-overlay-text { font-size: 15px; font-weight: 600; color: #4f46e5; }

/* Empty state */
.fm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #9ca3af;
}

.fm-empty-icon {
  font-size: 56px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.fm-empty p {
  font-size: 13px;
}

/* ==========================================================================
   LIST VIEW (Details)
   ========================================================================== */
.fm-list-header {
  display: grid;
  grid-template-columns: minmax(200px, 3fr) 100px 160px 120px;
  padding: 0 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 2;
}

.fm-list-header .fm-col {
  padding: 8px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fm-list-header .fm-col:hover {
  color: #374151;
}

.fm-list-row {
  display: grid;
  grid-template-columns: minmax(200px, 3fr) 100px 160px 120px;
  padding: 0 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s ease;
  cursor: default;
  align-items: center;
}

.fm-list-row:hover {
  background: #f0f4ff;
}

.fm-list-row.fm-selected {
  background: #dbeafe;
}

.fm-list-row.fm-drag-over {
  background: rgba(79, 70, 229, 0.1);
  outline: 2px dashed #4f46e5;
  outline-offset: -2px;
}

/* Name cell */
.fm-cell-name {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  min-width: 0;
}

.fm-file-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border-radius: 4px;
}

.fm-file-icon.fm-icon-folder { background: transparent; }
.fm-file-icon.fm-icon-srt { background: transparent; }
.fm-file-icon.fm-icon-text { background: transparent; }
.fm-file-icon.fm-icon-json { background: transparent; }
.fm-file-icon.fm-icon-md { background: transparent; }
.fm-file-icon.fm-icon-image { background: transparent; }
.fm-file-icon.fm-icon-other { background: transparent; }

.fm-file-name {
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.1s ease;
}

.fm-file-name:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.fm-file-name.fm-name-folder {
  font-weight: 600;
}

/* Other cells */
.fm-cell-size, .fm-cell-date {
  padding: 8px;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.fm-cell-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.fm-list-row:hover .fm-cell-actions {
  opacity: 1;
}

.fm-act-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.fm-act-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.fm-act-btn.fm-act-delete:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ==========================================================================
   GRID VIEW (Icons)
   ========================================================================== */
.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 4px;
  padding: 12px;
}

.fm-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px 8px;
  border-radius: 8px;
  cursor: default;
  transition: background 0.1s ease;
  position: relative;
  text-align: center;
}

.fm-grid-item:hover {
  background: #f0f4ff;
}

.fm-grid-item.fm-selected {
  background: #dbeafe;
}

.fm-grid-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  margin-bottom: 6px;
  border-radius: 6px;
  overflow: hidden;
}

.fm-grid-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.fm-grid-name {
  font-size: 11.5px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
  padding: 0 4px;
}

.fm-grid-name:hover {
  color: #4f46e5;
}

.fm-grid-name.fm-name-folder {
  font-weight: 600;
}

/* Grid context menu on hover */
.fm-grid-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.fm-grid-item:hover .fm-grid-actions {
  opacity: 1;
}

/* ==========================================================================
   FILE PREVIEW MODAL (Enhanced)
   ========================================================================== */
.fm-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.fm-preview-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.fm-preview-box {
  background: #ffffff;
  border-radius: 14px;
  width: 92%;
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.35);
  animation: slideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.fm-preview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.fm-preview-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fm-preview-topbar-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.fm-preview-topbar-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fm-preview-topbar-meta {
  font-size: 11px;
  color: #9ca3af;
  flex-shrink: 0;
}

.fm-preview-topbar-right {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fm-preview-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}

.fm-preview-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

.fm-preview-body {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* Text preview */
.fm-preview-text {
  padding: 20px 24px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* SRT highlighting */
.fm-srt-id { color: #4f46e5; font-weight: 700; }
.fm-srt-time { color: #9ca3af; font-size: 11px; }
.fm-srt-text { color: #1f2937; }

/* Image preview */
.fm-preview-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f9fafb;
  min-height: 200px;
}

.fm-preview-image img {
  max-width: 100%;
  max-height: 65vh;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  object-fit: contain;
}

/* ==========================================================================
   WORKSPACE FILE PICKER (in Subtitle Editor toolbar)
   ========================================================================== */
.ws-file-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-srt-select {
  min-width: 200px;
  max-width: 300px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.ws-srt-select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--border-focus);
}
