/* ==========================================================================
   Canvallo Studio - Core Design System & Creative Workspace CSS
   ========================================================================== */

:root {
  --bg-darkest: #0e0f12;
  --bg-app: #141518;
  --bg-panel: #1a1b1f;
  --bg-card: #23252b;
  --bg-input: #121316;
  --bg-hover: #2d3039;
  --bg-active: #373b46;

  --border-subtle: #25272e;
  --border-main: #2f323c;
  --border-focus: #8b5cf6;

  --accent-primary: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;

  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --shadow-panel: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-handle: 0 2px 6px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-darkest);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Custom Dark Theme Scrollbars (Theme-matched)
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-main) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2f323c;
  border-radius: 9999px;
  transition: background 0.15s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Enhanced scrollbar hover in layers & inspector */
.stacked-section-body::-webkit-scrollbar-thumb,
.layer-list-container::-webkit-scrollbar-thumb,
.tab-content::-webkit-scrollbar-thumb,
.code-editor-area::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: #2a2d36;
}

.stacked-section-body::-webkit-scrollbar-thumb:hover,
.layer-list-container::-webkit-scrollbar-thumb:hover,
.tab-content::-webkit-scrollbar-thumb:hover,
.code-editor-area::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* App Layout Grid (Top Bar 50px | Doc Tabs 34px | Workspace 1fr | Status Bar 30px) */
#app-container {
  display: grid;
  grid-template-rows: 50px 34px 1fr 30px;
  grid-template-columns: 56px 1fr 340px;
  height: 100vh;
  width: 100vw;
}

/* ==========================================================================
   Canvallo Entry Splash Screen (2-Second Auto-Close)
   ========================================================================== */
.canvallo-splash-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background: radial-gradient(circle at center, #161826 0%, #090a10 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.canvallo-splash-screen.splash-fading {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.canvallo-splash-screen.splash-hidden {
  display: none !important;
}

.splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 48px;
  animation: splashCardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes splashCardEnter {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.splash-logo-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.splash-logo-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  z-index: 2;
  filter: drop-shadow(0 8px 24px rgba(139, 92, 246, 0.55));
  animation: splashLogoFloat 2s ease-in-out infinite alternate;
}

@keyframes splashLogoFloat {
  0% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(-4px) scale(1.03);
  }
}

.splash-logo-glow {
  position: absolute;
  inset: -16px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, rgba(236, 72, 153, 0.15) 50%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
  filter: blur(12px);
  animation: splashGlowPulse 2s ease-in-out infinite alternate;
}

@keyframes splashGlowPulse {
  0% {
    opacity: 0.6;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.splash-brand-text {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.splash-brand-title {
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #ffffff;
  background: linear-gradient(135deg, #ffffff 30%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.splash-brand-badge {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.45);
  color: #c4b5fd;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.splash-tagline {
  font-size: 13px;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 28px;
}

.splash-progress-track {
  width: 220px;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.splash-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899, #06b6d4);
  border-radius: 999px;
  animation: splashFill 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes splashFill {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
#top-bar {
  grid-column: 1 / -1;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

/* ==========================================================================
   Document Tab Strip (Multi-Document Management)
   ========================================================================== */
#doc-tab-strip {
  grid-column: 1 / -1;
  background-color: #101114;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  overflow-x: auto;
  z-index: 95;
}

.doc-tabs-container {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  max-width: 240px;
  height: 28px;
  transition: all 0.12s ease;
  user-select: none;
}

.doc-tab:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.doc-tab.active {
  background: var(--bg-card);
  color: #ffffff;
  border-color: var(--border-main);
  border-top: 2px solid var(--accent-primary);
  font-weight: 600;
}

.doc-tab-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-tab-action,
.doc-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 11px;
  padding: 0;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.doc-tab-action:hover,
.doc-tab-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.doc-tab-actions-group {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.btn-new-tab {
  height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-new-tab:hover {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: #ffffff;
}

.new-canvas-preset.active {
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.15);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  padding: 3px 8px 3px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.brand-logo-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(139, 92, 246, 0.3);
}

.brand-logo-circle-white {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 10px rgba(139, 92, 246, 0.35);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.brand-logo-btn:hover .brand-logo-circle-white {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 18px rgba(139, 92, 246, 0.7);
}

.brand-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.badge-features-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.48);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.badge-features-pill .guide-question-icon {
  flex-shrink: 0;
  color: #c4b5fd;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.badge-features-pill .guide-pill-label {
  line-height: 1;
  font-size: 11px;
}

.brand-logo-btn:hover .badge-features-pill {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.65);
  transform: translateY(-1px);
}

.brand-logo-btn:hover .badge-features-pill .guide-question-icon {
  color: #ffffff;
  transform: scale(1.18) rotate(10deg);
}

.brand-icon {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-pink) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

.badge-format {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.doc-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  width: 260px;
  transition: all 0.15s ease;
}

.doc-title-input:hover {
  background: var(--bg-card);
  border-color: var(--border-main);
}

.doc-title-input:focus {
  background: var(--bg-input);
  border-color: var(--accent-primary);
  outline: none;
}

.header-center-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 3px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

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

/* Button & Tool Styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-main);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.btn:active {
  background: var(--bg-active);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-ai {
  background: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 15px rgba(147, 51, 234, 0.4);
}

.btn-icon {
  padding: 6px 8px;
  min-width: 30px;
  justify-content: center;
}

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

/* ==========================================================================
   Export Dropdown Menu
   ========================================================================== */
.export-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.btn-export-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-export-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.dropdown-chevron {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.export-dropdown-wrapper.open .dropdown-chevron {
  transform: rotate(180deg);
}

.export-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 290px;
  background: #18191f;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.15);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 3px;
  z-index: 1000;
  animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.export-dropdown-wrapper.open .export-dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.14);
  color: #ffffff;
}

.dropdown-item:hover .dropdown-item-title {
  color: var(--accent-primary);
}

.dropdown-item-icon {
  font-size: 16px;
  margin-top: 1px;
  flex-shrink: 0;
}

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

.dropdown-item-title {
  font-size: 12px;
  font-weight: 600;
  color: #f3f4f6;
  transition: color 0.12s ease;
}

.dropdown-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.dropdown-separator {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* ==========================================================================
   Left Toolbar
   ========================================================================== */
#left-toolbar {
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 8px 0;
  gap: 6px;
  z-index: 90;
  height: 100%;
  box-sizing: border-box;
}

/* Webcross Limited Brand Button in Circle on White Background */
.left-toolbar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px 0;
  width: 100%;
}

.webcross-brand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  outline: none;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.webcross-circle-white {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.25);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, filter 0.28s ease;
  flex-shrink: 0;
  padding: 3px;
  box-sizing: border-box;
}

.webcross-circle-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.webcross-brand-btn:hover .webcross-circle-white {
  transform: scale(1.12) rotate(10deg);
  background: #ffffff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.65), 0 0 18px rgba(139, 92, 246, 0.7), 0 0 0 2px rgba(139, 92, 246, 0.45);
}

.webcross-brand-btn:active .webcross-circle-white {
  transform: scale(0.95);
}

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

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

.tool-btn.active {
  background: var(--bg-card);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.tool-shortcut {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-muted);
}

.tool-divider {
  width: 28px;
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

/* ==========================================================================
   Center Viewport & Artboard
   ========================================================================== */
#canvas-viewport {
  position: relative;
  background-color: var(--bg-darkest);
  overflow: hidden;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Photoshop grid / checkerboard backdrop */
  background-image: 
    radial-gradient(circle, #22242c 1px, transparent 1px);
  background-size: 24px 24px;
}

#artboard-container {
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform-origin: 0 0;
  overflow: hidden;
  user-select: none;
}

/* Layer Elements inside Artboard */
.canvas-layer {
  position: absolute;
  box-sizing: border-box;
}

/* ==========================================================================
   Transformer Overlay & Bounding Box
   ========================================================================== */
.transformer-overlay {
  position: absolute;
  pointer-events: auto;
  cursor: move;
  background: rgba(37, 99, 235, 0.02);
  border: 2px solid #2563eb;
  /* High-contrast dual outline: visible against dark, white, and full-color graphics */
  box-shadow: 
    0 0 0 1px #ffffff,
    0 0 10px rgba(37, 99, 235, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  box-sizing: border-box;
  z-index: 9999;
}

.transformer-overlay.multi-selection-mode {
  border-color: #38bdf8;
  border-style: dashed;
  background: rgba(56, 189, 248, 0.04);
  box-shadow: 
    0 0 0 1px #ffffff,
    0 0 14px rgba(56, 189, 248, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.transformer-overlay.multi-selection-mode .rotate-connector-line,
.transformer-overlay.multi-selection-mode .handle-rotate {
  display: none !important;
}

/* Rubberband Marquee Selection Box on Canvas */
.canvas-selection-marquee {
  position: absolute;
  pointer-events: none;
  background: rgba(56, 189, 248, 0.12);
  border: 1.5px dashed #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  z-index: 10001;
  box-sizing: border-box;
  border-radius: 2px;
}

/* Highlight outlines on all selected layers on canvas */
.canvas-layer.layer-multi-selected {
  outline: 1.5px solid #38bdf8 !important;
  outline-offset: 1px;
}

.btn-autoselect {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-autoselect:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-autoselect.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.6);
  color: #60a5fa;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.25);
}

.btn-autoselect.off {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.btn-autoselect .autoselect-icon {
  font-size: 12px;
}

/* Alignment Grid Overlay on Artboard */
.artboard-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
  display: none;
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-image:
    linear-gradient(to right, rgba(99, 102, 241, 0.28) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.28) 1px, transparent 1px),
    linear-gradient(to right, rgba(99, 102, 241, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.08) 1px, transparent 1px);
}

.artboard-grid-overlay.active {
  display: block;
}

/* Smart Magnetic Snaplines (Guides) */
.canvas-snaplines-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10005;
}

.snap-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #ec4899;
  box-shadow: 0 0 6px rgba(236, 72, 153, 0.95), 0 0 1px #ffffff;
  pointer-events: none;
  z-index: 10005;
}

.snap-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #ec4899;
  box-shadow: 0 0 6px rgba(236, 72, 153, 0.95), 0 0 1px #ffffff;
  pointer-events: none;
  z-index: 10005;
}

.snap-badge {
  position: absolute;
  background: #ec4899;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), 0 0 2px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
  transform: translate(5px, 5px);
  z-index: 10006;
}

.transform-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.9);
  pointer-events: auto;
  transition: transform 0.1s ease, background 0.1s ease;
  z-index: 10000;
  box-sizing: border-box;
}

.transform-handle:hover {
  transform: scale(1.3);
  background: #2563eb;
  border-color: #ffffff;
}

/* Handle Positions (centered on 12px handles) */
.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-n  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-e  { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle-s  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-w  { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }

/* Rotation Handle */
.rotate-connector-line {
  position: absolute;
  top: -26px;
  left: 50%;
  width: 2px;
  height: 20px;
  background: #2563eb;
  box-shadow: 0 0 2px #ffffff;
  transform: translateX(-50%);
  pointer-events: none;
}

.handle-rotate {
  top: -34px;
  left: calc(50% - 7px);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  cursor: grab;
  z-index: 10001;
}

.handle-rotate:hover {
  transform: scale(1.25);
  background: #1d4ed8;
  border-color: #93c5fd;
}

/* Dimension Badge */
.dimension-badge {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
}

/* ==========================================================================
   Canvas Inline Text Editor
   ========================================================================== */
.canvas-inline-text-editor {
  border: 1.5px dashed var(--accent-primary) !important;
  background: rgba(139, 92, 246, 0.15) !important;
  outline: none !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.35) !important;
  border-radius: 4px;
  padding: 2px 4px;
  box-sizing: border-box;
  resize: none;
  overflow: visible;
  line-height: inherit;
  cursor: text !important;
}

/* ==========================================================================
   Right Sidebar (Properties, Layers, AI)
   ========================================================================== */
#right-sidebar {
  background-color: var(--bg-panel);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 90;
}

/* Sidebar Top Header & Mode Toggle */
.sidebar-top-header {
  padding: 7px 12px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-headline {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.sidebar-view-toggle {
  display: flex;
  background: var(--bg-card);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-toggle-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Stacked and Tabbed Sidebar Layout Constraints */
#stacked-sidebar-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

#stacked-sidebar-wrapper.stacked-active {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  height: calc(100% - 37px);
  overflow: hidden;
}

#stacked-sidebar-wrapper.tabbed-active {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  height: calc(100% - 74px);
  overflow: hidden;
}

.stacked-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#panel-properties-section {
  flex: 1 1 58%;
  min-height: 0;
  border-bottom: 2px solid var(--border-main);
  overflow: hidden;
}

#panel-layers-section {
  flex: 1 1 42%;
  min-height: 0;
  background: var(--bg-panel);
  overflow: hidden;
}

.stacked-section-header {
  padding: 7px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.stacked-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.2px;
}

.stacked-section-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
}

/* Tabbed Mode View Override */
#stacked-sidebar-wrapper.tabbed-active .stacked-section {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  border-bottom: none;
}

#stacked-sidebar-wrapper.tabbed-active #panel-properties-section {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  border-bottom: none;
}

#stacked-sidebar-wrapper.tabbed-active #panel-layers-section {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  border-bottom: none;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-app);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: #ffffff;
  border-bottom-color: var(--accent-primary);
  background: var(--bg-panel);
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: none;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   Advanced Color Studio Popover
   ========================================================================== */
.color-studio-popover {
  position: fixed;
  width: 320px;
  background: var(--bg-panel);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5000;
  animation: modalIn 0.15s ease-out;
}

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

.cs-modes {
  display: flex;
  background: var(--bg-input);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.cs-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cs-mode-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

.cs-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
}
.cs-close-btn:hover {
  color: #ffffff;
}

.cs-preview-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-preview-swatch {
  flex: 1;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-main);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.cs-eyedropper-btn {
  padding: 6px 10px;
  font-size: 11px;
}

.cs-subpanel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Gradient Ramp & Stop Pins */
.cs-ramp-section {
  background: var(--bg-card);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.cs-ramp-bar-wrap {
  position: relative;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
  border: 1px solid var(--border-main);
}

.cs-gradient-ramp {
  width: 100%;
  height: 100%;
}

.cs-stops-pins-container {
  position: relative;
  height: 20px;
  margin-top: 4px;
}

.cs-stop-pin {
  position: absolute;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  transform: translateX(-50%);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.6);
  transition: transform 0.12s ease;
}

.cs-stop-pin:hover {
  transform: translateX(-50%) scale(1.2);
}

.cs-stop-pin.active {
  transform: translateX(-50%) scale(1.3);
  border-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.cs-stop-editor-box {
  background: var(--bg-input);
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.cs-angle-presets {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.cs-dir-btn, .cs-radial-btn {
  flex: 1;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 4px 2px;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.cs-dir-btn:hover, .cs-radial-btn:hover {
  background: var(--bg-hover);
  color: #ffffff;
}

.cs-dir-btn.active, .cs-radial-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.cs-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.cs-palette-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
}

.cs-swatch-chip {
  height: 22px;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.cs-swatch-chip:hover {
  transform: scale(1.25);
  box-shadow: 0 0 6px rgba(255,255,255,0.4);
}

.cs-gradient-chips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cs-grad-chip {
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.12s ease;
}
.cs-grad-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* Swatch Trigger Buttons */
.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-main);
  background: var(--bg-input);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-swatch-inner {
  width: 100%;
  height: 100%;
  border-radius: 2px;
  display: block;
}

/* Advanced Effect Chips & Mini Sliders */
.preset-effect-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.effect-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}
.effect-chip:hover, .effect-chip.active {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.slider-control-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.slider-control-label {
  width: 65px;
  font-size: 10px;
  color: var(--text-muted);
}

.mini-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
}
.mini-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

.slider-control-val {
  width: 34px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  text-align: right;
}

/* Inspector Panels */
.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.inspector-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.input-field {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  gap: 6px;
  transition: border-color 0.15s ease;
}

.input-field:focus-within {
  border-color: var(--accent-primary);
}

.input-label {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
}

.input-field input,
.input-field select,
.input-field textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 12px;
  outline: none;
}

.input-field input[type="number"] {
  font-family: var(--font-mono);
}

.input-field select {
  cursor: pointer;
}

.input-field select option {
  background: var(--bg-card);
  color: var(--text-main);
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-main);
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
  overflow: hidden;
  background: none;
}

.color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch::-webkit-color-swatch {
  border: none;
}

/* Quick Align Bar */
.quick-align-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.align-btn {
  flex: 1;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ==========================================================================
   Layers Panel (Photoshop-like Tree)
   ========================================================================== */
.layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.layer-list-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  gap: 3px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  position: relative;
  scroll-behavior: smooth;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}

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

.layer-item.active {
  background: rgba(139, 92, 246, 0.28) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.5), inset 3px 0 0 var(--accent-primary) !important;
}

.layer-item.active .layer-title {
  color: #ffffff !important;
  font-weight: 600;
}

.layer-item.active .layer-type-badge {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
}

/* Group and Multi-Selection in Layers Panel */
/* Group and Multi-Selection in Layers Panel */
/* Group Folder and Nested Layers in Layers Panel */
.layer-group-folder {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: min-content;
  margin-bottom: 6px;
  margin-top: 3px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(59, 130, 246, 0.22);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease;
}

/* Distinct Heading Effect for Group */
.layer-group-header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 38px;
  gap: 7px;
  padding: 8px 10px;
  background: linear-gradient(90deg, #1e293b 0%, #151f30 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border-left: 3.5px solid #38bdf8;
  position: relative;
}

.layer-group-header:hover {
  background: linear-gradient(90deg, #253349 0%, #1a273b 100%);
  border-left-color: #60a5fa;
}

.layer-group-header.active {
  background: linear-gradient(90deg, rgba(30, 58, 110, 0.95) 0%, rgba(20, 40, 78, 0.95) 100%) !important;
  border-left: 3.5px solid #60a5fa !important;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.4), 0 0 12px rgba(59, 130, 246, 0.25) !important;
}

.layer-group-header.partially-active {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.9) 0%, rgba(20, 32, 48, 0.9) 100%);
  border-left: 3.5px solid #93c5fd;
}

.group-collapse-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 9px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.group-collapse-btn:hover {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(96, 165, 250, 0.4);
}

.group-collapse-btn .chevron-icon {
  display: inline-block;
  transition: transform 0.18s ease;
  line-height: 1;
}

.group-collapse-btn .chevron-icon.collapsed {
  transform: rotate(-90deg);
}

.group-heading-icon-badge {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.12);
}

.group-folder-svg {
  width: 13px;
  height: 13px;
  display: block;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.group-type-tag {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
  line-height: 1.1;
  flex-shrink: 0;
}

.group-name-text {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

.layer-group-header .layer-controls {
  margin-left: auto;
  opacity: 0.85;
}

.layer-group-header:hover .layer-controls {
  opacity: 1;
}

/* Indented Tree Structure for Group Children */
.layer-group-children {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 6px 6px 14px;
  border-left: 2px solid rgba(56, 189, 248, 0.3);
  margin-left: 15px;
  margin-top: 2px;
  margin-bottom: 4px;
  position: relative;
}

.layer-item.nested-layer-item {
  position: relative;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11.5px;
  transition: all 0.12s ease;
}

.layer-item.nested-layer-item::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 12px;
  height: 1.5px;
  background: rgba(56, 189, 248, 0.35);
  pointer-events: none;
}

.layer-item.nested-layer-item:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
}

.layer-item.nested-layer-item:hover::before {
  background: #38bdf8;
}

.layer-item.nested-layer-item.active {
  background: rgba(139, 92, 246, 0.32) !important;
  border-color: var(--accent-primary) !important;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.4);
}

.layer-item.nested-layer-item.active::before {
  background: var(--accent-primary);
}

/* Drag-over support for group header element */
.layer-group-header.drag-over-above {
  border-top: 2px solid #38bdf8 !important;
  box-shadow: 0 -4px 10px rgba(56, 189, 248, 0.5) !important;
  position: relative;
}

.layer-group-header.drag-over-above::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.layer-group-header.drag-over-below {
  border-bottom: 2px solid #38bdf8 !important;
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.5) !important;
  position: relative;
}

.layer-group-header.drag-over-below::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.layer-group-header.drag-over-group {
  background: rgba(59, 130, 246, 0.3) !important;
  border: 1.5px dashed #60a5fa !important;
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.5), inset 0 0 12px rgba(59, 130, 246, 0.25) !important;
  position: relative;
}

.layer-group-header.drag-over-group::after {
  content: "↳ Drop into Group";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9.5px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #60a5fa;
  padding: 2px 7px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Multi-Selection Action Toolbar */
.multi-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.4);
  font-size: 11px;
  color: #f8fafc;
}

.multi-selection-count {
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.multi-selection-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layer-item.highlight-pulse {
  animation: layerSelectPulse 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes layerSelectPulse {
  0% {
    transform: scale(0.97);
    background: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.7);
  }
  50% {
    transform: scale(1.02);
    background: rgba(139, 92, 246, 0.35);
  }
  100% {
    transform: scale(1);
    background: rgba(139, 92, 246, 0.28);
  }
}

/* Layer Drag and Drop & Group Reordering */
.layer-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  cursor: grab;
  opacity: 0.35;
  padding: 0 4px 0 0;
  transition: opacity 0.15s ease, color 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.layer-drag-handle:active {
  cursor: grabbing;
}

.layer-item:hover .layer-drag-handle {
  opacity: 0.9;
  color: #a855f7;
}

.layer-item[draggable="true"] {
  cursor: grab;
}

.layer-item[draggable="true"]:active {
  cursor: grabbing;
}

.layer-item.dragging {
  opacity: 0.35 !important;
  background: rgba(139, 92, 246, 0.15) !important;
  border: 1.5px dashed #8b5cf6 !important;
  transform: scale(0.98);
}

.layer-item.drag-over-above {
  border-top: 2px solid #38bdf8 !important;
  box-shadow: 0 -4px 10px rgba(56, 189, 248, 0.5) !important;
  position: relative;
}

.layer-item.drag-over-above::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.layer-item.drag-over-below {
  border-bottom: 2px solid #38bdf8 !important;
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.5) !important;
  position: relative;
}

.layer-item.drag-over-below::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.layer-item.drag-over-group {
  background: rgba(59, 130, 246, 0.3) !important;
  border: 1.5px dashed #60a5fa !important;
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.5), inset 0 0 12px rgba(59, 130, 246, 0.25) !important;
  position: relative;
}

.layer-item.drag-over-group::after {
  content: "↳ Drop into Group";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9.5px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #60a5fa;
  padding: 2px 7px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  animation: pulseGroupBadge 1s infinite alternate ease-in-out;
  z-index: 10;
}

@keyframes pulseGroupBadge {
  from { opacity: 0.9; transform: translateY(-50%) scale(0.97); }
  to { opacity: 1; transform: translateY(-50%) scale(1.04); }
}

.layer-item.locked {
  opacity: 0.65;
}

.layer-type-badge {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.layer-title {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.7;
}

.layer-item:hover .layer-controls {
  opacity: 1;
}

.layer-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-icon-btn:hover {
  color: var(--text-main);
  background: var(--bg-panel);
}

/* ==========================================================================
   Bottom Status Bar
   ========================================================================== */
#bottom-status-bar {
  grid-column: 1 / -1;
  background-color: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 100;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Modals & Popups
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20000 !important;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: var(--bg-panel);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
}

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

/* Custom App Dialog System (Prompt, Alert, Confirm) */
.app-dialog-backdrop {
  z-index: 30000 !important;
}

.app-dialog-window {
  max-width: 440px !important;
  border: 1px solid rgba(139, 92, 246, 0.45);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(124, 58, 237, 0.25);
  background: var(--bg-panel);
}

.app-dialog-body {
  padding: 18px 20px 14px 20px !important;
  gap: 12px !important;
}

.app-dialog-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.app-dialog-input-wrap {
  width: 100%;
}

.app-dialog-input {
  width: 100%;
  font-size: 13px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
  transition: all 0.15s ease;
}

.app-dialog-input:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.35);
  background: rgba(15, 23, 42, 0.95);
}

.btn-danger-confirm {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
}

.btn-danger-confirm:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.5) !important;
}

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

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-app);
}

.code-editor-area {
  width: 100%;
  height: 380px;
  background: var(--bg-darkest);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 12px;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

/* Prompt Card Presets */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preset-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-card:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.preset-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.preset-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: rgba(26, 27, 31, 0.95);
  border: 1px solid var(--accent-primary);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  animation: toastFade 0.2s ease;
}

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

/* ==========================================================================
   Custom Context Menu (Photoshop Studio Style)
   ========================================================================== */
.custom-context-menu {
  position: fixed;
  z-index: 20000 !important;
  min-width: 220px;
  max-width: 280px;
  background: rgba(18, 20, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 25px rgba(124, 58, 237, 0.2);
  backdrop-filter: blur(20px);
  padding: 5px;
  display: none;
  opacity: 0;
  pointer-events: none;
  flex-direction: column;
  gap: 2px;
  user-select: none;
  transition: opacity 0.08s ease;
}

.custom-context-menu.open {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  animation: contextMenuIn 0.1s ease-out;
}

@keyframes contextMenuIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.context-menu-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-pink);
  padding: 5px 10px 3px 10px;
  user-select: none;
}

.context-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
}

.context-menu-item:hover {
  background: var(--accent-primary);
  color: #ffffff;
}

.context-menu-item.active {
  background: rgba(124, 58, 237, 0.22);
  color: #c4b5fd;
  font-weight: 600;
}

.context-menu-item.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.context-menu-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.context-menu-icon {
  width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
}

.context-menu-item:hover .context-menu-icon {
  color: #ffffff;
}

.context-menu-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-menu-shortcut {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-left: 8px;
}

.context-menu-item:hover .context-menu-shortcut {
  color: rgba(255, 255, 255, 0.9);
}

/* Submenu Flyout System */
.context-menu-item.has-submenu {
  padding-right: 8px;
}

.context-menu-arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.1s ease, color 0.1s ease;
}

.context-menu-item:hover .context-menu-arrow {
  color: #ffffff;
  transform: translateX(2px);
}

.context-submenu {
  position: absolute;
  top: -4px;
  left: calc(100% + 4px);
  z-index: 20010 !important;
  min-width: 205px;
  max-width: 275px;
  background: rgba(18, 20, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 25px rgba(124, 58, 237, 0.2);
  backdrop-filter: blur(20px);
  padding: 5px;
  display: none;
  flex-direction: column;
  gap: 2px;
  user-select: none;
  pointer-events: auto;
}

.context-menu-item.has-submenu:hover > .context-submenu,
.context-menu-item.has-submenu.submenu-open > .context-submenu {
  display: flex !important;
  animation: contextMenuIn 0.1s ease-out;
}

.context-submenu.flip-left {
  left: auto !important;
  right: calc(100% + 4px) !important;
}

.context-submenu.flip-up {
  top: auto !important;
  bottom: -4px !important;
}

.context-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

/* ==========================================================================
   Background Eraser Studio Preview Box
   ========================================================================== */
.eraser-preview-box {
  width: 100%;
  height: 240px;
  background-color: #1a1c23;
  /* Photoshop transparency checkerboard pattern */
  background-image: 
    linear-gradient(45deg, #121316 25%, transparent 25%), 
    linear-gradient(-45deg, #121316 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #121316 75%), 
    linear-gradient(-45deg, transparent 75%, #121316 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: crosshair;
}

#eraser-preview-canvas {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}

/* ==========================================================================
   Image Size & Canvas Dimension Studio Modal
   ========================================================================== */
.resize-mode-switcher {
  display: flex;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.resize-tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.resize-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.resize-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.resize-info-pill {
  font-size: 11px;
  color: #c4b5fd;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  line-height: 1.45;
}

.dimension-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ratio-lock-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.btn-ratio-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  height: 42px;
  min-width: 68px;
  font-size: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-ratio-lock:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent-primary);
}

.btn-ratio-lock.active {
  background: rgba(124, 58, 237, 0.18);
  border-color: var(--accent-primary);
  color: #c4b5fd;
}

.ratio-lock-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Image Masking Studio & Shape Cutouts
   ========================================================================== */
.mask-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.mask-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.mask-chip:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-main);
}

.mask-chip.active {
  background: rgba(124, 58, 237, 0.22);
  border-color: var(--accent-primary);
  color: #c4b5fd;
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.4);
}

.mask-chip-icon {
  font-size: 15px;
  line-height: 1;
}

.mask-chip-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ==========================================================================
   Typography Studio & Motion Styles
   ========================================================================== */
.text-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 6px 0 10px 0;
}

.text-preset-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 3px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.text-preset-chip:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-main);
  transform: translateY(-1px);
}

.text-preset-chip.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(168, 85, 247, 0.32) 100%) !important;
  border-color: #a855f7 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.35) !important;
  transform: translateY(-1px);
  position: relative;
}

.text-preset-chip.active::after {
  content: "✓";
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 8px;
  font-weight: 900;
  color: #38bdf8;
  line-height: 1;
}

.text-preset-icon {
  font-size: 13px;
}

.text-preset-name {
  font-size: 8.5px;
  font-weight: 600;
  text-align: center;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.text-format-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-top: 6px;
}

.text-format-btn {
  flex: 1;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

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

.text-format-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

.text-gradient-row {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.text-gradient-swatch {
  flex: 0 0 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.text-gradient-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Kinetic Text Animations */
@keyframes text-anim-zoom-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes text-anim-pan-marquee {
  0% { transform: translateX(0%); }
  50% { transform: translateX(12%); }
  100% { transform: translateX(0%); }
}

@keyframes text-anim-wave-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}

@keyframes text-anim-shimmer {
  0% { filter: brightness(1) drop-shadow(0 0 0px transparent); }
  50% { filter: brightness(1.35) drop-shadow(0 0 14px currentColor); }
  100% { filter: brightness(1) drop-shadow(0 0 0px transparent); }
}

@keyframes text-anim-glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-3px, 1px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -1px); }
  80% { transform: translate(2px, 2px); }
}

@keyframes text-anim-typewriter {
  0%, 100% { border-right: 2px solid transparent; }
  50% { border-right: 2px solid currentColor; }
}

.anim-zoom-pulse {
  animation: text-anim-zoom-pulse var(--text-anim-dur, 2.5s) infinite ease-in-out !important;
}

.anim-pan-marquee {
  animation: text-anim-pan-marquee var(--text-anim-dur, 3s) infinite ease-in-out !important;
}

.anim-wave-bounce {
  animation: text-anim-wave-bounce var(--text-anim-dur, 2s) infinite ease-in-out !important;
}

.anim-shimmer {
  animation: text-anim-shimmer var(--text-anim-dur, 2.5s) infinite ease-in-out !important;
}

.anim-glitch {
  animation: text-anim-glitch var(--text-anim-dur, 1.6s) infinite steps(2) !important;
}

.anim-typewriter {
  animation: text-anim-typewriter 0.8s infinite !important;
}

@keyframes text-anim-neon-flicker {
  0%, 19.999%, 22%, 62.999%, 64%, 64.999%, 70%, 100% {
    opacity: 1;
    filter: brightness(1) drop-shadow(0 0 15px currentColor);
  }
  20%, 21.999%, 63%, 63.999%, 65%, 69.999% {
    opacity: 0.65;
    filter: brightness(0.6) drop-shadow(0 0 2px currentColor);
  }
}

@keyframes text-anim-float-bounce {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(-1deg); }
}

@keyframes text-anim-breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.06); filter: brightness(1.25); }
}

.anim-neon-flicker {
  animation: text-anim-neon-flicker var(--text-anim-dur, 2s) infinite !important;
}

.anim-float-bounce {
  animation: text-anim-float-bounce var(--text-anim-dur, 3s) infinite ease-in-out !important;
}

.anim-breathe {
  animation: text-anim-breathe var(--text-anim-dur, 2.5s) infinite ease-in-out !important;
}

.btn-anim-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-anim-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-anim-toggle.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
  border-color: #818cf8;
  color: #c7d2fe;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}

.text-warp-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  display: block;
}

/* ==========================================================================
   Shapes & Graphics Flyout Library
   ========================================================================== */
.shapes-flyout-panel {
  position: absolute;
  left: 56px;
  top: 48px;
  bottom: 0;
  width: 320px;
  background: rgba(15, 15, 23, 0.97);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-right: 1px solid var(--border-subtle);
  box-shadow: 14px 0 40px rgba(0, 0, 0, 0.65);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow-x: hidden !important;
  overflow-y: hidden;
  box-sizing: border-box;
  animation: shapesPanelSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.shapes-flyout-panel *,
.shapes-flyout-panel *::before,
.shapes-flyout-panel *::after {
  box-sizing: border-box;
}

@keyframes shapesPanelSlideIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.shapes-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.shapes-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.shapes-count-badge {
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  padding: 2px 7px;
  border-radius: 10px;
}

.shapes-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.shapes-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.shapes-search-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 6px 12px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.shapes-search-container:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.shapes-search-container input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 11.5px;
  min-width: 0;
}

.shapes-style-pills-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px 4px 12px;
  flex-shrink: 0;
  overflow-x: hidden !important;
}

.shape-style-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.shape-style-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.shape-style-pill.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(99, 102, 241, 0.25) 100%);
  border-color: #a855f7;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.shapes-category-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px 8px 12px;
  flex-shrink: 0;
  overflow-x: hidden !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shape-cat-tab {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.shape-cat-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.shape-cat-tab.active {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
  font-weight: 600;
}

.shapes-grid-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden !important;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.shapes-grid-container::-webkit-scrollbar {
  width: 6px;
}

.shapes-grid-container::-webkit-scrollbar-track {
  background: transparent;
}

.shapes-grid-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.shapes-grid-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.shape-card {
  min-width: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px 10px 6px;
  min-height: 100px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.shape-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: #a855f7;
  box-shadow: 0 8px 18px rgba(168, 85, 247, 0.25);
}

.shape-card:active {
  transform: translateY(0) scale(0.97);
}

.shape-card-preview {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.shape-card-preview svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}

.shape-card-name {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
  pointer-events: none;
}

.shapes-panel-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ==========================================================================
   QR Code Studio & Live Generator Styles
   ========================================================================== */
.qr-studio-section {
  background: linear-gradient(145deg, rgba(30, 27, 75, 0.4) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.qr-studio-section.highlight-pulse {
  border-color: #6366f1;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4), inset 0 0 10px rgba(99, 102, 241, 0.15);
}

.qr-studio-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.qr-live-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.qr-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.qr-row-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.qr-url-input-field {
  padding: 4px 8px;
}

.qr-presets-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.qr-preset-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.qr-preset-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

.qr-mode-segmented {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-main);
  gap: 2px;
}

.qr-seg-btn {
  flex: 1;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.qr-seg-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.qr-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  border-radius: 4px;
  padding: 2px 5px;
  gap: 5px;
  flex: 1;
}

.color-swatch-input {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 3px;
}

.hex-input-mini {
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  outline: none;
}

.qr-select-mini {
  background: var(--bg-input);
  border: 1px solid var(--border-main);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 3px 6px;
}

.qr-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.qr-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.qr-logo-section {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Features Guide, Legal Reader & Cookie Consent System
   ========================================================================== */

/* Status bar buttons */
.status-pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 11px;
  font-family: inherit;
  transition: all 0.15s ease;
  user-select: none;
}

.status-pill-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.45);
}

/* Features Guide Modal Window */
.features-guide-window {
  max-width: 980px !important;
  width: 94% !important;
  max-height: 88vh !important;
  background: #14161c !important;
  border: 1px solid rgba(139, 92, 246, 0.35) !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85), 0 0 40px rgba(139, 92, 246, 0.18) !important;
  display: flex !important;
  flex-direction: column !important;
}

.features-guide-header {
  padding: 16px 22px !important;
  border-bottom: 1px solid var(--border-main) !important;
  background: #181a22 !important;
}

.features-guide-brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guide-logo-circle-white {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.45);
  flex-shrink: 0;
}

.guide-logo-circle-white img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.features-guide-header h2 {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 3px 0;
  letter-spacing: -0.2px;
}

.features-guide-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-tech-pill {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Features Guide Tab Navigation */
.features-guide-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #111217;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
}

.guide-tab-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.guide-tab-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.guide-tab-nav-btn.active {
  background: var(--bg-card);
  color: #ffffff;
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.guide-tab-icon {
  font-size: 14px;
}

/* Modal Body & Tab Panels */
.features-guide-body {
  padding: 0 !important;
  overflow-y: auto !important;
  flex: 1 !important;
  background: #0f1015;
}

.guide-tab-panel {
  display: none;
  padding: 24px;
  flex-direction: column;
  gap: 24px;
}

.guide-tab-panel.active {
  display: flex;
  animation: guideFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* TAB 1: Hero Banner & Overview */
.guide-hero-banner {
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.guide-hero-image-wrap {
  position: relative;
  width: 100%;
  height: 200px;
}

.guide-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.guide-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 10, 16, 0.3) 0%, rgba(9, 10, 16, 0.92) 100%), linear-gradient(90deg, rgba(139, 92, 246, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 24px;
}

.guide-hero-badge {
  align-self: flex-start;
  background: rgba(139, 92, 246, 0.35);
  border: 1px solid rgba(139, 92, 246, 0.6);
  color: #e0e7ff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.guide-hero-heading {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
  line-height: 1.25;
}

.guide-hero-desc {
  font-size: 13px;
  color: #cbd5e1;
  margin: 0;
  max-width: 640px;
  line-height: 1.5;
}

.guide-section-intro {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.guide-section-intro h2 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 10px 0;
}

.guide-section-intro p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Metrics Grid */
.guide-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.guide-metric-card {
  background: #181920;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.guide-metric-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.guide-metric-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.guide-metric-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.guide-metric-card p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* .imgai Document Box */
.guide-imgai-box {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.guide-imgai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.guide-imgai-tag {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.45);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.guide-imgai-box h3 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.guide-imgai-box p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 14px 0;
}

.guide-code-snippet {
  background: #090a0f;
  border: 1px solid var(--border-main);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #38bdf8;
  overflow-x: auto;
  white-space: nowrap;
}

/* TAB 2: Features Catalog */
.guide-features-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.guide-feature-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  background: #161820;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s ease;
}

.guide-feature-row:hover {
  border-color: rgba(139, 92, 246, 0.45);
}

.guide-feature-media {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #0d0e13;
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.guide-qr-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-feature-thumb {
  max-width: 130px;
  max-height: 130px;
  object-fit: contain;
  border-radius: 8px;
}

.guide-feature-badge-mini {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.guide-shapes-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 20px;
}

.guide-shape-icon-chip {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.guide-group-preview-card {
  width: 100%;
  background: #1a1c25;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.guide-group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #93c5fd;
}

.badge-mini-cyan {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.4);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.guide-group-card-child {
  color: #94a3b8;
  padding-left: 10px;
  font-size: 10px;
}

.guide-typography-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.guide-text-neon-preview {
  font-size: 14px;
  font-weight: 900;
  color: #f43f5e;
  text-shadow: 0 0 10px #f43f5e, 0 0 20px #e11d48;
}

.guide-text-gold-preview {
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.guide-marquee-preview {
  width: 90px;
  height: 70px;
  border: 1px dashed rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.08);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-mask-preview-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.guide-mask-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guide-export-preview-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 12px 18px;
}

.guide-feature-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-feature-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.guide-feature-icon {
  font-size: 20px;
}

.guide-feature-title-wrap h3 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.guide-hotkey-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.guide-feature-content p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.guide-feature-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-feature-bullets li {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.5;
  position: relative;
  padding-left: 14px;
}

.guide-feature-bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-size: 14px;
}

/* TAB 3: Shortcuts Table */
.guide-shortcuts-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.guide-shortcuts-group h3 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  background: #161820;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 12.5px;
}

.guide-table th {
  background: #111217;
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

.guide-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.guide-table tr:last-child td {
  border-bottom: none;
}

.guide-table kbd {
  background: #252834;
  border: 1px solid #373b4d;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* TAB 4: Legal & Trust Center */
.guide-legal-intro {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.guide-legal-intro h2 {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.guide-legal-intro p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.guide-legal-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
}

.guide-legal-card {
  background: #161820;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  gap: 16px;
  transition: all 0.2s ease;
}

.guide-legal-card:hover {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.guide-legal-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.guide-legal-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.guide-legal-card-content h3 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.guide-legal-card-content p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.guide-legal-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.guide-legal-card-actions .btn {
  font-size: 12px;
  padding: 6px 12px;
}

.features-guide-footer {
  padding: 14px 22px !important;
  background: #14151c !important;
  border-top: 1px solid var(--border-main) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-footer-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.guide-footer-dot {
  opacity: 0.4;
}

/* ==========================================================================
   Full Legal Document Reader Modal
   ========================================================================== */
.legal-doc-backdrop {
  z-index: 25000 !important;
}

.legal-doc-window {
  max-width: 840px !important;
  width: 92% !important;
  max-height: 85vh !important;
  background: #15161c !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9) !important;
}

.legal-doc-header {
  padding: 16px 22px !important;
  background: #181922 !important;
  border-bottom: 1px solid var(--border-main) !important;
}

.legal-doc-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.legal-doc-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.legal-doc-body {
  padding: 26px 32px !important;
  background: #0f1015 !important;
  overflow-y: auto !important;
  line-height: 1.7 !important;
  color: #d1d5db !important;
  font-size: 13.5px !important;
}

.legal-doc-body h1,
.legal-doc-body h2,
.legal-doc-body h3 {
  color: #ffffff;
  margin-top: 24px;
  margin-bottom: 10px;
}

.legal-doc-body h1 { font-size: 20px; margin-top: 0; }
.legal-doc-body h2 { font-size: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 6px; }
.legal-doc-body h3 { font-size: 14px; }

.legal-doc-body p { margin-bottom: 14px; }
.legal-doc-body ul { margin-bottom: 16px; padding-left: 20px; }
.legal-doc-body li { margin-bottom: 6px; }

.legal-highlight-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 13px;
  color: #e0e7ff;
}

/* ==========================================================================
   Cookie Preferences Modal & Banner
   ========================================================================== */
.cookie-settings-backdrop {
  z-index: 26000 !important;
}

.cookie-settings-window {
  max-width: 620px !important;
  width: 90% !important;
}

.cookie-settings-body {
  padding: 20px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  background: #111218 !important;
}

.cookie-category-card {
  background: #171922;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: border-color 0.2s ease;
}

.cookie-category-card:hover {
  border-color: rgba(139, 92, 246, 0.35);
}

.cookie-category-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cookie-category-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.cookie-category-title-row h4 {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.badge-cookie-required {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-cookie-opt {
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

.cookie-category-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Custom iOS-style Toggle Switch */
.toggle-switch,
.toggle-switch-disabled {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toggle-switch input,
.toggle-switch-disabled input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #2b2e3b;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

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

.toggle-switch-disabled .toggle-slider {
  cursor: not-allowed;
  opacity: 0.8;
  background-color: #3b82f6;
  border-color: #3b82f6;
}

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

/* Cookie Consent Floating Banner */
.cookie-consent-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 880px;
  z-index: 99999;
  animation: bannerSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bannerSlideUp {
  from { opacity: 0; transform: translate(-50%, 25px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.cookie-banner-inner {
  background: rgba(20, 22, 30, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.45);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.75), 0 0 25px rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cookie-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.cookie-banner-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.cookie-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.cookie-banner-text strong {
  color: #ffffff;
  font-size: 13px;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cookie-banner-actions .btn {
  font-size: 12px;
  padding: 8px 14px;
}

.btn-cookie-settings {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-cookie-settings:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-cookie-essential {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-main);
  color: #ffffff;
}

.btn-cookie-essential:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-cookie-accept {
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.45);
}

@media (max-width: 768px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-banner-actions {
    justify-content: flex-end;
  }
  .guide-feature-row {
    grid-template-columns: 1fr;
  }
}

