:root {
  --primary: #5B45FF;
  --primary-hover: #4935e6;
  --primary-light: #eeebff;
  --text-dark: #090A1A;
  --text-muted: #64748b;
  --bg-main: #F8F9FE;
  --bg-card: #ffffff;
  --bg-sidebar: #f1f5f9;
  --border-color: #e2e8f0;
  --border-active: #5B45FF;
  --danger: #FF5252;
  --success: #00B982;
  --warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-float: 0 20px 30px -10px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
  --primary: #7b69ff;
  --primary-hover: #9587ff;
  --primary-light: rgba(91, 69, 255, 0.18);
  --text-dark: #F8F9FE;
  --text-muted: #94a3b8;
  --bg-main: #0B0C1E;
  --bg-card: #131530;
  --bg-sidebar: #0B0C1E;
  --border-color: #1E224A;
  --border-active: #7b69ff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-float: 0 20px 30px -10px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Header */
.app-header {
  height: 68px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  cursor: pointer;
}

.logo-sub {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Main Navigation Tabs */
.main-nav-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab-btn:hover {
  color: var(--text-dark);
}

.nav-tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--primary);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-main);
  padding: 4px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.zoom-level {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 6px;
  min-width: 44px;
  text-align: center;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  user-select: none;
  background: transparent;
  color: var(--text-dark);
}

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

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}

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

.btn-tool {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  font-weight: 500;
}

.btn-tool:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-icon-only {
  padding: 6px 10px;
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

/* Workspace Layout with Sidebar */
.app-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - 68px);
  position: relative;
  overflow: hidden;
}

/* Thumbnails Sidebar */
.sidebar-thumbnails {
  width: 200px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  transition: width 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

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

.sidebar-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
}

.btn-close-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.thumbnails-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.thumbnail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 6px;
  border: 2px solid transparent;
  transition: all 0.18s ease;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.thumbnail-item:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.thumbnail-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.thumbnail-canvas {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.thumbnail-info {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.thumbnail-actions {
  display: flex;
  gap: 4px;
}

.thumbnail-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
}

.thumbnail-action-btn:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.05);
}

/* Main Container */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  background-color: var(--bg-main);
}

/* Upload Dropzone View */
.upload-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.dropzone-card {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 50px 40px;
  max-width: 680px;
  width: 100%;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-md);
  position: relative;
}

.dropzone-card:hover,
.dropzone-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.dropzone-icon-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.dropzone-icon {
  width: 76px;
  height: 76px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto;
  transition: transform 0.25s ease;
}

.dropzone-card:hover .dropzone-icon {
  transform: scale(1.1);
}

.dropzone-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.dropzone-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.file-input-hidden {
  display: none;
}

.security-features {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.sec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sec-item i {
  color: var(--primary);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

/* PDF Viewer View */
.viewer-view {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 40px 20px 100px 20px;
  overflow-y: auto;
}

.pages-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

/* Page Wrapper */
.page-wrapper {
  position: relative;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  transition: transform 0.2s ease;
  user-select: none;
}

.page-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: auto;
}

.page-number-tag {
  position: absolute;
  bottom: -24px;
  right: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Placed Elements */
.placed-element {
  position: absolute;
  cursor: move;
  z-index: 20;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed transparent;
  transition: border-color 0.15s ease;
  touch-action: none;
}

/* Curseur / Fantôme de placement interactif */
.placement-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  opacity: 0.85;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
  cursor: crosshair;
  transition: transform 0.05s linear;
}

.placement-ghost img,
.placement-ghost .placed-stamp-content,
.placement-ghost .placed-text-content {
  max-width: 260px;
  max-height: 120px;
  object-fit: contain;
}

.placement-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: pulseBanner 1.5s infinite;
}

@keyframes pulseBanner {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.03); }
}

.placed-element:hover {

  border-color: rgba(37, 99, 235, 0.5);
}

.placed-element.selected {
  border: 1.5px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.placed-element img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.placed-text-content {
  width: 100%;
  height: 100%;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  cursor: text;
}

/* Stamp inside element */
.placed-stamp-content {
  width: 100%;
  height: 100%;
  border: 3px solid currentColor;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  transform: rotate(-12deg);
  user-select: none;
}

/* Element Actions (Delete, Duplicate) */
.element-actions {
  position: absolute;
  top: -34px;
  right: 0;
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  z-index: 50;
}

.placed-element.selected .element-actions {
  display: flex;
}

.element-action-btn {
  background: transparent;
  border: none;
  padding: 4px 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.element-action-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.element-action-btn.btn-delete:hover {
  color: var(--danger);
  background: #fee2e2;
}

/* Resize Handles */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: none;
  z-index: 30;
}

.placed-element.selected .resize-handle {
  display: block;
}

.handle-nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.handle-ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.handle-se {
  bottom: -6px;
  right: -6px;
  cursor: nwse-resize;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card-sm {
  max-width: 480px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

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

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-main);
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-card);
}

.modal-body {
  padding: 24px;
}

.tab-content {
  display: none;
}

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

/* Signature Drawing Canvas */
.draw-canvas-wrapper {
  position: relative;
  background: #ffffff;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  touch-action: none;
}

#sigCanvas {
  display: block;
  width: 100%;
  height: 220px;
  cursor: crosshair;
}

.sig-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  pointer-events: none;
  font-size: 0.95rem;
}

.draw-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.color-picker-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.color-btn,
.type-color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-btn.active,
.type-color-btn.active {
  border-color: var(--primary);
  transform: scale(1.2);
}

/* Type Signature Inputs & Fonts */
.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--primary);
}

.font-previews {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.font-preview-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-main);
}

.font-preview-item:hover {
  border-color: var(--primary);
}

.font-preview-item.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.font-sample {
  font-size: 1.5rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}

.font-preview-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Upload Sig Dropzone */
.upload-sig-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  background: var(--bg-main);
}

.upload-sig-dropzone i {
  font-size: 2.2rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.image-preview-container {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#imagePreview {
  max-width: 260px;
  max-height: 120px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px;
  background: #ffffff;
}

/* Stamps Grid */
.stamps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.stamp-option {
  padding: 18px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  background: var(--bg-main);
}

.stamp-option:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stamp-preview {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 2px;
  border: 2.5px solid currentColor;
  padding: 6px 14px;
  border-radius: 6px;
  transform: rotate(-6deg);
}

.stamp-approved {
  color: #16a34a;
}

.stamp-rejected {
  color: #dc2626;
}

.stamp-paid {
  color: #2563eb;
}

.stamp-confidential {
  color: #d97706;
}

.stamp-urgent {
  color: #e11d48;
}

.stamp-copy {
  color: #475569;
}

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

/* Mobile Action Bar */
.mobile-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  z-index: 90;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.btn-m-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.btn-m-action i {
  font-size: 1.15rem;
}

.btn-m-action:hover,
.btn-m-action:active {
  color: var(--primary);
}

.btn-m-action.m-download {
  color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================================
   IMAGE OPTIMIZER SECTION STYLES
   ======================================================== */
.app-section {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.img-optimizer-container {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px 80px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.img-upload-card {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 44px 30px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
  cursor: pointer;
}

.img-upload-card:hover,
.img-upload-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.img-opt-icon {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.img-upload-card h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.img-upload-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 600px;
  margin: 0 auto 20px auto;
}

.img-badge-info {
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Controls Panel */
.img-controls-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
}

.control-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-box label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.select-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-dark);
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

/* Image Sub-Mode Tabs */
.img-subnav-tabs {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 6px;
  width: 100%;
}

.img-subnav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.img-subnav-btn:hover {
  color: var(--text-dark);
}

.img-subnav-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.enhance-checkboxes-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.slider-input {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.control-actions-box {
  display: flex;
  flex-direction: row;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
  font-weight: 600;
}

.btn-success:hover {
  background: #15803d;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Stats Bar */
.opt-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-main);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.stat-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-num {
  font-weight: 700;
  color: var(--text-dark);
}

.stat-saved {
  color: #16a34a;
}

.stat-gain-badge {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
}

/* Images Queue List */
.img-queue-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.queue-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.img-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.img-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.img-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.img-card-preview {
  height: 140px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.img-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.img-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

.img-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.img-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.img-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.meta-saved {
  color: #16a34a;
  font-weight: 700;
}

.img-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.img-card-actions .btn {
  padding: 5px 10px;
  font-size: 0.78rem;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .header-tools {
    gap: 6px;
  }

  .tool-group-primary .btn span {
    display: none;
  }

  .tool-group-primary .btn {
    padding: 8px 10px;
  }

  .btn-text {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0 10px;
  }

  .main-nav-tabs .nav-tab-btn span {
    display: none;
  }

  .main-nav-tabs .nav-tab-btn {
    padding: 7px 10px;
  }

  .header-tools {
    display: none !important;
  }

  .mobile-action-bar {
    display: flex !important;
  }

  .sidebar-thumbnails {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 170px;
    box-shadow: var(--shadow-lg);
  }

  .font-previews,
  .stamps-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   QR CODE & URL SHORTENER SECTION STYLES
   ======================================================== */
.qr-shortener-container {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px 80px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.qr-shortener-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.tool-card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.tool-card-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.qr-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qr-form-group label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

/* Shortener Box */
.shortener-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortener-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.shortener-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.short-url-result {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.short-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.short-link {
  flex: 1;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
  word-break: break-all;
}

.short-link:hover {
  text-decoration: underline;
}

.btn-copy-short {
  width: 32px;
  height: 32px;
}

/* QR Customization Options */
.qr-options-box {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qr-options-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.qr-opt-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qr-opt-item label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

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

.color-val-label {
  font-size: 0.82rem;
  font-family: monospace;
  color: var(--text-dark);
}

/* Right Card: QR Preview */
.qr-preview-card {
  align-items: center;
  text-align: center;
}

.qr-preview-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.qr-canvas-container {
  background: #ffffff;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  width: 100%;
  max-width: 320px;
}

#qrcodeDisplay img,
#qrcodeDisplay canvas {
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-preview-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.qr-download-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* QR History */
.qr-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 12px;
}

.history-text {
  font-size: 0.84rem;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

@media (max-width: 860px) {
  .qr-shortener-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   VIDEO TO AUDIO CONVERTER SECTION STYLES
   ======================================================== */
.video-converter-container {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px 80px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.video-upload-card {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 44px 30px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
  cursor: pointer;
}

.video-upload-card:hover,
.video-upload-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.video-opt-icon {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.video-upload-card h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.video-upload-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 600px;
  margin: 0 auto 20px auto;
}

/* Video Workspace Card */
.video-workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.video-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  align-items: start;
}

.video-preview-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.video-player-wrapper {
  background: #000000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-player-wrapper video {
  width: 100%;
  max-height: 240px;
  display: block;
}

.video-info-meta h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.video-meta-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.video-meta-tags span {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Audio Settings Box */
.audio-settings-box {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.audio-settings-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.audio-opt-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-opt-item label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Trim Box */
.audio-trim-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audio-trim-box label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.trim-inputs {
  display: flex;
  gap: 14px;
}

.trim-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.text-input-sm {
  width: 90px;
  padding: 6px 10px;
  font-size: 0.84rem;
}

/* Actions Row */
.conversion-actions-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Progress Bar */
.conversion-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-main);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.progress-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* Result Box */
.audio-result-box {
  background: var(--bg-main);
  border: 1px solid #10b981;
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-success-badge {
  color: #10b981;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-audio-player {
  width: 100%;
  height: 40px;
  outline: none;
}

.result-actions {
  display: flex;
  justify-content: center;
}

/* AI Voice Enhancement Card (ElevenLabs) */
.ai-enhance-card {
  margin-top: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.06);
}

.ai-enhance-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-enhance-header h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-top: 4px;
}

.ai-enhance-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.ai-enhance-action {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ai-status-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
}

.enhanced-result-box {
  background: var(--bg-main);
  border: 1px solid #8b5cf6;
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.enhanced-title {
  color: #8b5cf6;
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 860px) {
  .video-workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   AI AUDIO STUDIO SECTION STYLES
   ======================================================== */
.ai-studio-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px 80px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ai-audio-upload-card {
  background: var(--bg-card);
  border: 2px dashed rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-lg);
  padding: 48px 30px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
  cursor: pointer;
}

.ai-audio-upload-card:hover, .ai-audio-upload-card.drag-over {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.05);
  transform: translateY(-2px);
}

.ai-studio-icon {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(139, 92, 246, 0.2));
  color: #8b5cf6;
}

.ai-audio-upload-card h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ai-audio-upload-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 620px;
  margin: 0 auto 20px auto;
}

.ai-studio-workspace {
  width: 100%;
}

.ai-workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.ai-file-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.audio-file-icon {
  width: 44px;
  height: 44px;
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.player-comparison-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* AI Modes & Voice Changer Selection */
.ai-mode-selection-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.ai-mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-ai-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  color: var(--text-dark);
}

.btn-ai-mode i {
  font-size: 1.4rem;
  color: var(--text-muted);
}

.btn-ai-mode strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
}

.btn-ai-mode span {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-ai-mode:hover {
  border-color: #8b5cf6;
  transform: translateY(-1px);
}

.btn-ai-mode.active {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
}

.btn-ai-mode.active i {
  color: #8b5cf6;
}

.voice-picker-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  animation: modalIn 0.2s ease;
}

.voice-picker-container label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-launch-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.ai-status-indicator {
  font-size: 0.9rem;
  font-weight: 600;
  color: #8b5cf6;
  min-height: 24px;
}

.direct-ai-result-card {
  background: var(--bg-main);
  border: 2px solid #8b5cf6;
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 680px) {
  .ai-mode-toggle-group {
    grid-template-columns: 1fr;
  }
}

/* =============================================================
   FILYX BRAND DESIGN SYSTEM & SAAS MODALS
   ============================================================= */

/* Brand Logo */
.filyx-brand-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.logo:hover .filyx-brand-img {
  transform: scale(1.04);
}

.filyx-tag-badge {
  background: linear-gradient(135deg, #5B45FF, #2D2D83);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.8px;
  box-shadow: 0 2px 8px rgba(91, 69, 255, 0.4);
}

/* User Credits Badge in Header */
.user-credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(91, 69, 255, 0.1);
  color: #5B45FF;
  border: 1px solid rgba(91, 69, 255, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .user-credits-badge {
  background: rgba(123, 105, 255, 0.15);
  color: #A594FF;
  border-color: rgba(123, 105, 255, 0.35);
}

.user-credits-badge:hover {
  background: #5B45FF;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 69, 255, 0.3);
}

/* Upgrade Pro Pill Button */
.btn-upgrade-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #5B45FF 0%, #2D2D83 100%);
  color: #ffffff;
  border: none;
  padding: 7px 15px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(91, 69, 255, 0.35);
  transition: all 0.2s ease;
}

.btn-upgrade-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 69, 255, 0.5);
}

.btn-outline-auth {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline-auth:hover {
  border-color: #5B45FF;
  color: #5B45FF;
}

/* -------------------------------------------------------------
   MOTION STUDIO STYLES
   ------------------------------------------------------------- */
.motion-studio-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

.motion-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-selector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.template-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-main);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  border-color: #5B45FF;
  transform: translateX(3px);
}

.template-card.active {
  border-color: #5B45FF;
  background: rgba(91, 69, 255, 0.06);
  box-shadow: 0 0 0 1px #5B45FF;
}

.template-preview-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(91, 69, 255, 0.15), rgba(45, 45, 131, 0.2));
  color: #5B45FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.template-card.active .template-preview-icon {
  background: #5B45FF;
  color: #ffffff;
}

.template-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.template-info strong {
  font-size: 0.88rem;
  color: var(--text-dark);
}

.template-info span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.color-palette-picker {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #5B45FF;
  transform: scale(1.15);
}

.upload-compact-box {
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.upload-compact-box:hover {
  border-color: #5B45FF;
  color: #5B45FF;
  background: rgba(91, 69, 255, 0.03);
}

/* Motion Stage Viewport */
.stage-viewport-container {
  background: #0B0C1E;
  border-radius: var(--radius-lg);
  border: 1px solid #1E224A;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.stage-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #131530;
  border-bottom: 1px solid #1E224A;
  font-size: 0.78rem;
}

.rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #00E5A3;
  font-weight: 700;
  font-family: monospace;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00E5A3;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.stage-scene-name {
  color: #ffffff;
  font-weight: 600;
}

.stage-alpha-badge {
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.canvas-16-9-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-image: linear-gradient(45deg, #161833 25%, transparent 25%), 
                    linear-gradient(-45deg, #161833 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #161833 75%), 
                    linear-gradient(-45deg, transparent 75%, #161833 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #0d0f22;
  display: flex;
  align-items: center;
  justify-content: center;
}

#motionCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.timeline-scrubber-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #131530;
  border-top: 1px solid #1E224A;
}

.btn-play-pause, .btn-icon-timeline {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #2D2D83;
  background: #1E224A;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-play-pause:hover, .btn-icon-timeline:hover {
  background: #5B45FF;
  border-color: #5B45FF;
}

.timeline-time-info {
  color: #94A3B8;
  font-size: 0.8rem;
  font-family: monospace;
  min-width: 90px;
}

.timeline-slider-track {
  flex: 1;
  height: 8px;
  background: #1E224A;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.timeline-slider-fill {
  height: 100%;
  background: linear-gradient(90deg, #5B45FF, #00E5A3);
  border-radius: 4px;
  transition: width 0.05s linear;
}

.export-actions-box {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* -------------------------------------------------------------
   CONVERSION & MONETIZATION MODAL STYLES (Codex Specs)
   ------------------------------------------------------------- */
.modal-conversion-card {
  max-width: 480px;
  text-align: center;
  padding: 36px 30px;
}

.modal-header-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.conversion-icon-wrapper {
  margin: 0 auto 16px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(91, 69, 255, 0.15), rgba(0, 229, 163, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversion-glow-circle {
  font-size: 1.8rem;
  color: #5B45FF;
}

.modal-body-conversion h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.conversion-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.conversion-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-full-width {
  width: 100%;
  justify-content: center;
}

.conversion-footer-link {
  margin-top: 18px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.conversion-footer-link a {
  color: #5B45FF;
  font-weight: 600;
  text-decoration: none;
}

/* Pricing Grid Modal */
.modal-pricing-card {
  max-width: 860px;
  padding: 24px;
}

.pricing-modal-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pricing-modal-title h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
}

.pricing-modal-title p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.badge-tag-purple {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #5B45FF;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.pricing-offers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.pricing-plan-card {
  background: var(--bg-main);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.25s ease;
}

.pricing-plan-card:hover {
  transform: translateY(-4px);
  border-color: #5B45FF;
  box-shadow: var(--shadow-md);
}

.pricing-plan-card.featured-plan {
  border-color: #5B45FF;
  background: linear-gradient(180deg, rgba(91, 69, 255, 0.05) 0%, var(--bg-main) 100%);
  box-shadow: 0 8px 24px rgba(91, 69, 255, 0.15);
}

.featured-ribbon {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #5B45FF, #2D2D83);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.plan-header {
  margin-bottom: 16px;
}

.plan-type {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.plan-header h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 4px 0 8px;
}

.plan-price {
  font-size: 1.6rem;
  font-weight: 900;
  color: #5B45FF;
}

.plan-price .currency {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.plan-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 0.84rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
}

.feature-item i {
  color: #00E5A3;
}

.payment-methods-footer {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.payment-badges-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-badges-row span {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-momo { color: #f59e0b; }
.badge-moov { color: #0284c7; }
.badge-celtiis { color: #10b981; }
.badge-wave { color: #06b6d4; }
.badge-card { color: #6366f1; }

/* Phone Pulse Animation (Modale D) */
.phone-pulse-animation {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(91, 69, 255, 0.12);
  color: #5B45FF;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.pulse-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #5B45FF;
  animation: pulseRing 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.waiting-indicator-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #5B45FF;
  margin-top: 10px;
}

/* Auth Modal */
.modal-auth-card {
  max-width: 420px;
  padding: 26px;
}

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

.auth-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

.auth-tabs-row {
  display: flex;
  background: var(--bg-main);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
}

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

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
  padding: 0 10px;
}

@media (max-width: 900px) {
  .motion-studio-grid {
    grid-template-columns: 1fr;
  }
  .pricing-offers-grid {
    grid-template-columns: 1fr;
  }
}

