/* ==========================================================================
   SMARTDOCIFY - PASSPORT PHOTO MAKER STYLESHEET
   Matches SmartDocify SaaS Design System Exactly
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT VARIABLES & THEMES
   -------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  /* Brand Palette */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-tint: rgba(37, 99, 235, 0.08);
  --primary-border: rgba(37, 99, 235, 0.25);
  --secondary: #7c3aed;
  --secondary-hover: #6d28d9;
  --secondary-light: #f5f3ff;
  --accent: #06b6d4;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Light Theme Defaults */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-backdrop: rgba(15, 23, 42, 0.6);
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.2);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-card: #131d31;
  --bg-card-alt: #1a2640;
  --bg-backdrop: rgba(3, 7, 18, 0.75);
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --border-color: #1e293b;
  --border-light: #162032;
  --primary-light: rgba(37, 99, 235, 0.15);
  --primary-tint: rgba(37, 99, 235, 0.12);
  --primary-border: rgba(59, 130, 246, 0.3);
  --secondary-light: rgba(124, 58, 237, 0.15);
  --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 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.25);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: transparent;
}

/* --------------------------------------------------------------------------
   3. BUTTON SYSTEM
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: var(--bg-card-alt);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-outline:hover {
  background-color: var(--primary-tint);
  border-color: var(--primary);
}

.btn-lg {
  padding: 0.85rem 1.65rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.btn-xs {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   4. SITE HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .site-header {
  background-color: rgba(11, 17, 32, 0.88);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-svg {
  width: 32px;
  height: 32px;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.desktop-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-tint);
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-tint);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.action-btn:hover {
  color: var(--primary);
  border-color: var(--primary-border);
  background-color: var(--primary-tint);
}

.action-btn .ui-icon {
  width: 20px;
  height: 20px;
}

/* Theme Toggle Icons */
.icon-sun { display: none; }
.icon-moon { display: block; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Hamburger Menu Toggle */
.menu-toggle {
  display: none;
}

.hamburger-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18px;
}

.hamburger-line {
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
  width: 100%;
}

/* Mobile Drawer & Backdrop */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--bg-backdrop);
  backdrop-filter: blur(4px);
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  display: none;
  transition: opacity var(--transition-normal);
}

.mobile-nav-backdrop.active {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(85vw, 320px);
  height: 100vh;
  background-color: var(--bg-card);
  border-left: 1px solid var(--border-color);
  z-index: 1002;
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}

.mobile-nav-drawer.active {
  display: flex;
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mobile-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mobile-nav-link {
  display: block;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-main);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background-color: var(--primary-tint);
  color: var(--primary);
}

.mobile-drawer-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   5. TOOL HERO SECTION
   -------------------------------------------------------------------------- */
.tool-hero-section {
  position: relative;
  padding: 3.5rem 0 2.5rem 0;
  background: radial-gradient(circle at 50% 0%, var(--primary-tint) 0%, transparent 70%);
  text-align: center;
  overflow: hidden;
}

.hero-bg-accent {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.45;
  z-index: 0;
}

.hero-bg-accent-left {
  width: 320px;
  height: 320px;
  top: -40px;
  left: -60px;
  background: radial-gradient(circle, var(--primary), transparent 70%);
}

.hero-bg-accent-right {
  width: 300px;
  height: 300px;
  top: 20px;
  right: -50px;
  background: radial-gradient(circle, var(--secondary), transparent 70%);
}

.tool-hero-container {
  position: relative;
  z-index: 1;
  max-width: 780px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 1.25rem;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.tool-hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

.tool-hero-description {
  font-size: 1.12rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.privacy-trust-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-full);
}

.trust-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   6. TOOL WORKSPACE & UPLOAD ZONE
   -------------------------------------------------------------------------- */
.tool-workspace-section {
  padding: 1rem 0 4.5rem 0;
}

.workspace-container {
  max-width: 1240px;
}

/* Card base */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Initial Upload Dropzone */
.upload-card {
  max-width: 800px;
  margin: 0 auto;
}

.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  background-color: var(--bg-card);
  padding: 4.5rem 2rem;
  text-align: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-tint);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.dropzone-icon-box {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem auto;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.dropzone:hover .dropzone-icon-box {
  transform: scale(1.08);
}

.dropzone-icon-box svg {
  width: 36px;
  height: 36px;
}

.dropzone-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.dropzone-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.dropzone-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  font-size: 0.82rem;
  color: var(--text-subtle);
}

.meta-pill {
  background-color: var(--bg-card-alt);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.meta-dot {
  color: var(--text-subtle);
}

.alert-error {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 0.85rem 1.25rem;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   7. ACTIVE EDITOR WORKSPACE
   -------------------------------------------------------------------------- */
.editor-view {
  animation: fadeIn 0.3s ease;
}

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

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.editor-file-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.file-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
}

.file-icon svg {
  width: 20px;
  height: 20px;
}

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

/* Editor Grid: 2 columns on desktop */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  align-items: start;
}

.editor-left-col,
.editor-right-col {
  min-width: 0;
  width: 100%;
}

.card-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  background-color: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  border: 1px solid var(--primary-border);
}

.card-helper-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   8. CROP VIEWPORT & CANVAS CONTROLS (LEFT COLUMN)
   -------------------------------------------------------------------------- */
.crop-viewport {
  position: relative;
  width: 100%;
  height: 420px;
  background-color: #0b0f19;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.crop-viewport:active {
  cursor: grabbing;
}

.crop-canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

/* Crop Frame Overlay */
.crop-frame-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.crop-box {
  position: relative;
  border: 2px solid #ffffff;
  border-radius: 4px;
  /* Dim outer area using enormous box shadow */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65), 0 0 12px rgba(0, 0, 0, 0.6);
  transition: width var(--transition-fast), height var(--transition-fast);
}

/* Thirds Alignment Grid inside crop box */
.crop-grid-line {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.line-h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.line-h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.line-v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.line-v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

/* Subtle oval facial positioning guide */
.face-guide-hint {
  position: absolute;
  top: 15%;
  left: 20%;
  right: 20%;
  height: 65%;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  pointer-events: none;
}

/* Canvas Bottom Controls */
.canvas-controls-box {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.zoom-row {
  background-color: var(--bg-card-alt);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.icon-tool-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

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

.range-slider {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--border-color);
  outline: none;
  accent-color: var(--primary);
  cursor: pointer;
}

.zoom-percent-badge {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 44px;
  text-align: right;
  color: var(--text-secondary);
}

.control-row-buttons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.control-row-buttons .btn {
  flex: 1;
  min-width: 110px;
}

/* --------------------------------------------------------------------------
   9. SETTINGS CARDS (RIGHT COLUMN)
   -------------------------------------------------------------------------- */
.editor-right-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-card {
  padding: 1.35rem;
}

/* Section 1: Presets Grid */
.preset-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.65rem 0.85rem;
  background-color: var(--bg-card-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

.preset-btn.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.preset-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

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

.preset-btn.active .preset-name {
  color: var(--primary);
}

/* Custom Size Inputs */
.custom-size-box {
  margin-top: 0.85rem;
  padding: 0.85rem;
  background-color: var(--bg-card-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  animation: fadeIn 0.2s ease;
}

.input-inline-group {
  display: flex;
  gap: 0.75rem;
}

.input-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field input,
.select-field {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast);
}

.input-field input:focus,
.select-field:focus {
  border-color: var(--primary);
}

/* Section 2: Background Swatches */
.bg-options-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}

.bg-swatch-btn,
.bg-custom-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background-color: var(--bg-card-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bg-swatch-btn:hover,
.bg-custom-wrapper:hover {
  border-color: var(--primary);
}

.bg-swatch-btn.active,
.bg-custom-wrapper.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.swatch-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.swatch-white { background-color: #ffffff; }
.swatch-blue { background-color: #e0f2fe; }
.swatch-gray { background-color: #f3f4f6; }

.swatch-custom {
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-picker-icon {
  width: 12px;
  height: 12px;
  color: #ffffff;
  display: none;
}

.swatch-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.bg-custom-wrapper input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Section 3: Print Settings Grid */
.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Stepper Control */
.stepper-control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stepper-btn {
  width: 34px;
  height: 36px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stepper-btn:hover {
  background-color: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary);
}

.stepper-input {
  width: 50px;
  height: 36px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
}

.stepper-input::-webkit-inner-spin-button,
.stepper-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Suffix number input */
.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field-num {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
}

.input-suffix {
  position: absolute;
  right: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.segment-btn {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.25rem;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

/* Toggles */
.toggle-group-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.toggle-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  width: 38px;
  height: 22px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle-checkbox:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-checkbox:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.toggle-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Section 4: Live Sheet Preview Canvas */
.sheet-stats-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-card-alt);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.sheet-preview-wrapper {
  position: relative;
  width: 100%;
  max-height: 480px;
  margin: 1rem 0;
  background-color: #0d1322;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sheet-canvas {
  max-width: 100%;
  max-height: 440px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  display: block;
}

.tool-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* --------------------------------------------------------------------------
   10. SEO CONTENT & EDITORIAL SECTION
   -------------------------------------------------------------------------- */
.seo-content-section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--border-color);
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem auto;
}

.section-badge {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

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

.seo-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  margin-bottom: 3.5rem;
  box-shadow: var(--shadow-sm);
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.seo-feature-item {
  display: flex;
  flex-direction: column;
}

.seo-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.seo-icon-box svg {
  width: 22px;
  height: 22px;
}

.seo-feature-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.seo-feature-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Steps Workflow Grid */
.how-to-section {
  margin-bottom: 3.5rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
}

.step-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.step-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-border);
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
}

.step-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.step-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* FAQ Accordion */
.faq-accordion {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.accordion-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.accordion-item.active {
  border-color: var(--primary-border);
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: none;
}

.accordion-trigger:hover {
  color: var(--primary);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

.accordion-panel {
  padding: 0 1.5rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border-light);
}

.accordion-content {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-top: 0.85rem;
}

/* --------------------------------------------------------------------------
   11. SITE FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 4.5rem 0 2rem 0;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.footer-logo {
  margin-bottom: 1rem;
}

.footer-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  max-width: 320px;
}

.footer-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

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

.sep {
  color: var(--border-color);
}

/* --------------------------------------------------------------------------
   12. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
/* Tablet & Smaller (<= 1024px) */
@media (max-width: 1024px) {
  .desktop-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-col-brand {
    grid-column: span 3;
  }
}

/* Mobile & Portrait (<= 768px) */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .card {
    padding: 1.15rem;
  }

  .control-row-buttons {
    flex-direction: column;
  }

  .control-row-buttons .btn {
    width: 100%;
    min-width: 0;
  }

  .control-row.zoom-row {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .input-inline-group {
    flex-direction: column;
  }

  .tool-hero-title {
    font-size: 1.85rem;
  }

  .tool-hero-description {
    font-size: 0.98rem;
  }

  .dropzone {
    padding: 3rem 1.25rem;
  }

  .crop-viewport {
    height: 340px;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .tool-actions-grid {
    grid-template-columns: 1fr;
  }

  .seo-grid {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .preset-buttons-grid {
    grid-template-columns: 1fr;
  }

  .control-row-buttons {
    flex-direction: column;
  }

  .control-row-buttons .btn {
    width: 100%;
  }

  .input-inline-group {
    flex-direction: column;
  }
}

/* --------------------------------------------------------------------------
   13. PRINT MEDIA STYLESHEET
   -------------------------------------------------------------------------- */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .site-header,
  .tool-hero-section,
  .editor-topbar,
  .editor-left-col,
  .settings-card:not(:last-child),
  .card-header-flex,
  .tool-actions-grid,
  .seo-content-section,
  .site-footer,
  .mobile-nav-backdrop,
  .mobile-nav-drawer {
    display: none !important;
  }

  .tool-workspace-section,
  .container,
  .workspace-container,
  .editor-view,
  .editor-grid,
  .editor-right-col,
  .settings-card:last-child,
  .sheet-preview-wrapper {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    max-height: none !important;
    width: 100% !important;
  }

  .sheet-canvas {
    width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  @page {
    margin: 0;
    size: auto;
  }
}
