/* ==========================================================================
   AI Background & Watermark Studio Pro - Main Design System
   ========================================================================== */

/* Design Tokens & Variables */
:root {
  --font-family-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-family-display: 'Outfit', sans-serif;

  /* Color Palette - Premium Multi-Tone Theme */
  --bg-darkest: #FAFAFC;
  --bg-darker: #ffffff;
  --bg-dark: #F3F0F8;
  --bg-panel: rgba(255, 255, 255, 0.75);
  --bg-main: var(--bg-darkest);

  --primary: #6D28D9;
  --primary-hover: #5B21B6;
  --primary-glow: rgba(124, 58, 237, 0.15);
  --accent-primary: var(--primary);

  --accent: #7C3AED;
  --accent-hover: #6D28D9;

  --teal: #0891B2;
  --teal-hover: #0E7490;
  --teal-glow: rgba(8, 145, 178, 0.15);

  --rose: #EC4899;
  --rose-hover: #DB2777;
  --rose-glow: rgba(236, 72, 153, 0.15);

  --gold-start: #fbbf24;
  --gold-end: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.15);

  --success: #10b981;
  --success-hover: #059669;
  --success-glow: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;

  --text-primary: #18131F;
  --text-secondary: #4A4455;
  --text-muted: #7b7487;
  --text: var(--text-primary);

  --border-light: rgba(24, 19, 31, 0.08);
  --border-primary: rgba(124, 58, 237, 0.15);
  --border-gold: rgba(245, 158, 11, 0.2);

  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --border-radius-xl: 28px;
  --border-radius-full: 9999px;

  /* Layered shadow scale */
  --shadow-xs: 0 1px 2px rgba(24, 19, 31, 0.04);
  --shadow-sm: 0 2px 6px rgba(24, 19, 31, 0.05), 0 1px 2px rgba(24, 19, 31, 0.04);
  --shadow-md: 0 8px 24px rgba(24, 19, 31, 0.08), 0 2px 6px rgba(24, 19, 31, 0.05);
  --shadow-lg: 0 16px 40px rgba(24, 19, 31, 0.12), 0 4px 12px rgba(24, 19, 31, 0.06);
  --shadow-glow-primary: 0 0 32px rgba(124, 58, 237, 0.25);
  --shadow-glow-gold: 0 0 28px rgba(245, 158, 11, 0.3);
  --shadow-glow-success: 0 0 28px rgba(16, 185, 129, 0.25);

  /* Stitch reference elevations (premium, neutral-tinted) */
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-high: 0 12px 40px rgba(0, 0, 0, 0.08);

  --box-shadow-glass: var(--shadow-sm);
  --box-shadow-glow: var(--shadow-glow-primary);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-bg-subtle: rgba(255, 255, 255, 0.55);
  --glass-border: 1px solid rgba(255, 255, 255, 0.5);
  --glass-border-soft: 1px solid rgba(255, 255, 255, 0.35);
  --glass-blur: blur(16px);
  --glass-blur-lg: blur(24px);

  /* Signature gradients */
  --gradient-primary: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 45%, #EC4899 100%);
  --gradient-brand: linear-gradient(135deg, #630ed4 0%, #b4136d 100%);
  --gradient-gold: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
  --gradient-mesh: radial-gradient(ellipse 900px 500px at 8% -8%, rgba(124, 58, 237, 0.07), transparent 60%),
    radial-gradient(ellipse 800px 500px at 100% 0%, rgba(8, 145, 178, 0.06), transparent 55%),
    radial-gradient(ellipse 700px 600px at 50% 100%, rgba(236, 72, 153, 0.04), transparent 60%);

  --ring-focus: 0 0 0 3px rgba(124, 58, 237, 0.18);

  /* Motion */
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
}

/* Reset & Basic Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-darkest);
  background-image:
    radial-gradient(ellipse 900px 500px at 8% -8%, rgba(124, 58, 237, 0.06), transparent 60%),
    radial-gradient(ellipse 800px 500px at 100% 0%, rgba(8, 145, 178, 0.05), transparent 55%),
    radial-gradient(ellipse 700px 600px at 50% 100%, rgba(236, 72, 153, 0.03), transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Animations */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.2); }
  50% { box-shadow: 0 0 25px rgba(99, 102, 241, 0.45); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.animate-pulse {
  animation: pulseGlow 2s infinite ease-in-out;
}

.animate-scale-up {
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Top navbar desktop links (Tailwind's `hidden md:flex` gets clobbered by
   the !important .hidden rule above, so this group uses its own class). */
.nav-links-desktop {
  display: none;
}
@media (min-width: 768px) {
  .nav-links-desktop {
    display: flex;
  }
}

.flex-1 {
  flex: 1;
}

.btn-full {
  width: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darkest);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-dark);
  border-radius: var(--border-radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */
.app-header {
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.03);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--box-shadow-glow);
}

.logo-text h1 {
  font-size: 1.25rem;
  line-height: 1.1;
}

.logo-text h1 span {
  background: linear-gradient(135deg, #a5b4fc 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

/* Subscription Badges */
.sub-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--border-radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.free-badge {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.free-badge i {
  color: var(--text-muted);
}

.pro-badge-active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-start);
  border: 1px solid var(--border-gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
  animation: pulseGlow 3s infinite;
}

.pro-badge-active i {
  color: var(--gold-start);
}

/* Buttons */
.btn {
  font-family: var(--font-family-sans);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 18px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--duration-base) var(--ease-premium);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-primary);
  background-size: 160% 160%;
  background-position: 0% 50%;
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background-position: 100% 50%;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

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

.btn-premium {
  background: var(--gradient-gold);
  color: #1a1300;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-premium:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.45);
}

.btn-large {
  padding: 14px 24px;
  font-size: 1rem;
}

.btn-icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--border-radius-md);
  background-color: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-icon-only:hover {
  background-color: var(--bg-dark);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-icon-only.active {
  background: var(--gradient-primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-icon-text {
  padding: 8px 12px;
  font-size: 0.8rem;
  background-color: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

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

.btn-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background-color: var(--danger);
  color: white;
  transform: translateY(-1px);
}

/* ==========================================================================
   App Container & Workspace States
   ========================================================================== */
.app-container {
  flex: 1;
  display: flex;
  position: relative;
  width: 100%;
}

/* !important: these elements also carry literal Tailwind "flex" utility
   classes for their own internal layout, and the Tailwind CDN's injected
   stylesheet can load after this one — without !important that utility
   class wins the specificity tie and both screens stay visible at once. */
.workspace-section {
  display: none !important;
  width: 100%;
}

.workspace-section.active {
  display: flex !important;
}

/* ==========================================================================
   Upload Landing Screen
   ========================================================================== */
#uploadLanding {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.upload-card {
  position: relative;
  background-color: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  max-width: 680px;
  width: 100%;
  box-shadow: var(--box-shadow-glass);
}

.upload-glow {
  position: absolute;
  top: -10%;
  left: 20%;
  right: 20%;
  bottom: 80%;
  background: radial-gradient(circle, var(--primary-glow) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(40px);
  z-index: -1;
  pointer-events: none;
}

.upload-area {
  border: 2px dashed transparent;
  background-color: transparent;
  border-radius: var(--border-radius-md);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-area.dragover {
  border-color: var(--primary);
  background-color: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Landing Dynamic Hero Graphic */
.landing-hero-graphic {
  width: 130px;
  height: 130px;
  margin-bottom: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.03), 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: all 0.3s ease;
}

.landing-hero-graphic::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(45deg, rgba(0,0,0,0.08) 25%, transparent 25%), 
                    linear-gradient(-45deg, rgba(0,0,0,0.08) 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.08) 75%), 
                    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.08) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
  opacity: 0.12;
}

.graphic-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  z-index: 2;
  position: relative;
  transition: all 0.3s ease;
}

.graphic-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--border-radius-full);
  box-shadow: var(--box-shadow-glow);
  z-index: 3;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Custom badges per mode */
.landing-hero-graphic.wm-remover-mode .graphic-badge {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
}

.landing-hero-graphic.wm-maker-mode .graphic-badge {
  background: var(--success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.upload-area h2 {
  font-size: 1.8rem;
  margin-bottom: 6px;
  font-family: var(--font-family-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.upload-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem !important;
  margin-bottom: 8px !important;
  font-weight: 500;
}

/* Upload Button CTA */
.btn-upload-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  font-family: var(--font-family-sans);
  font-size: 1.15rem !important;
  font-weight: 600 !important;
  padding: 14px 38px !important;
  border-radius: var(--border-radius-full) !important;
  border: none !important;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  margin: 16px 0 8px 0 !important;
}

.btn-upload-cta:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 0 14px 30px -4px rgba(37, 99, 235, 0.5) !important;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
}

.btn-upload-cta i {
  font-size: 1.25rem;
}

.upload-drop-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upload-limits {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.75;
}

/* Sample Images Section */
.sample-images-section {
  margin-top: 28px;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  text-align: center;
}

.sample-images-section h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}

.sample-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.sample-item {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sample-item img {
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  border: 2px solid var(--border-light) !important;
  object-fit: cover !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.2s ease !important;
}

.sample-item:hover img {
  transform: scale(1.08) translateY(-2px);
  border-color: var(--primary) !important;
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.3) !important;
}

.sample-item span {
  display: none !important;
}

/* ==========================================================================
   Editor Workspace (Floating Panel Layout)
   ========================================================================== */
/* Note: #editorWorkspace visibility/layout is driven entirely by the generic
   .workspace-section / .workspace-section.active rules + Tailwind utility
   classes on the element itself, not a dedicated grid layout — the tool
   panels float via position:absolute rather than living in a sidebar column. */

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  padding-left: 2px;
}

/* Bottom floating pill toolbar icon buttons */
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background-color: var(--bg-dark);
  color: var(--primary);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: var(--shadow-glow-primary);
}

.back-to-upload-btn {
  margin-top: auto;
}

/* ==========================================================================
   Center Panel - Canvas / Studio Window
   ========================================================================== */
.canvas-box {
  position: relative;
}

/* Canvas transparent pattern background */
.checkerboard-bg {
  background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%), 
                    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #e2e8f0 75%), 
                    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%) !important;
  background-size: 20px 20px !important;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px !important;
  background-color: transparent !important;
}

.canvas-bg-pattern {
  background-color: #f8fafc;
  background-image: radial-gradient(#DCD5EA 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
}

.workspace-view {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.workspace-view.active {
  display: flex;
}

/* Loading status screen */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.spinner-box {
  position: relative;
  width: 80px;
  height: 80px;
}

.double-spinner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--primary);
  border-bottom-color: var(--accent);
  animation: spin 1s linear infinite;
}

#processingStatus {
  font-size: 1.3rem;
}

#processingProgress {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 250px;
  text-align: center;
}

.progress-bar-container {
  width: 200px;
  height: 6px;
  background-color: rgba(255,255,255,0.1);
  border-radius: var(--border-radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--border-radius-full);
  transition: width 0.3s ease;
}

/* ==========================================================================
   AI Processing Overlay — animated gradient + starfield ("AI is thinking")
   Shown on the canvas during background removal / watermark AI actions.
   ========================================================================== */
.ai-processing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.ai-processing-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.ai-processing-overlay.hidden {
  display: none;
}

.ai-processing-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, #6D28D9 0%, #EC4899 33%, #3B82F6 66%, #6D28D9 100%);
  background-size: 300% 300%;
  animation: aiGradientShift 18s ease-in-out infinite;
  /* Semi-transparent so the image being processed stays visible underneath */
  opacity: 0.55;
}

@keyframes aiGradientShift {
  0%   { background-position: 0% 50%; }
  33%  { background-position: 100% 50%; }
  66%  { background-position: 50% 100%; }
  100% { background-position: 0% 50%; }
}

.ai-processing-starfield {
  position: absolute;
  inset: 0;
  opacity: 0.6;
}

.ai-star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.85);
  opacity: 0;
  animation: aiTwinkle var(--t, 3s) ease-in-out var(--d, 0s) infinite;
}

@keyframes aiTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50%      { opacity: 1; transform: scale(1.3); }
}

.ai-processing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 30px;
  border-radius: var(--border-radius-lg);
  background: rgba(24, 19, 31, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
}

.ai-processing-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  animation: aiBadgePulse 2.4s ease-in-out infinite;
}

.ai-processing-badge .material-symbols-outlined {
  color: #ffffff;
  font-size: 22px;
}

@keyframes aiBadgePulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.15); opacity: 1; }
}

.ai-processing-content h3 {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .ai-processing-gradient,
  .ai-star,
  .ai-processing-badge {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* --- View 1: BG Remover Slider --- */
/* --- View 1: BG Remover Preview Layout --- */
.preview-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.preview-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.preview-image-wrapper img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.preview-image-wrapper .canvas-bg-pattern {
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
}

#bgRemoverCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Tabs to switch between Original and Removed Background */
.view-toggle-tabs {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  background-color: var(--bg-darker);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-full);
  padding: 4px;
  gap: 4px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: var(--border-radius-full);
  font-family: var(--font-family-sans);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.editor-canvas-wrapper .view-toggle-tabs {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin-bottom: 8px;
  box-shadow: none;
}

/* --- View 2 & 3: Canvas Layers for Watermark tool --- */
.editor-canvas-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  position: relative;
}

.canvas-layers {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  transform-origin: center center;
}

/* Align canvases exactly */
#wmRemoverBaseCanvas {
  display: block;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
}

#wmRemoverBrushCanvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
}

/* Floating Eraser Panel docked on the LEFT */
.floating-eraser-panel {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 250px;
  /* Same background as the canvas/workspace (.bg-dotted-grid in index.html):
     identical color, dot-grid pattern and fixed viewport attachment so the
     panel blends into the canvas behind it with no visible seam. */
  background-color: #FAFAFC;
  background-image:
      radial-gradient(ellipse 900px 500px at 8% -8%, rgba(124, 58, 237, 0.07), transparent 60%),
      radial-gradient(ellipse 800px 500px at 100% 0%, rgba(8, 145, 178, 0.06), transparent 55%),
      radial-gradient(ellipse 700px 600px at 50% 100%, rgba(236, 72, 153, 0.04), transparent 60%),
      radial-gradient(#DCD5EA 1.5px, transparent 1.5px);
  background-size: auto, auto, auto, 22px 22px;
  background-position: 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed, fixed, fixed, fixed;
  border-radius: var(--border-radius-lg);
  border: var(--glass-border);
  box-shadow: var(--shadow-high);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  z-index: 50;
  color: var(--text);
}

/* ---- Stitch hover expand/collapse for the right-hand Export panel ----
   The panel is shown/hidden by ui-panels.js toggling `.hidden`. When it
   becomes visible we run a scale/opacity expand-in; ui-panels.js also adds
   `.is-collapsing` for a brief fade-out before it re-hides. All export
   *logic* (btnDownloadImage, quick sizes) stays in app.js/ui-panels.js. */
#exportPanel {
  transform-origin: top right;
}
#exportPanel:not(.hidden) {
  animation: exportPanelExpandIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#exportPanel.is-collapsing {
  animation: exportPanelCollapseOut 0.22s ease forwards;
  pointer-events: none;
}
@keyframes exportPanelExpandIn {
  from { opacity: 0; transform: scale(0.95) translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes exportPanelCollapseOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: scale(0.96) translateY(-4px); }
}

/* ---- Left-panel hover expand/collapse (mirrors the Export panel hover
   pattern above): the active tool panel (Background Eraser / Watermark
   Remover / Watermark Maker) collapses to just its icon+title header when
   the pointer isn't nearby, and expands into the full panel on hover, using
   the same expand animation/timing as #exportPanel. Panel switching
   (.active, driven by app.js) and every control inside is untouched --
   ui-panels.js only adds/removes `.is-panel-collapsed`. */
#config-bg-remover.active,
#config-wm-remover.active,
#config-wm-maker.active {
  transform-origin: top left;
}
#config-bg-remover.active:not(.is-panel-collapsed),
#config-wm-remover.active:not(.is-panel-collapsed),
#config-wm-maker.active:not(.is-panel-collapsed) {
  animation: exportPanelExpandIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#config-bg-remover.active.is-panel-collapsed,
#config-wm-remover.active.is-panel-collapsed,
#config-wm-maker.active.is-panel-collapsed {
  width: auto;
  gap: 0;
  cursor: pointer;
}
#config-bg-remover.active.is-panel-collapsed > *:not(.panel-drag-handle),
#config-wm-remover.active.is-panel-collapsed > *:not(.panel-drag-handle),
#config-wm-maker.active.is-panel-collapsed > *:not(.panel-drag-handle) {
  display: none;
}
#config-bg-remover.active.is-panel-collapsed .panel-drag-handle,
#config-wm-remover.active.is-panel-collapsed .panel-drag-handle,
#config-wm-maker.active.is-panel-collapsed .panel-drag-handle {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.panel-drag-handle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
  cursor: grab;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  user-select: none;
}
.panel-drag-handle:active {
  cursor: grabbing;
}
.panel-drag-handle i {
  font-size: 0.9rem;
}

/* Export panel: scrollable settings area + a footer (Pro upsell + Export Now)
   that's always visible without scrolling, so the primary CTA can never end
   up clipped past the viewport edge or hidden behind the zoom dock. */
.export-panel-scroll {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px;
}

.export-panel-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-light);
}

/* Sits inside a flex column that already has `gap`, so the divider only
   needs to draw the rule itself, not add its own stacked margin on top. */
.export-panel-scroll .sidebar-divider {
  margin: 0;
}

.floating-eraser-panel .view-toggle-tabs {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  display: flex;
  width: 100%;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 3px;
  box-shadow: none;
}

.floating-eraser-panel .view-toggle-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.floating-eraser-panel .view-toggle-btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.floating-eraser-panel .btn-icon-text {
  background-color: var(--bg-main);
  color: var(--text);
  border: 1px solid var(--border-light);
  justify-content: flex-start;
  transition: all 0.2s ease;
}

.floating-eraser-panel .btn-icon-text:hover {
  background-color: #e2e8f0;
}

.brush-slider-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
}

.brush-slider-group label {
  white-space: nowrap;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.brush-slider-group span {
  font-weight: 700;
  color: var(--text);
  width: auto;
}

.brush-btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* Watermark Maker Canvas */
#wmMakerCanvas {
  display: block;
  max-width: 100%;
  max-height: 70vh;
}

/* ==========================================================================
   Right Sidebar - Tool Settings & Downloads
   ========================================================================== */
.sidebar-right {
  background-color: var(--bg-darker);
  border-left: 1px solid var(--border-light);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-config-section {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.sidebar-config-section.active {
  display: flex;
}

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

.config-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.label-with-value span {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  background-color: var(--bg-dark);
  padding: 2px 6px;
  border-radius: 4px;
}

.config-instructions {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background-color: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-light);
  padding: 12px;
  border-radius: var(--border-radius-md);
}

.config-instructions b {
  color: var(--primary);
}

/* Text Inputs / Selects */
.text-input, .select-input {
  width: 100%;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-family-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

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

/* Color Picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-swatch-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-light);
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
  width: 100%;
  cursor: pointer;
}

.color-swatch-picker input[type="color"],
.color-picker-row input[type="color"] {
  border: none;
  background: none;
  width: 32px;
  height: 32px;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
}

.color-swatch-picker span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Color Presets Grid */
.color-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.color-preset {
  width: 100%;
  padding-bottom: 100%;
  border-radius: var(--border-radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.color-preset:hover {
  transform: scale(1.1);
}

.color-preset.active {
  border-color: white;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* Backdrop Image presets */
.backdrop-presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.backdrop-preset {
  background-color: var(--bg-darkest);
  border: 2px solid transparent;
  border-radius: var(--border-radius-sm);
  padding: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.backdrop-preset img {
  width: 100%;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.backdrop-preset span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.backdrop-preset:hover {
  border-color: var(--primary-glow);
}

.backdrop-preset.active {
  border-color: var(--primary);
  background-color: rgba(99, 102, 241, 0.05);
}

.backdrop-preset.active span {
  color: white;
}

/* Toggle Buttons Button Group */
.toggle-btn-group {
  display: flex;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 4px;
  gap: 4px;
}

.btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  flex: 1;
  padding: 8px 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-family-sans);
  text-align: center;
  transition: all 0.2s ease;
}

.btn-toggle:hover {
  color: var(--primary);
  background-color: rgba(124, 58, 237, 0.06);
}

.btn-toggle.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* Sub configurations panel */
.config-sub-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: rgba(30, 41, 59, 0.25);
  border: 1px solid var(--border-light);
  padding: 16px;
  border-radius: var(--border-radius-md);
}

/* Image Watermark Logo preview */
.wm-logo-preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  margin-top: 12px;
}

.wm-logo-preview-box img {
  height: 36px;
  max-width: 120px;
  object-fit: contain;
}

/* Sliders */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--border-radius-full);
  background: var(--bg-darkest);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #818cf8;
}

/* Quick export size-preset buttons */
.quick-size-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.quick-size-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-family: var(--font-family-sans);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.quick-size-btn span:first-child {
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-size-btn span:last-child {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.quick-size-btn:hover {
  border-color: var(--primary);
  background-color: rgba(124, 58, 237, 0.06);
  transform: translateY(-1px) scale(1.02);
  box-shadow: var(--shadow-soft);
}

.quick-size-btn:hover span:first-child {
  color: var(--primary);
}

/* Selected size (Stitch highlighted-card look). Applied by ui-panels.js
   as a cosmetic marker only -- the real export dimensions still flow
   through resolutionPreset/customWidth/customHeight in app.js. */
.quick-size-btn.is-selected {
  border: 2px solid rgba(124, 58, 237, 0.5);
  background-color: rgba(124, 58, 237, 0.12);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.15);
}

.quick-size-btn.is-selected span:first-child {
  color: var(--primary);
}

/* Premium Export CTAs use the Stitch brand gradient (id selectors so we
   override the Tailwind utility classes without editing markup/logic). */
#btnDownloadImage.btn-primary {
  background: var(--gradient-brand);
  box-shadow: var(--shadow-high);
}
#btnDownloadImage.btn-primary:hover {
  filter: brightness(1.08);
}
#btnOpenExportPanel {
  background: var(--gradient-brand);
  color: #fff;
}

/* Divider */
.sidebar-divider {
  border: 0;
  height: 1px;
  background: var(--border-light);
  margin: 24px 0;
}

/* Resolution custom row */
.custom-res-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-darkest);
  border: 1px solid var(--border-light);
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
}

.input-unit {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.input-unit span {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

.res-num-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  font-size: 0.95rem;
  font-weight: 700;
  outline: none;
}

/* Pro Banner Ad */
.pro-ad-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
  border: 1px dashed var(--border-gold);
  border-radius: var(--border-radius-md);
  padding: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pro-ad-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.03) 0%, rgba(245, 158, 11, 0) 60%);
  pointer-events: none;
}

.pro-ad-banner .pro-badge {
  background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
  color: black;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--border-radius-full);
  display: inline-block;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.pro-ad-banner p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.pro-ad-banner p strong {
  color: white;
}

/* ==========================================================================
   Checkout Modal Dialog Layout
   ========================================================================== */
dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  outline: none;
}

/* Backdrop Blur styling */
dialog::backdrop {
  background-color: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-card {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border: var(--glass-border);
  border-radius: var(--border-radius-xl);
  width: 440px;
  max-width: 90vw;
  padding: 40px 36px 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background-color: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-base) var(--ease-premium);
  z-index: 1;
}

.modal-close-btn:hover {
  background-color: var(--bg-dark);
  border-color: var(--primary);
  color: var(--primary);
  transform: rotate(90deg);
}

.modal-header {
  text-align: center;
  margin-bottom: 28px;
}

.crown-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-gold);
  color: #1a1300;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 16px auto;
  box-shadow: var(--shadow-glow-gold);
}

.modal-price {
  font-family: var(--font-family-display);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-price span {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 8px;
}

/* Checkout Form elements */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-form-stripe {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-column-row {
  display: flex;
  gap: 16px;
}

.form-row label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.input-icon-box {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
}

.icon-padding {
  padding-left: 40px !important;
}

.checkout-features {
  background: rgba(124, 58, 237, 0.04);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 20px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.feature-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--success-glow);
  color: var(--success);
  font-size: 0.6rem;
}

.secure-checkout-text {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Success payment screen */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 0;
}

.success-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.success-screen h2 {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.success-screen p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
}

/* Responsive CSS (Tablet & Mobile) */
@media (max-width: 1024px) {
  .back-to-upload-btn span {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Global mobile body constraints to prevent horizontal overflow */
  body {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  /* Responsive App Header */
  .app-header {
    flex-direction: column !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    align-items: stretch !important;
    text-align: center !important;
    position: relative !important;
  }
  
  .header-logo {
    justify-content: center !important;
    margin-bottom: 0 !important;
  }

  .header-logo h1 {
    font-size: 1.1rem !important;
  }

  .header-logo p {
    font-size: 0.65rem !important;
  }

  .logo-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .logo-icon i {
    font-size: 0.85rem !important;
  }
  
  .header-nav-modes {
    display: flex !important;
    justify-content: center !important;
    gap: 4px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 4px !important;
  }
  
  .nav-mode-btn {
    flex: 1 !important;
    padding: 6px 12px !important;
    font-size: 0.72rem !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }
  
  .header-actions {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: auto !important;
    gap: 0 !important;
    display: flex !important;
    align-items: center !important;
  }
  
  .sub-badge {
    display: none !important;
  }
  
  .btn-premium {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%) !important;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3) !important;
    color: white !important;
  }

  .btn-premium span {
    display: none !important;
  }

  .btn-premium i {
    font-size: 0.85rem !important;
    margin: 0 !important;
  }

  #headerManageBtn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #headerManageBtn span {
    display: none !important;
  }

  #headerManageBtn i {
    font-size: 0.85rem !important;
    margin: 0 !important;
  }

  /* Responsive Upload Landing Screen */
  #uploadLanding, #pdfToolsLanding {
    padding: 16px 12px !important;
  }

  .upload-card {
    padding: 20px 16px !important;
  }

  .upload-area {
    padding: 36px 16px !important;
  }

  .upload-area h2 {
    font-size: 1.25rem !important;
  }

  .upload-area p {
    font-size: 0.8rem !important;
  }

  .sample-grid {
    gap: 8px !important;
  }

  .sample-item {
    padding: 6px !important;
    gap: 6px !important;
  }

  .sample-item img {
    height: 70px !important;
  }

  .sample-item span {
    font-size: 0.7rem !important;
  }

  /* Allow editing page to scroll normally on small screens/laptops */
  body:has(#editorWorkspace.active), body:has(#pdfEditorWorkspace.active) {
    overflow: auto !important;
    position: relative !important;
    width: 100% !important;
  }

  body:has(#editorWorkspace.active) .app-container, body:has(#pdfEditorWorkspace.active) .app-container {
    min-height: calc(100vh - 90px) !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Prevent standard touch panning/scrolling on canvas and comparison slider */
  canvas, .canvas-layers, .paint-canvas, #wmComparisonSlider {
    touch-action: none !important;
  }

  #editorWorkspace, #pdfEditorWorkspace {
    display: none !important;
  }

  #editorWorkspace.active, #pdfEditorWorkspace.active {
    min-height: calc(100vh - 90px) !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  .sidebar-left {
    border-right: none !important;
    border-bottom: 1px solid var(--border-light) !important;
    flex-direction: row !important;
    padding: 8px 12px !important;
    height: auto !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  
  .tool-tabs {
    flex-direction: row !important;
    width: auto !important;
    flex: 1 !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin: 0 !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    scrollbar-width: none !important;
  }
  
  .tool-tabs::-webkit-scrollbar {
    display: none !important;
  }
  
  .tab-btn {
    padding: 8px 12px !important;
    font-size: 0.75rem !important;
    flex: 0 0 auto !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    margin: 0 !important;
  }
  
  .tab-btn i {
    font-size: 0.95rem !important;
    margin: 0 !important;
  }
  
  .tab-btn span {
    display: inline !important;
  }
  
  .back-to-upload-btn, .back-to-pdf-hub-btn, #btnAddPdfFile {
    margin: 0 !important;
    padding: 8px !important;
    width: 38px !important;
    height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--border-radius-full) !important;
    flex-shrink: 0 !important;
  }
  
  .back-to-upload-btn span, .back-to-pdf-hub-btn span, #btnAddPdfFile span {
    display: none !important;
  }
  
  .back-to-upload-btn i, .back-to-pdf-hub-btn i, #btnAddPdfFile i {
    margin: 0 !important;
    font-size: 1rem !important;
  }

  /* Center Workspace Panel */
  .canvas-workspace {
    padding: 8px !important;
    min-height: 0 !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .workspace-view {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .workspace-view.active {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box !important;
  }
  
  .canvas-box {
    width: 100% !important;
    height: 50vh !important;
    flex: none !important;
    min-height: 350px !important;
    padding: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    border-radius: var(--border-radius-md) !important;
  }
  
  /* Watermark eraser workspace view — flex column to fit canvas + toolbar */
  #view-wm-remover.workspace-view.active {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden !important;
    height: 100% !important;
  }
  
  /* Editor canvas wrapper — shrinks to leave room for brush bar */
  .editor-canvas-wrapper {
    flex: 1 !important;
    height: 100% !important;
    max-height: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    position: relative !important;
  }
  
  /* Canvas layers container — constrained to parent */
  #view-wm-remover .canvas-layers {
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: visible !important;
  }
  
  /* Floating Eraser Panel on mobile — keep it floating overlaying canvas, but more compact */
  .floating-eraser-panel {
    position: absolute !important;
    left: 8px !important;
    top: 8px !important;
    width: 180px !important;
    padding: 10px !important;
    gap: 8px !important;
    border-radius: var(--border-radius-md) !important;
    z-index: 110 !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 4px 20px rgba(24, 19, 31, 0.12) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }
  
  .panel-drag-handle {
    font-size: 0.75rem !important;
    padding-bottom: 6px !important;
  }
  
  .floating-eraser-panel .view-toggle-tabs {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    display: flex !important;
    width: 100% !important;
    margin-bottom: 0 !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: var(--border-radius-md) !important;
    padding: 2px !important;
    box-shadow: none !important;
  }
  
  .floating-eraser-panel .view-toggle-btn {
    flex: 1 !important;
    padding: 4px 6px !important;
    font-size: 0.68rem !important;
    border-radius: var(--border-radius-sm) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: none !important;
    cursor: pointer !important;
  }
  
  .floating-eraser-panel .view-toggle-btn.active {
    background-color: var(--primary) !important;
    color: white !important;
  }
  
  .floating-eraser-panel .view-toggle-btn span {
    display: none !important; /* Hide text on mobile tabs to save horizontal space, only show icon */
  }
  
  .floating-eraser-panel .brush-slider-group {
    font-size: 0.68rem !important;
    gap: 4px !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  .floating-eraser-panel .brush-btn-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
  }
  
  .floating-eraser-panel .brush-btn-group .btn {
    padding: 6px 10px !important;
    font-size: 0.7rem !important;
    border-radius: var(--border-radius-sm) !important;
    width: 100% !important;
    flex: none !important;
  }
  
  #undoBrush span, #clearBrush span {
    display: none !important;
  }

  .brush-actions {
    display: flex !important;
    gap: 6px !important;
  }
  
  .brush-actions .btn {
    padding: 6px 12px !important;
    font-size: 0.72rem !important;
    border-radius: var(--border-radius-full) !important;
  }

  /* Configuration Sidebar Right Panel -> Bottom Sheet */
  .sidebar-right {
    border-left: none !important;
    border-top: 1px solid var(--border-light) !important;
    max-height: 240px !important;
    height: auto !important;
    width: 100% !important;
    background-color: var(--bg-darker) !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    z-index: 5 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .sidebar-config-section {
    padding: 0 !important;
    margin: 0 !important;
    display: none !important;
  }

  .sidebar-config-section.active {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .sidebar-right .sidebar-title, .sidebar-config-section .sidebar-title {
    font-size: 0.85rem !important;
    margin-bottom: 4px !important;
    display: block !important;
    font-family: var(--font-family-display) !important;
    font-weight: 700 !important;
  }

  .config-group {
    margin-bottom: 4px !important;
  }

  .config-group label {
    font-size: 0.75rem !important;
    margin-bottom: 4px !important;
  }

  .toggle-btn-group {
    gap: 4px !important;
  }

  .btn-toggle {
    padding: 6px 10px !important;
    font-size: 0.72rem !important;
    border-radius: var(--border-radius-sm) !important;
    flex: 1 !important;
    text-align: center !important;
  }

  .btn-full {
    padding: 10px 16px !important;
    font-size: 0.8rem !important;
    width: 100% !important;
  }
  
  .color-presets-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 6px !important;
  }

  /* PDF pages grid scrollable in canvas workspace */
  .pdf-pages-viewport {
    height: 100% !important;
    overflow-y: auto !important;
  }

  .pdf-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  /* Hide the configuration sidebar completely on mobile when Watermark Eraser is active to maximize canvas space */
  .sidebar-right:has(#config-wm-remover.active) {
    display: none !important;
  }
}

/* ==========================================================================
   Google AdSense Banner Placeholders
   ========================================================================== */
.adsense-slot {
  background: rgba(15, 23, 42, 0.25);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.03);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ad-label {
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 0.55rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.6;
  pointer-events: none;
}

.ad-mock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 10px 16px;
  opacity: 0.75;
}

.ad-mock i {
  font-size: 1.1rem;
  color: var(--primary);
  opacity: 0.8;
}

/* Horizontal Slot (Landing bottom) */
.ads-horizontal {
  width: 100%;
  max-width: 680px;
  height: 60px;
  margin: 32px auto 0 auto;
}

/* Sidebar Slot (Right Sidebar bottom) */
.ads-sidebar {
  width: 100%;
  height: 60px;
  margin-top: auto;
  padding: 10px;
}

/* ==========================================================================
   Landing Page Tabs Selection
   ========================================================================== */
.landing-tabs {
  display: flex;
  background: #f1f5f9; /* Explicit light grey container */
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--border-radius-full);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03), var(--box-shadow-glass);
}

.landing-tab-btn {
  background: transparent;
  border: none;
  color: #334155; /* High contrast dark slate */
  padding: 10px 20px;
  border-radius: var(--border-radius-full);
  font-family: var(--font-family-sans);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.landing-tab-btn:hover {
  color: var(--primary); /* Hover shows brand primary */
  background: rgba(79, 70, 229, 0.05);
}

.landing-tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Tool Picker Cards (upload screen) */
.tool-card {
  --tool-accent: var(--primary);
  --tool-accent-glow: var(--primary-glow);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  white-space: normal;
  gap: 6px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 2px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: all var(--duration-base) var(--ease-premium);
  box-shadow: var(--shadow-sm);
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--tool-accent-glow) 0%, transparent 65%);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-premium);
  pointer-events: none;
}

.tool-card:hover {
  border-color: var(--tool-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card:hover .tool-card-icon {
  transform: scale(1.08);
}

.tool-card.active {
  background: var(--glass-bg-strong);
  color: var(--text-primary);
  border-color: var(--tool-accent);
  box-shadow: 0 0 0 1px var(--tool-accent) inset, 0 16px 36px -12px var(--tool-accent-glow), var(--shadow-md);
}

.tool-card.active::before {
  opacity: 1;
}

.tool-card[data-landing-tab="wm-remover"] {
  --tool-accent: var(--rose);
  --tool-accent-glow: var(--rose-glow);
}

.tool-card[data-landing-tab="wm-maker"] {
  --tool-accent: var(--success);
  --tool-accent-glow: var(--success-glow);
}

.tool-card-icon {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-md);
  background: var(--tool-accent-glow);
  color: var(--tool-accent);
  font-size: 24px;
  margin-bottom: 4px;
  transition: transform var(--duration-base) var(--ease-premium);
}

.tool-card-name {
  position: relative;
  z-index: 1;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.tool-card-desc {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Responsive Ads & Landing Tabs Behavior */
@media (max-width: 768px) {
  .ads-horizontal {
    height: 60px;
    max-width: 100%;
    margin-top: 24px;
  }
  
  .ads-sidebar {
    height: 60px;
    margin-top: 16px;
  }

  .landing-tabs {
    border-radius: var(--border-radius-md);
    flex-direction: column;
    width: 100%;
    padding: 6px;
    gap: 6px;
  }

  .landing-tab-btn {
    width: 100%;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    padding: 12px;
  }
}

/* ==========================================================================
   Recent Images History Bar
   ========================================================================== */
.history-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
}

.history-bar.hidden {
  display: none !important;
}

.history-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.history-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--border-light);
  background-color: var(--bg-darkest);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.history-item:hover, .history-item.active {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.history-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Light transparent pattern for history item thumbnail */
.history-item-bg {
  width: 100%;
  height: 100%;
  background-image: linear-gradient(45deg, #e2e8f0 25%, transparent 25%), 
                    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), 
                    linear-gradient(45deg, transparent 75%, #e2e8f0 75%), 
                    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
  background-color: #ffffff;
}

/* ==========================================================================
   PDF Page Selector Modal Styling
   ========================================================================== */
#pdfPageModal .modal-header .crown-icon {
  margin: 0 auto 16px auto;
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

#pdfPageModal .pdf-page-selector-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 24px 0;
}

#pdfPageModal span {
  font-size: 1.35rem;
  font-weight: 700;
  min-width: 90px;
  text-align: center;
  font-family: var(--font-family-display);
  color: var(--text-primary);
}

/* ==========================================================================
   PDF Tools Hub Navigation & Modes
   ========================================================================== */
.header-nav-modes {
  display: flex;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-full);
  padding: 3px;
  gap: 2px;
  margin: 0 20px;
}

.nav-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: var(--border-radius-full);
  font-family: var(--font-family-display);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-mode-btn:hover {
  color: var(--primary);
  background-color: rgba(79, 70, 229, 0.05);
}

.nav-mode-btn.active {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
}

/* ==========================================================================
   PDF Tools Landing Page Grid
   ========================================================================== */
#pdfToolsLanding {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  display: none; /* Hidden by default */
}

#pdfToolsLanding.active {
  display: flex;
}

.pdf-landing-container {
  max-width: 1000px;
  width: 100%;
}

.pdf-landing-header {
  text-align: center;
  margin-bottom: 40px;
}

.pdf-landing-header h2 {
  font-size: 2.2rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.pdf-landing-header p {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.pdf-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.pdf-tool-card {
  background-color: var(--bg-darker);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 28px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--box-shadow-glass);
}

.pdf-tool-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-hover);
  box-shadow: 0 12px 24px -10px rgba(79, 70, 229, 0.12);
}

.pdf-tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.pdf-tool-card h3 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.pdf-tool-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   PDF Editor Preview Workspace
   ========================================================================== */
#pdfEditorWorkspace {
  display: none;
}

#pdfEditorWorkspace.active {
  display: flex;
}

.pdf-pages-viewport {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  padding: 10px;
}

.pdf-page-card {
  position: relative;
  background-color: var(--bg-darkest);
  border: 2px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: grab;
  transition: all 0.2s ease;
  overflow: hidden;
  user-select: none;
}

.pdf-page-card.dragging {
  opacity: 0.5;
  border-style: dashed;
  border-color: var(--primary);
}

.pdf-page-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.pdf-page-card canvas {
  width: 100%;
  max-width: 110px;
  height: auto;
  aspect-ratio: 1 / 1.414;
  object-fit: contain;
  background-color: white;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
}

.pdf-page-card .page-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Card hover operations icons (rotate & delete) */
.pdf-page-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-5px);
  transition: all 0.2s ease;
}

.pdf-page-card:hover .pdf-page-actions {
  opacity: 1;
  transform: translateY(0);
}

.pdf-page-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  background-color: white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
}

.pdf-page-action-btn.rotate-btn {
  color: var(--primary);
}

.pdf-page-action-btn.delete-btn {
  color: var(--danger);
}

.pdf-page-action-btn:hover {
  transform: scale(1.1);
  background-color: var(--bg-dark);
}

/* --- Watermark Eraser: Comparison Slider & Toggle Switches --- */
.comparison-slider-bar {
  transition: box-shadow 0.2s ease;
}
.comparison-slider-bar:hover {
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 10px rgba(0, 0, 0, 0.5);
}

.comparison-slider-handle {
  transition: transform 0.15s ease, background-color 0.2s ease;
}
.comparison-slider-handle:hover {
  transform: translate(-50%, -50%) scale(1.15);
  background-color: var(--text-bright) !important;
}

/* iOS Switch Styling */
.switch-ios {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-ios input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-ios {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  border: 1px solid var(--border-light);
}

.slider-ios:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch-ios input:checked + .slider-ios {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.switch-ios input:checked + .slider-ios:before {
  transform: translateX(20px);
}

/* Sidebar upgrades layout tweaks */
#config-wm-remover .btn-toggle {
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
#config-wm-remover .btn-toggle.active {
  background: var(--accent-primary) !important;
  color: var(--text-bright) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
#config-wm-remover .btn-toggle:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-bright);
}

/* ==========================================================================
   FAQ Accordion Section
   ========================================================================== */
.faq-section {
  width: 100%;
  max-width: 680px;
  margin: 60px auto 40px auto;
  padding: 0 10px;
  box-sizing: border-box;
}

.faq-title {
  font-family: var(--font-family-display);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--primary);
}

.faq-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-darker);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--box-shadow-glass);
}

.faq-item[open] {
  border-color: rgba(79, 70, 229, 0.2);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.05);
}

.faq-item summary {
  padding: 18px 20px;
  font-family: var(--font-family-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background-color 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  background-color: rgba(79, 70, 229, 0.02);
}

.faq-item summary .faq-toggle-icon {
  font-size: 0.95rem;
  color: var(--primary);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item[open] summary .faq-toggle-icon {
  transform: rotate(180deg);
}

.faq-content {
  padding: 0 20px 18px 20px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .faq-section {
    margin: 40px auto 20px auto;
  }
  .faq-title {
    font-size: 1.6rem;
  }
  .faq-item summary {
    padding: 14px 16px;
    font-size: 0.95rem;
  }
  .faq-content {
    padding: 0 16px 14px 16px;
    font-size: 0.9rem;
  }
}

/* Left Sidebar Ad Slot (Desktop only) */
.ads-left-sidebar {
  display: none !important;
}

@media (min-width: 1025px) {
  .ads-left-sidebar {
    display: flex !important;
    width: 100%;
    height: 100px;
    margin: 20px 0;
    padding: 10px;
  }
}

/* Landing Page Side Ads Columns Layout */
.landing-main-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.landing-ads-column {
  display: none !important;
}

.ads-vertical-sidebar {
  width: 160px;
  height: 300px;
}

@media (min-width: 1025px) {
  .landing-main-layout {
    flex-direction: row !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 32px !important;
    width: 100% !important;
    max-width: 1100px !important;
    margin: 0 auto !important;
  }

  .landing-ads-column {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 160px !important;
    flex-shrink: 0 !important;
    margin-top: 40px !important; /* Push down to align with card */
  }
}

/* ==========================================================================
   Authentication & Credit Purchase Styles
   ========================================================================== */
.auth-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.auth-tab-btn {
  flex: 1;
  padding: 10px;
  font-family: var(--font-family-display);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: var(--gradient-primary) !important;
  color: white !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.auth-tab-btn:not(.active):hover {
  background: var(--bg-dark);
  color: var(--text-primary);
  border-color: var(--border-light);
}

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

.auth-error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  background-color: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--border-radius-sm);
  transition: all 0.2s ease;
}

.auth-divider {
  margin: 20px 0;
  text-align: center;
  position: relative;
}

.auth-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--border-light);
  z-index: 1;
}

.auth-divider span {
  position: relative;
  background: var(--bg-darker);
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  z-index: 2;
}

.verification-banner {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  background: rgba(79, 70, 229, 0.06);
  border: 1px dashed var(--primary);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.4;
}

.verification-banner i {
  color: var(--primary);
  font-size: 1.1rem;
  margin-top: 2px;
}

/* Buy Credits Modal Sizing */
.credit-pack-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 16px;
  border: 2px solid var(--primary);
  border-radius: var(--border-radius-md);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.07), rgba(236, 72, 153, 0.04));
  gap: 16px;
  margin-top: 14px;
  transition: all var(--duration-base) var(--ease-premium);
  box-shadow: 0 8px 20px -10px rgba(124, 58, 237, 0.3);
}

.credit-pack-option::after {
  content: 'Best Value';
  position: absolute;
  top: -11px;
  right: 16px;
  background: var(--gradient-gold);
  color: #1a1300;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--border-radius-full);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.credit-pack-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -10px rgba(124, 58, 237, 0.4);
}

.credit-payg-option {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.5);
  gap: 12px;
  transition: all var(--duration-base) var(--ease-premium);
}

.credit-payg-option:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.quantity-picker button {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  font-size: 1.2rem;
  font-weight: bold;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quantity-picker input {
  width: 60px;
  text-align: center;
  height: 36px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-light);
  font-weight: bold;
  background: var(--bg-darker);
  color: var(--text-primary);
  padding: 0;
  outline: none;
}

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

/* --- Zoom & Pan Toolbar Styles --- */
.zoom-toolbar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 8px 16px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

.zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.zoom-btn:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.zoom-btn.active {
  background: var(--bg-main) !important;
  color: var(--primary) !important;
}

.zoom-level {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  min-width: 48px;
  text-align: center;
}

/* Ensure comparison images and slider handle pan & zoom transform correctly */
.canvas-layers {
  transform-origin: center center;
  transition: transform 0.05s ease-out; /* Smooth panning/zooming */
}

/* ==========================================================================
   Home Hub — redesigned landing (Stitch reference)
   The 3 AI tool cards reuse the existing .tool-card styling; this block adds
   the hero, layout scaffold, PDF Hub bento grid, footer, and the dot canvas.
   ========================================================================== */
#uploadLanding.hub-landing {
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
  background: transparent; /* let the dot canvas + body background show */
}

/* Mouse-reactive dot grid. Fixed + child of #uploadLanding, so it auto-hides
   when the editor view is shown (parent becomes display:none). */
.hub-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.hub-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Hero */
.hub-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0 4px;
}
.hub-hero-title {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  max-width: 740px;
}
.hub-gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hub-hero-sub {
  max-width: 620px;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Sections */
.hub-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hub-section-title {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text-primary);
}

/* Two-screen flow: make [hidden] win over any flex/display the hub sets. */
#hubLauncher[hidden],
.hub-upload-wrap[hidden] { display: none !important; }

/* Secondary per-tool upload screen */
.hub-upload-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.hub-back-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 8px 12px;
  border-radius: var(--border-radius-full);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.hub-back-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

/* Upload card (wraps the preserved dropzone + CTA) */
.hub-upload-card {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border: var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 28px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

/* PDF Hub bento */
.hub-pdf {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border: var(--glass-border);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.hub-pdf-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--text-primary);
}
.hub-pdf-head-title .material-symbols-outlined { color: var(--rose); font-size: 28px; }
.hub-pdf-head-sub { color: var(--text-secondary); margin-top: 4px; font-size: 0.95rem; }

.hub-pdf-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
}
@media (min-width: 640px)  { .hub-pdf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .hub-pdf-grid { grid-template-columns: repeat(4, 1fr); } }

.pdf-cat { display: flex; flex-direction: column; gap: 10px; }
.pdf-cat-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pdf-cat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.pdf-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--duration-base) var(--ease-premium);
}
.pdf-tile:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.pdf-tile-ic { font-size: 20px; color: var(--text-muted); transition: color 0.18s ease, transform var(--duration-base) var(--ease-premium); }
.pdf-tile:hover .pdf-tile-ic { color: var(--primary); transform: scale(1.08); }
.pdf-tile-label { line-height: 1.2; }

/* Footer */
.hub-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 24px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.hub-footer-brand { display: flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 700; }
.hub-footer-links { display: flex; gap: 20px; }
.hub-footer a { color: var(--text-muted); text-decoration: none; transition: color 0.18s ease; }
.hub-footer a:hover { color: var(--primary); }

@media (max-width: 640px) {
  .hub-wrap { padding: 20px 16px 80px; gap: 28px; }
  .hub-footer { justify-content: center; text-align: center; }
}

/* ---- FAQ accordion (glass cards, matches hub styling) ---------------- */
.hub-faq {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.hub-faq-head { text-align: center; }
.hub-faq-head .hub-section-title { font-size: 1.75rem; }
.hub-faq-sub { color: var(--text-secondary); margin-top: 8px; font-size: 1.05rem; }

.hub-faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.faq-item {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: 16px; /* rounded-2xl */
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform 0.3s var(--ease-premium, ease), box-shadow 0.3s ease, border-color 0.3s ease;
}
.faq-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-high);
  border-color: rgba(255, 255, 255, 0.8);
}
.faq-item.open {
  border-color: rgba(124, 58, 237, 0.35);
}

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.faq-question-text {
  font-family: var(--font-family-display);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 0;
  transition: color 0.2s ease;
}
.faq-item.open .faq-question-text,
.faq-q:hover .faq-question-text { color: var(--primary); }

.faq-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.3s var(--ease-premium, ease), color 0.2s ease;
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Smooth height + opacity expand/collapse via animatable grid rows. */
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.32s var(--ease-premium, ease), opacity 0.32s ease;
}
.faq-item.open .faq-a {
  grid-template-rows: 1fr;
  opacity: 1;
}
.faq-a-clip { overflow: hidden; min-height: 0; }
.faq-answer-text {
  margin: 0;
  padding: 0 24px 20px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .faq-a { transition: opacity 0.2s ease; }
  .faq-item, .faq-chevron { transition: none; }
}


