@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #090a0f;
  --bg-gradient: radial-gradient(circle at 50% -20%, #1e1b4b 0%, #090a0f 70%);
  --panel: rgba(17, 18, 28, 0.75);
  --panel-hover: rgba(22, 24, 38, 0.85);
  --panel-active: rgba(27, 29, 47, 0.95);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.15);
  --accent: #6366f1; /* Indigo */
  --accent-rgb: 99, 102, 241;
  --accent-secondary: #a855f7; /* Purple */
  --accent-secondary-rgb: 168, 85, 247;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #4b5563;
  --success: #10b981;
  --success-rgb: 16, 185, 129;
  --warning: #f59e0b;
  --warning-rgb: 245, 158, 11;
  --error: #ef4444;
  --error-rgb: 239, 68, 68;
  
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'Space Mono', monospace;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  --glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Light Mode Variables */
body.light-theme {
  --bg: #f3f4f6;
  --bg-gradient: radial-gradient(circle at 50% -20%, #e0e7ff 0%, #f3f4f6 75%);
  --panel: rgba(255, 255, 255, 0.8);
  --panel-hover: rgba(255, 255, 255, 0.9);
  --panel-active: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.18);
  --text: #111827;
  --text-muted: #4b5563;
  --text-dark: #9ca3af;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 32px rgba(99, 102, 241, 0.08);
  --shadow-lg: 0 16px 48px rgba(99, 102, 241, 0.12);
  --glow: 0 0 20px rgba(99, 102, 241, 0.08);
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* App Grid Layout */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-info h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 50%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-info span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-top: 1px;
}

/* Sidebar Nav Buttons */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.nav-item button {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-item button:hover {
  background: var(--panel-hover);
  color: var(--text);
  border-color: var(--border);
}

.nav-item button.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.25);
  font-weight: 600;
  box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.05);
}

.nav-item button svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.nav-item button:hover svg {
  transform: translateX(2px);
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.footer-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.footer-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
  border-color: var(--text-muted);
}

.developer-tag {
  font-size: 11px;
  color: var(--text-dark);
  text-align: center;
  line-height: 1.4;
}

.developer-tag a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.developer-tag a:hover {
  text-decoration: underline;
}

/* Main Content Area */
.main-content {
  padding: 40px 48px;
  overflow-y: auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Page Panels (SPA Views) */
.page-view {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.page-view.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Header Row */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  padding-right: 160px;
}

.view-title h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-title p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.view-actions {
  display: flex;
  gap: 12px;
}

/* Theme Toggle Header button */
.top-actions {
  position: absolute;
  top: 40px;
  right: 48px;
  display: flex;
  gap: 12px;
  z-index: 50;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  border-color: var(--text-muted);
  background: var(--panel-hover);
  transform: rotate(15deg);
}

.lang-dropdown-container {
  position: relative;
  z-index: 100;
}

.lang-trigger-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  outline: none;
}

.lang-trigger-btn:hover,
.lang-dropdown-container.open .lang-trigger-btn {
  border-color: var(--accent);
  background: var(--panel-hover);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.2);
}

.lang-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.7;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-dropdown-container.open .lang-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 64px;
  background: var(--panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 5px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.lang-dropdown-container.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lang-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-opt:hover {
  background: var(--panel-hover);
  color: var(--accent-light, #818cf8);
}

.lang-opt.active {
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent);
  font-weight: 700;
}

/* Glassmorphism Cards */
.card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

/* Layout Split Grid */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

/* Dropzone Styles */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.dropzone:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.02);
}

.dropzone.dragover {
  border-color: var(--accent-secondary);
  background: rgba(168, 85, 247, 0.06);
  transform: scale(1.01);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dz-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
  color: var(--accent);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.08);
  transition: transform 0.2s ease;
}

.dropzone:hover .dz-icon {
  transform: translateY(-4px) scale(1.05);
}

.dz-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dz-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.dz-badges {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Controls Grid */
.control-section {
  margin-bottom: 20px;
}

.control-section:last-child {
  margin-bottom: 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Form Inputs */
.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.fmt-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 10px 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  text-transform: uppercase;
}

.fmt-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(99, 102, 241, 0.04);
}

.fmt-btn.active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  color: var(--text);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

/* Switch Option List */
.opt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

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

.opt-row input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.opt-row input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.opt-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.opt-row input[type="checkbox"]:checked::before {
  left: 18px;
}

/* Range Sliders */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.slider-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}

.range-input {
  width: 100%;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease;
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-input:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Text Input Fields */
.text-input-row {
  display: flex;
  gap: 8px;
}

.text-field {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.text-field:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.text-field.numeric {
  font-family: var(--font-mono);
  font-weight: 700;
}

.input-addon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Primary Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

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

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

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--panel-hover);
}

.btn-danger-ghost {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
}

.btn-full {
  width: 100%;
}

/* File Cards list */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.file-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  align-items: center;
  transition: all 0.2s ease;
}

.file-card:hover {
  border-color: var(--border-hover);
  transform: scale(1.002);
  background: var(--panel-hover);
}

.file-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: #10111a;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.file-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-thumb-icon {
  font-size: 24px;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.file-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.file-meta-row span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-arrow {
  color: var(--accent);
  font-weight: bold;
}

.meta-saving {
  font-weight: 700;
}

.meta-saving.positive { color: var(--success); }
.meta-saving.negative { color: var(--error); }

.file-status-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.file-status-badge.pending {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.file-status-badge.processing {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.file-status-badge.done {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.file-status-badge.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.file-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--panel-hover);
}

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

.icon-btn.primary-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.icon-btn.primary-btn:hover:not(:disabled) {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* Spinner */
.loading-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Text Editors Grid */
.editors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 800px) {
  .editors-grid {
    grid-template-columns: 1fr;
  }
}

.editor-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.editor-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.editor-select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: bold;
  outline: none;
  cursor: pointer;
}

.editor-select option {
  background-color: #0e0f14;
  color: #f3f4f6;
}

body.light-theme .editor-select option {
  background-color: #ffffff;
  color: #111827;
}

.editor-textarea {
  width: 100%;
  height: 400px;
  background: #090a0f;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  color: #a7f3d0; /* Soft green terminal text */
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease;
}

body.light-theme .editor-textarea {
  background: #fdfdfd;
  color: #065f46;
}

.editor-textarea:focus {
  border-color: var(--accent);
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dark);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

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

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast.info { border-left: 3px solid var(--accent); }
.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.error { border-left: 3px solid var(--error); }

/* Audio Converter Module Styles */
.audio-player-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.audio-preview {
  width: 100%;
  margin-top: 8px;
  outline: none;
}

/* Base64 Hub layout */
.base64-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.b64-textarea {
  width: 100%;
  height: 200px;
  background: #090a0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
  outline: none;
}

body.light-theme .b64-textarea {
  background: #fdfdfd;
  color: #1e293b;
}

.b64-textarea:focus {
  border-color: var(--accent);
}

/* Layout Utilities */
.flex-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

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

.hidden {
  display: none !important;
}

/* Scrollbars styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dark);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    height: auto;
    position: relative;
    padding: 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .main-content {
    height: auto;
    padding: 24px 20px;
  }
  
  .top-actions {
    position: fixed;
    top: 20px;
    right: 20px;
  }

  .view-header {
    padding-right: 0;
  }
}

/* ==========================================
   Phase 8 New Utility Styling Rules
   ========================================== */

/* Word Frequency Stats styling */
.freq-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.freq-word {
  width: 90px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.freq-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}
.freq-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  border-radius: 4px;
  transition: width 0.3s ease;
}
.freq-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  width: 40px;
  text-align: right;
}

/* Page checklist grid for splitting PDF */
.page-chk-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  transition: all 0.2s ease;
}
.page-chk-label:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}
.page-chk-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.page-chk-label.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  color: #fff;
}

/* PDF merge list items */
.pdf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 10px;
  gap: 12px;
}
.pdf-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.pdf-item-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.pdf-item-actions {
  display: flex;
  gap: 6px;
}
.pdf-item-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pdf-item-actions button:hover {
  border-color: var(--text);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
