/* ============================================
   Karzni PDF — Warm Modernist Design
   Inspired by Japanese minimalism + Swiss typography
   ============================================ */

/* ── Reset ────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Design Tokens ────────────────────────── */
:root {
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", "SF Mono", "Fira Code", monospace;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 250ms;
  --duration-fast: 120ms;

  --container-max: 1080px;
}

/* ── Light Theme (Default Warm Amber) ─────── */
[data-theme="light"] {
  --bg: #F8F7F4;
  --bg-surface: #FFFFFF;
  --bg-hover: #F1F0ED;
  --bg-active: #E8E6E1;

  --text: #1A1917;
  --text-secondary: #6B6860;
  --text-muted: #9C9890;

  --border: #E2E0DB;
  --border-strong: #D4D2CC;

  --accent: #B45309; /* Warm Amber */
  --accent-bg: #FFFBEB;
  --accent-border: #FCD34D;
  --accent-text: #92400E;

  --logo-bg: #FFFBEB;
  --logo-color: #D97706;

  --tab-active-bg: var(--accent);
  --tab-active-text: #FFFFFF;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);

  --canvas-page-bg: #FFFFFF;
  --overlay-bg: rgba(248, 247, 244, 0.85);

  color-scheme: light;
}

/* ── Dark Theme (Sleek Carbon & Amber) ───── */
[data-theme="dark"] {
  --bg: #161514;
  --bg-surface: #1E1D1B;
  --bg-hover: #262523;
  --bg-active: #2E2D2A;

  --text: #EDECE8;
  --text-secondary: #908D85;
  --text-muted: #5C5A54;

  --border: #2E2D2A;
  --border-strong: #3D3B37;

  --accent: #F59E0B;
  --accent-bg: rgba(245, 158, 11, 0.08);
  --accent-border: #B45309;
  --accent-text: #FCD34D;

  --logo-bg: #161514;
  --logo-color: #F59E0B;

  --tab-active-bg: var(--accent);
  --tab-active-text: #161514;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.03);

  --canvas-page-bg: #262523;
  --overlay-bg: rgba(22, 21, 20, 0.9);

  color-scheme: dark;
}

/* ── Base ─────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  transition: background var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ── Header ───────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.logo:hover { opacity: 0.7; }

.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--logo-bg, var(--accent-bg));
  color: var(--logo-color, var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.logo-sub {
  color: var(--accent);
  font-weight: 800;
  margin-left: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--bg-hover);
}

.lang-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px; /* Safe flex gap for responsive positioning */
}

.lang-select-wrapper .lang-icon {
  position: absolute;
  left: 10px;
  z-index: 2;
  pointer-events: none;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease);
}

.lang-select-wrapper:hover .lang-icon {
  color: var(--text);
}

.lang-select {
  display: inline-block;
  vertical-align: middle;
  height: 36px;
  padding: 0 24px 0 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23B45309' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  text-align: left;
}

.lang-select option {
  display: block;
  padding: 10px 16px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.lang-select:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* Custom Dropdown Styling to match qr-site standard */
.custom-dropdown-trigger {
  text-align: left !important;
}

.custom-dropdown.open .custom-dropdown-trigger {
  border-color: var(--accent);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  max-height: 200px;
  overflow-y: auto;
}

.custom-dropdown.open .custom-dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Mode toggle specific dropdown alignment */
.mode-dropdown {
  position: relative;
  display: inline-flex;
}

.mode-dropdown .custom-dropdown-menu {
  min-width: 200px;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  right: auto;
}

.mode-dropdown.open .custom-dropdown-menu {
  transform: translateX(-50%) translateY(0);
}

.mode-dropdown .arrow-icon {
  transition: transform var(--duration-fast) var(--ease);
}

.mode-dropdown.open .arrow-icon {
  transform: rotate(180deg);
}

.custom-dropdown-item {
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--duration-fast) var(--ease);
}

.custom-dropdown-item:hover {
  background: var(--bg-hover);
}

.custom-dropdown-item.selected {
  color: var(--accent);
  font-weight: 600;
}

.custom-dropdown-item.selected::after {
  content: "";
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6L9 17L4 12' stroke='%23B45309' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.custom-dropdown-item:first-child {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.custom-dropdown-item:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ── Hero ─────────────────────────────────── */
.hero {
  text-align: center;
  padding: var(--space-md) var(--space-xl) var(--space-xs);
  max-width: var(--container-max);
  margin: 0 auto;
  width: 100%;
}

.hero h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Mode Toggle / Tabs ───────────────────── */
.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 16px auto;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  max-width: fit-content;
  box-shadow: var(--shadow-sm);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}

.mode-btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  transition: opacity var(--duration-fast) var(--ease);
}

.mode-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.mode-btn.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
}

.mode-btn.active svg {
  opacity: 1;
}

/* ── Workspaces ───────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-xl) var(--space-2xl);
}

.workspace {
  display: none;
  flex-direction: column;
  animation: fadeIn var(--duration) var(--ease) forwards;
}

.workspace.active {
  display: flex;
}

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

/* ── Dropzone Area ────────────────────────── */
.dropzone-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  background: var(--bg-surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-card);
}

.dropzone-area:hover,
.dropzone-area.drag-over {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: scale(1.005);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease);
}

.dropzone-area:hover .dropzone-icon {
  color: var(--accent);
}

.dropzone-inner h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dropzone-inner p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── Editor Container ─────────────────────── */
.editor-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  margin-top: 10px;
  min-height: 380px;
  animation: slideUp var(--duration) var(--ease) forwards;
}

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

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.editor-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.editor-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

/* Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

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

.action-btn.primary:hover {
  background: #92400E; /* Darker amber */
  border-color: #92400E;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.2);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Canvas Grid (Thumbnails) ──────────────── */
.canvas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-lg);
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}

.canvas-grid.mini {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--space-md);
  min-height: 140px;
}

/* Page Card Item */
.page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--canvas-page-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease), border-color var(--duration) var(--ease);
  user-select: none;
}

.page-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.page-card:active {
  cursor: grabbing;
}

.page-card.dragging {
  opacity: 0.5;
  border: 2px dashed var(--accent);
}

/* Thumbnail Wrapper */
.thumbnail-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.414; /* A4 aspect ratio */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAFAF9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: transform var(--duration) var(--ease);
}

[data-theme="dark"] .thumbnail-wrapper {
  background: #11100F;
}

.thumbnail-wrapper canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-badge {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.page-card:hover .page-badge {
  background: var(--accent-bg);
  color: var(--accent-text);
}

/* Page Card Action Overlays */
.card-overlay {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease);
  z-index: 10;
}

.page-card:hover .card-overlay {
  opacity: 1;
}

.card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}

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

.card-btn.delete:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-border);
}

/* Action Rows */
.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ── Split Controls ───────────────────────── */
.split-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.split-modes {
  display: flex;
  gap: var(--space-lg);
}

.control-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.control-radio input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.radio-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

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

.input-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--duration-fast) var(--ease);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
}

.input-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Compress Settings ────────────────────── */
.compress-level-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.level-card {
  padding: var(--space-lg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.level-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.level-card.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.level-title {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.level-card.active .level-title {
  color: var(--accent-text);
}

.level-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ── Toast Notifications ──────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: max-content;
  max-width: 480px;
  animation: toastEnter 0.3s var(--ease) forwards;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.toast svg {
  flex-shrink: 0;
}

.toast span {
  flex: 1;
  text-align: left;
  line-height: 1.35;
}

.toast.toast-error {
  border-color: #dc2626;
  color: #dc2626;
}

.toast.toast-success {
  border-color: #16a34a;
  color: #16a34a;
}

.toast.toast-exit {
  animation: toastExit 0.3s var(--ease) forwards;
}

@keyframes toastEnter {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastExit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(20px) scale(0.95); }
}

/* ── Processing Overlay ───────────────────── */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: opacity var(--duration) var(--ease);
}

.processing-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.processing-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  will-change: transform;
  transform: translateZ(0);
  animation: spin 0.8s linear infinite;
}

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

.processing-box h4 {
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.processing-box p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}



/* ── Footer ───────────────────────────────── */
.footer {
  margin-top: auto;
  padding: var(--space-2xl) var(--space-xl) var(--space-lg);
  max-width: var(--container-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-links .dot {
  font-size: 4px;
  line-height: 1;
}

.footer-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

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

/* ── Responsive adjustments ───────────────── */
@media (max-width: 640px) {
  .header {
    padding: var(--space-md);
  }
  .main {
    padding: 0 var(--space-md) var(--space-xl);
  }
  .hero {
    padding: var(--space-md) var(--space-md) var(--space-xs);
  }
  .mode-toggle {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .mode-btn {
    white-space: nowrap;
    flex: 1;
  }
  .editor-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .editor-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .canvas-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
  }
  .compress-level-selector {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mode-toggle {
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    padding: 4px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .mode-btn {
    flex-shrink: 0;
  }
}

@media (hover: none) {
  .card-overlay {
    opacity: 1 !important;
  }
}

/* Edit Tool Custom Text inputs styling */
.modal-text-input-wrapper {
  position: absolute;
  border: 1.5px dashed var(--accent);
  background: rgba(255, 251, 235, 0.85);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: move;
  z-index: 20;
}

.modal-text-input {
  border: none;
  background: transparent;
  color: #161514;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  min-width: 100px;
  width: auto;
}

.modal-text-input-delete {
  width: 16px;
  height: 16px;
  background: #dc2626;
  color: #FFFFFF;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-text-input-delete:hover {
  background: #b91c1c;
}

/* Form Creator Styles */
.design-page-wrapper {
  position: relative;
  display: inline-block;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  margin: 16px auto;
  user-select: none;
}

.field-overlay {
  position: absolute;
  border: 2px dashed var(--accent);
  background: rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-xs);
  cursor: default;
  resize: both;
  overflow: hidden;
  min-width: 60px;
  min-height: 24px;
  box-sizing: border-box;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  color: #1e293b;
  user-select: none;
  -webkit-user-select: none;
}

.field-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 100%;
  cursor: move;
  background: rgba(245, 158, 11, 0.25);
  border-right: 1.5px dashed var(--accent);
  color: var(--accent-text);
  flex-shrink: 0;
  transition: background var(--duration-fast);
}

.field-drag-handle:hover {
  background: rgba(245, 158, 11, 0.4);
}

.field-drag-handle svg {
  pointer-events: none;
}

.field-label-text {
  flex: 1;
  padding: 0 16px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.delete-field-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  cursor: pointer;
  color: #ef4444;
  font-size: 10px;
  font-weight: 800;
  padding: 2px;
  line-height: 1;
  z-index: 15;
}

.delete-field-btn:hover {
  opacity: 0.8;
}

/* Language selector option spacing and flex container fix */
.lang-select-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px; /* Tailwind flex gap equivalent */
}

.lang-select option {
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--text-secondary);
}

/* In case languages are rendered as list/link items on smaller screens */
.lang-select-list, .languages-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Form Workspace Canvas Container (Vertical Scrollable Layout) */
.form-workspace-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  overflow-y: auto;
  max-height: 650px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: var(--space-md);
  box-sizing: border-box;
}

/* Form Filler Overlay Fields */
.filler-field-overlay {
  transition: all var(--duration-fast) var(--ease);
}

.filler-field-overlay:focus {
  border-color: var(--accent) !important;
  background: rgba(245, 158, 11, 0.16) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

input[type="checkbox"].filler-field-overlay {
  cursor: pointer;
  accent-color: var(--accent);
}

select.filler-field-overlay {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24' fill='none' stroke='%23F59E0B' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 6px center !important;
  background-size: 10px !important;
  padding-right: 18px !important;
}
