/* ==========================================================================
   ViewMix Studio — Modern Clean Album & AR Platform (WOW / Albume Style)
   Aesthetic: Light Studio Canvas, Crisp Typography, Teal & Indigo Modern Accents
   ========================================================================== */

:root {
  --studio-bg: #f1f3f6;
  --studio-surface: #ffffff;
  --studio-surface-subtle: #f8fafc;
  --studio-border: #e2e8f0;
  --studio-border-strong: #cbd5e1;
  --studio-text: #0f172a;
  --studio-text-muted: #64748b;
  --studio-accent: #0ea5e9;
  --studio-accent-hover: #0284c7;
  --studio-accent-light: #e0f2fe;
  --studio-teal: #00a896;
  --studio-green: #10b981;
  --studio-rose: #f43f5e;
  --studio-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --studio-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.07);
  --studio-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);

  /* Legacy compatibility aliases mapped to clean modern tokens */
  --bg-deep: var(--studio-bg);
  --bg-surface: var(--studio-surface);
  --bg-surface-elevated: var(--studio-surface);
  --bg-card: var(--studio-surface);
  --bg-card-hover: var(--studio-surface-subtle);
  --gold-primary: var(--studio-accent);
  --gold-light: var(--studio-accent-light);
  --gold-dark: var(--studio-accent-hover);
  --border-subtle: var(--studio-border);
  --border-hover: var(--studio-accent);
  --text-main: var(--studio-text);
  --text-muted: var(--studio-text-muted);
  --text-secondary: #475569;
  --text-gold: var(--studio-accent);

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

  --transition-smooth: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body, html {
  width: 100%;
  font-family: 'Assistant', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--studio-bg);
  color: var(--studio-text);
  direction: rtl;
}

/* Quick Moments Mode (Default): full vertical document scrolling */
html:not(.mode-designer),
body:not(.mode-designer) {
  height: auto !important;
  min-height: 100vh !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto !important;
}

body:not(.mode-designer) .app-container {
  height: auto !important;
  min-height: 100vh !important;
  max-height: none !important;
  overflow: visible !important;
  padding-bottom: 140px !important; /* Space for sticky bottom bar in moments mode */
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

/* Page Layout */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Designer Studio Fixed Mode: Lock viewport completely to prevent page scrolling */
html.mode-designer,
body.mode-designer {
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.mode-designer .app-container {
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding-bottom: 0 !important;
}

body.mode-designer .sticky-bottom-bar {
  display: none !important;
}

/* Luxury Header */
.luxury-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

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

.btn-back-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-smooth);
}
.btn-back-nav:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.brand-badge {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Cinzel', serif, 'Assistant', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-subtitle {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-center {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  gap: 8px;
  transition: var(--transition-smooth);
  cursor: text;
}
.header-center:hover {
  border-color: rgba(212, 175, 55, 0.65);
  background: rgba(0, 0, 0, 0.6);
}
.header-center:focus-within {
  border-color: var(--gold-primary);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.28);
  background: rgba(0, 0, 0, 0.7);
}

.album-title-label {
  font-size: 12px;
  color: var(--text-gold);
  font-weight: 700;
  white-space: nowrap;
}

.album-title-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  outline: none;
  font-family: inherit;
  min-width: 120px;
}
.album-title-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.btn-edit-title-inline {
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-smooth);
  font-family: inherit;
}
.btn-edit-title-inline:hover {
  background: var(--gold-primary);
  color: #0b0d10;
  border-color: var(--gold-primary);
}

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

.btn-quick-test {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-quick-test:hover {
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--gold-primary);
  box-shadow: var(--gold-glow);
  transform: translateY(-1px);
}

/* Main Content Area */
.main-wrapper {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px;
}

/* Intro Hero Banner */
.hero-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.hero-text h1 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}
.hero-text p {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 16px;
  text-align: center;
}
.stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 22px;
  min-width: 110px;
}
.stat-number {
  font-size: 26px;
  font-weight: 800;
  color: #0284c7;
  display: block;
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-top: 3px;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.section-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title .badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* Moments List */
.moments-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Individual Moment Card */
.moment-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  position: relative;
}
.moment-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.moment-card.is-complete {
  border: 1.5px solid #10b981;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.08);
}

.moment-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.moment-card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 480px;
}
.moment-index-badge {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: #0284c7;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}
.moment-name-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 6px 12px;
  flex: 1;
  transition: all 0.2s ease;
  cursor: text;
}
.moment-name-box:hover {
  border-color: #0ea5e9;
  background: #ffffff;
}
.moment-name-box:focus-within {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}
.moment-name-input {
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  font-family: inherit;
  flex: 1;
  width: 100%;
  min-width: 110px;
}
.moment-name-input::placeholder {
  color: #94a3b8;
}
.btn-edit-moment-name {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-edit-moment-name:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

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

.btn-moment-action {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-moment-action:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-moment-action.btn-phone-test {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #15803d;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(21, 128, 61, 0.1);
}
.btn-moment-action.btn-phone-test:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #166534;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.2);
  transform: translateY(-1px);
}

.btn-remove-moment {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  color: #e11d48;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}
.btn-remove-moment:hover {
  background: #ffe4e6;
  border-color: #fb7185;
  color: #be123c;
  transform: scale(1.05);
}

/* Pair Layout (Image + Video side by side) */
.pair-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
}

@media (max-width: 768px) {
  .pair-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Dropzone Base */
.dropzone-box {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  overflow: hidden;
}
.dropzone-box:hover {
  border-color: #0ea5e9;
  background: #f0f9ff;
}
.dropzone-box.drag-active {
  border-color: #0284c7;
  background: #e0f2fe;
  box-shadow: inset 0 0 16px rgba(2, 132, 199, 0.12);
}

.dropzone-icon {
  font-size: 38px;
  margin-bottom: 8px;
  transition: transform 0.2s ease;
}
.dropzone-box:hover .dropzone-icon {
  transform: scale(1.1);
}

.dropzone-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}
.dropzone-hint {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.4;
}

/* Hidden File Inputs */
.hidden-file-input {
  display: none;
}

/* Loaded State in Dropzone */
.dropzone-box.has-file {
  border-style: solid;
  border-color: #cbd5e1;
  padding: 0;
  background: #0f172a;
}

/* YouTube Dropzone Specific overrides: keeps clean white background even when filled */
.dropzone-box[id^="youtube-dropzone"] {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-style: solid;
  cursor: default;
}
.dropzone-box[id^="youtube-dropzone"].has-file {
  background: #ffffff;
  border-color: #cbd5e1;
  padding: 18px 14px;
}

.preview-media {
  width: 100%;
  height: 220px;
  object-fit: contain;
  display: block;
}

.dropzone-overlay-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.92) 50%);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  z-index: 5;
}

.dropzone-action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-replace-media {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-replace-media:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
}

.btn-remove-media {
  background: #ef4444;
  border: 1px solid #dc2626;
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-remove-media:hover {
  background: #dc2626;
  border-color: #b91c1c;
}

/* Connection Link Badge (Between Image & Video) */
.pair-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.connector-pulse {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.pair-connector.is-linked .connector-pulse {
  background: #f0fdf4;
  border-color: #86efac;
  color: #10b981;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.45);
    transform: scale(1.06);
  }
}

/* Clean connector pulse - buttons moved to card header */
.btn-simulate-moment, .btn-phone-moment {
  display: none !important;
}

/* Add Moment Button */
.btn-add-moment {
  width: 100%;
  background: #ffffff;
  border: 2px dashed #0284c7;
  border-radius: 16px;
  padding: 20px;
  color: #0284c7;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  margin-top: 24px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
  transition: all 0.2s ease;
}
.btn-add-moment:hover {
  background: #f0f9ff;
  border-color: #0369a1;
  color: #0369a1;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.16);
  transform: translateY(-2px);
}

/* Sticky Bottom Action Bar */
.sticky-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #ffffff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  padding: 16px 28px;
  z-index: 60;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.bottom-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}
.summary-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}
.summary-status-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.save-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-generate-qr {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: none;
  color: #ffffff;
  padding: 12px 30px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.35);
  transition: all 0.2s ease;
}
.btn-generate-qr:hover:not(:disabled) {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.45);
  transform: translateY(-2px);
}
.btn-generate-qr:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Modals & Popups (QR & Simulator)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.is-open {
  display: flex;
}

.modal-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--gold-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), var(--gold-glow);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  padding: 32px;
  position: relative;
  animation: modal-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}
.modal-title {
  font-size: 22px;
  font-weight: 800;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* QR Presentation Box */
.qr-display-wrapper {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius-md);
  display: inline-block;
  margin: 0 auto 20px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Quick Test Modal Wide Layout - Strict Side-by-Side */
.quick-test-modal-card {
  max-width: 960px !important;
  width: 95vw;
  padding: 24px 28px;
}

.quick-test-grid {
  display: flex !important;
  flex-direction: row !important;
  gap: 20px !important;
  align-items: stretch !important;
  justify-content: center !important;
  width: 100% !important;
  margin-bottom: 8px;
}

/* Right Column: QR Code (Compact, dedicated width) */
.quick-test-col.col-qr {
  flex: 0 0 240px !important;
  width: 240px !important;
  background: rgba(11, 13, 16, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
  position: relative;
}

/* Left Column: Target Image (Takes all dominant remaining space) */
.quick-test-col.col-target {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  background: rgba(11, 13, 16, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(212, 175, 55, 0.1);
  position: relative;
}

.quick-test-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  text-align: right;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--gold-gradient);
  color: #0b0d10;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.step-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.step-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.quick-test-qr-wrapper {
  background: #fff;
  padding: 10px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  width: 190px;
  height: 190px;
  margin: auto;
}

.quick-test-target-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.quick-test-target-frame {
  width: 100%;
  height: 380px;
  max-height: 52vh;
  background: #000;
  border: 2px solid rgba(212, 175, 55, 0.5);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.25);
}

.quick-test-target-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.2s;
}

.quick-test-target-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(11, 13, 16, 0.9);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.quick-test-moment-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-test-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-test-nav:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.25);
  border-color: rgba(212, 175, 55, 0.6);
  color: #fff;
  transform: translateY(-1px);
}

.btn-test-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.quick-test-counter-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.quick-test-index-counter {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.moment-name-pill {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 6px 18px;
  border-radius: var(--radius-full);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Modal Actions */
.modal-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-modal-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}
.btn-modal-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-modal-action.primary-gold {
  background: var(--gold-gradient);
  color: #0b0d10;
  border: none;
}
.btn-modal-action.primary-gold:hover {
  background: var(--gold-gradient-hover);
  box-shadow: var(--gold-glow);
}

/* Instruction Box for Album Designer */
.designer-note-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed var(--gold-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  text-align: right;
  position: relative;
}
.designer-note-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-gold);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.designer-note-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.btn-copy-note {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-copy-note:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ==========================================================================
   In-Screen AR Simulator Modal
   ========================================================================== */
.simulator-modal-card {
  max-width: 720px;
  background: #0b0d10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.simulator-stage {
  position: relative;
  width: 100%;
  max-height: 480px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}
.simulator-target-bg {
  max-width: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
}
.simulator-video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   Fullscreen Scan Target Overlay (סריקה על המסך)
   ========================================================================== */
.scan-target-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 24px;
}

.scan-target-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.scan-target-box {
  position: relative;
  max-width: 85vw;
  max-height: 80vh;
  box-shadow: 0 0 60px rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.scan-target-box img {
  display: block;
  max-width: 85vw;
  max-height: 80vh;
  object-fit: contain;
}

.scan-target-header {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #f5e7b2;
  padding: 10px 26px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.7);
  z-index: 10;
}

.scan-target-close {
  position: absolute;
  top: 24px;
  right: 28px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-smooth);
  z-index: 10;
}
.scan-target-close:hover {
  background: rgba(212, 175, 55, 0.3);
  border-color: var(--gold-border);
  color: #f5e7b2;
  transform: scale(1.05);
}

/* Video Source Selector (File vs YouTube) */
.video-source-switcher {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.btn-source-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-source-tab:hover {
  color: #fff;
}

.btn-source-tab.active {
  background: rgba(212, 175, 55, 0.2);
  color: #f5e7b2;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.btn-source-tab.youtube-tab.active {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.youtube-input-zone {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.youtube-url-input {
  width: 90%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  color: #0f172a;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  direction: ltr;
  margin: 10px 0;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.youtube-url-input::placeholder {
  color: #94a3b8;
}

.youtube-url-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* YouTube Linked Preview Card */
.youtube-linked-card {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 6px;
  background: #f8fafc;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.youtube-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

.youtube-info {
  text-align: right;
}

.youtube-status-badge {
  font-size: 12px;
  color: #15803d;
  font-weight: 800;
  display: block;
  margin-bottom: 2px;
}

.youtube-preview-link {
  font-size: 11px;
  color: #0284c7;
  font-weight: 700;
  text-decoration: underline;
}

/* ==========================================================================
   Photo Album Designer (Lupa / Picabook Style Workspace)
   ========================================================================== */

.btn-open-designer-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}
.btn-open-designer-header:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.btn-open-designer-bottom {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}
.btn-open-designer-bottom:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.album-designer-workspace {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 20px 30px 20px;
  gap: 14px;
}

/* Top Bar */
.designer-top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.designer-top-right,
.designer-top-center,
.designer-top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-designer-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-designer-back:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--gold-primary);
}

.designer-title-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-light);
}

.designer-control-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.designer-select {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.designer-select:focus {
  border-color: var(--gold-primary);
}

.designer-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-export-pdf-gold {
  background: var(--gold-gradient);
  border: none;
  color: #0b0d10;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.35);
  transition: var(--transition-smooth);
}
.btn-export-pdf-gold:hover:not(:disabled) {
  background: var(--gold-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.5);
}
.btn-export-pdf-gold:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Secondary Toolbar (Templates & Context Controls) */
.designer-sub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: rgba(18, 20, 26, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  min-height: 52px;
}

.sub-toolbar-group,
.context-controls-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.sub-toolbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
}

.btn-designer-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-designer-tool:hover {
  background: rgba(212, 175, 55, 0.16);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-magic-arrange {
  background: rgba(212, 175, 55, 0.14);
  border-color: rgba(212, 175, 55, 0.45);
  color: var(--gold-light);
}

.btn-danger-tool {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fecdd3;
}
.btn-danger-tool:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #fff;
}

.btn-designer-icon {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-main);
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.btn-designer-icon:hover,
.btn-designer-icon.active {
  background: var(--gold-primary);
  color: #0b0d10;
  border-color: var(--gold-primary);
}

.designer-context-bar {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.designer-context-bar.has-selection {
  display: flex;
}

.color-swatches-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-text-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-text-color:hover {
  transform: scale(1.2);
  border-color: var(--gold-primary);
}

/* Split Main Body: Right Vertical Photo Tray + Center/Left Book Stage */
.designer-main-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 18px;
  width: 100%;
}

/* Right Vertical Photo Tray Sidebar (Top to Bottom) */
.designer-right-sidebar {
  flex: 0 0 276px;
  width: 276px;
  max-height: 540px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tray-header-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.tray-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.tray-main-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-light);
}

.tray-stats-badge {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.btn-upload-stills {
  width: 100%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-smooth);
}
.btn-upload-stills:hover {
  background: #10b981;
  color: #0b0d10;
}

.designer-photo-tray-list {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  padding-left: 4px;
}

.tray-empty-notice {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
  padding: 24px 10px;
  text-align: center;
  line-height: 1.5;
}

.tray-photo-card {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 6px;
  cursor: grab;
  transition: var(--transition-smooth);
  user-select: none;
  -webkit-user-select: none;
}
.tray-photo-card:hover {
  border-color: var(--gold-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
.tray-photo-card.is-used {
  border-color: rgba(16, 185, 129, 0.45);
}

.tray-thumb-wrap {
  width: 100%;
  height: 76px;
  background: #0b0d10;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tray-thumb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tray-ar-pill {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(11, 13, 16, 0.85);
  border: 1px solid var(--gold-primary);
  color: var(--gold-light);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
}

.tray-usage-pill {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
}
.tray-usage-pill.active {
  background: rgba(16, 185, 129, 0.9);
  color: #0b0d10;
  font-weight: 800;
}

.btn-remove-regular-photo {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.85);
  color: #fff;
  border: none;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tray-photo-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Open Book Stage Area (Left / Center beside Right Sidebar) */
.book-stage-area {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 0;
}

.btn-spread-nav {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold-light);
  padding: 14px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}
.btn-spread-nav:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
  box-shadow: var(--gold-glow);
}
.btn-spread-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.book-spread-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.book-spread-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: #181b22;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(212, 175, 55, 0.12);
  position: relative;
}

/* Hardcover visual styling when viewing Spread 0 (Front & Back Covers) */
.book-spread-container.is-cover-spread {
  background: linear-gradient(135deg, #231e15 0%, #14161d 100%);
  border: 2.5px solid var(--gold-primary);
  box-shadow: 0 26px 65px rgba(0, 0, 0, 0.85), 0 0 35px rgba(212, 175, 55, 0.22);
}

.book-page-surface.is-cover-page::after {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  pointer-events: none;
  z-index: 5;
}

.book-page-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.book-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 4px;
}

.active-page-indicator {
  font-size: 11px;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.18);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 1px 8px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s;
}

.book-page-column:has(.book-page-surface.is-active-page) .active-page-indicator {
  opacity: 1;
}

.book-page-surface {
  width: 420px;
  height: 420px;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  transition: box-shadow 0.2s, outline 0.2s, background-color 0.2s;
  cursor: default;
}

#book-spread-container.theme-white .book-page-surface,
.modern-book-spread.theme-white .book-page-surface {
  background: #ffffff;
}
#book-spread-container.theme-ivory .book-page-surface,
.modern-book-spread.theme-ivory .book-page-surface {
  background: #faf6ee;
}
#book-spread-container.theme-dark .book-page-surface,
.modern-book-spread.theme-dark .book-page-surface {
  background: #14171f;
}

.book-page-surface.page-right {
  border-radius: 4px 10px 10px 4px;
  box-shadow: inset 18px 0 28px -14px rgba(0, 0, 0, 0.22);
}
.book-page-surface.page-left {
  border-radius: 10px 4px 4px 10px;
  box-shadow: inset -18px 0 28px -14px rgba(0, 0, 0, 0.22);
}

.book-page-surface.is-active-page {
  outline: 2px solid var(--gold-primary);
  outline-offset: 2px;
}

.book-page-surface.page-drop-hover {
  outline: 3px dashed #10b981 !important;
  outline-offset: 2px;
}

.book-center-spine {
  width: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.35) 0%, rgba(255,255,255,0.12) 50%, rgba(0,0,0,0.35) 100%);
  margin: 24px 2px 0 2px;
  border-radius: 2px;
}

.page-empty-hint {
  position: absolute;
  inset: 28px;
  border: 2px dashed rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

/* Center Snap Guides */
.page-snap-guide-v {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px dashed #d4af37;
  pointer-events: none;
  opacity: 0;
  z-index: 40;
}
.page-snap-guide-h {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed #d4af37;
  pointer-events: none;
  opacity: 0;
  z-index: 40;
}
.page-snap-guide-v.visible,
.page-snap-guide-h.visible {
  opacity: 0.9;
}

/* Canvas Elements (Photos, QR, Texts, Stickers) */
.canvas-item {
  position: absolute;
  box-sizing: border-box;
  /* z-index is set dynamically inline according to item's order in page.items */
}

/* Free-width text field edge handles */
.canvas-text-item .text-edge-handle {
  z-index: 30;
}

.canvas-photo-item,
.canvas-qr-item,
.canvas-sticker-item {
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.canvas-photo-item.dragging,
.canvas-qr-item.dragging,
.canvas-sticker-item.dragging {
  cursor: grabbing;
}

.sticker-inner-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.canvas-sticker-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.12));
}

.photo-inner-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: block;
  overflow: visible;
  box-sizing: border-box;
}

.canvas-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

/* Photo Frame Styles — Built OUTWARD (preserving true photo aspect & size for 100% AR & PDF match) */

/* 1. Polaroid Frame */
.canvas-photo-item.frame-polaroid .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-polaroid .photo-inner-wrap::before,
.canvas-placeholder-item.frame-polaroid .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -20px;
  background: #ffffff;
  border: var(--frame-border-width, 1px) solid var(--frame-border-color, rgba(0, 0, 0, 0.1));
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  z-index: 0;
}
.canvas-photo-item.frame-polaroid.is-selected {
  outline-offset: calc(6px + var(--frame-border-width, 1px) + 1px);
}

/* 2. White Frame */
.canvas-photo-item.frame-white .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-white .photo-inner-wrap::before,
.canvas-placeholder-item.frame-white .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  background: #ffffff;
  border: var(--frame-border-width, 1px) solid var(--frame-border-color, rgba(0, 0, 0, 0.1));
  border-radius: 2px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  z-index: 0;
}
.canvas-photo-item.frame-white.is-selected {
  outline-offset: calc(5px + var(--frame-border-width, 1px) + 1px);
}

/* 3. Classic Gold Frame */
.canvas-photo-item.frame-gold .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-gold .photo-inner-wrap::before,
.canvas-placeholder-item.frame-gold .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--frame-border-width, 2px));
  left: calc(-1 * var(--frame-border-width, 2px));
  right: calc(-1 * var(--frame-border-width, 2px));
  bottom: calc(-1 * var(--frame-border-width, 2px));
  border: var(--frame-border-width, 2px) solid var(--frame-border-color, #d4af37);
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}
.canvas-photo-item.frame-gold.is-selected {
  outline-offset: calc(var(--frame-border-width, 2px) + 2px);
}

/* 4. Borderless Frame */
.canvas-photo-item.frame-borderless .photo-inner-wrap {
  border: none;
  background: transparent;
  padding: 0;
}
.canvas-photo-item.frame-borderless[style*="--frame-border-width"] .photo-inner-wrap::after,
.canvas-placeholder-item.frame-borderless[style*="--frame-border-width"] .placeholder-inner-wrap::after {
  content: '';
  position: absolute;
  top: calc(-1 * var(--frame-border-width));
  left: calc(-1 * var(--frame-border-width));
  right: calc(-1 * var(--frame-border-width));
  bottom: calc(-1 * var(--frame-border-width));
  border: var(--frame-border-width) solid var(--frame-border-color, #d4af37);
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}
.canvas-photo-item.frame-borderless.is-selected {
  outline-offset: 2px;
}
.canvas-photo-item.frame-borderless[style*="--frame-border-width"].is-selected {
  outline-offset: calc(var(--frame-border-width) + 2px);
}

/* 5. Circle Frame */
.canvas-photo-item.frame-circle .photo-inner-wrap {
  border-radius: 50%;
  overflow: hidden;
}
.canvas-photo-item.frame-circle .canvas-photo-img {
  border-radius: 50%;
}
.canvas-photo-item.frame-circle::before,
.canvas-placeholder-item.frame-circle::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--frame-border-width, 2px));
  left: calc(-1 * var(--frame-border-width, 2px));
  right: calc(-1 * var(--frame-border-width, 2px));
  bottom: calc(-1 * var(--frame-border-width, 2px));
  border: var(--frame-border-width, 2px) solid var(--frame-border-color, rgba(212, 175, 55, 0.8));
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  box-sizing: border-box;
}
.canvas-photo-item.frame-circle.is-selected {
  outline-offset: calc(var(--frame-border-width, 2px) + 2px);
}

/* 6. Rounded Frame */
.canvas-photo-item.frame-rounded .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-rounded .canvas-photo-img {
  border-radius: 8px;
}
.canvas-photo-item.frame-rounded .photo-inner-wrap::before,
.canvas-placeholder-item.frame-rounded .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  background: #ffffff;
  border: var(--frame-border-width, 1px) solid var(--frame-border-color, rgba(0, 0, 0, 0.12));
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  pointer-events: none;
  z-index: 0;
}
.canvas-photo-item.frame-rounded.is-selected {
  outline-offset: calc(4px + var(--frame-border-width, 1px) + 1px);
}

/* 7. Luxury Double Gold Frame */
.canvas-photo-item.frame-double-gold .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-double-gold .photo-inner-wrap::before,
.canvas-placeholder-item.frame-double-gold .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: -14px;
  left: -14px;
  right: -14px;
  bottom: -14px;
  background: #ffffff;
  border: var(--frame-border-width, 1.5px) solid var(--frame-border-color, #d4af37);
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25), inset 0 0 0 4px #ffffff, inset 0 0 0 6px var(--frame-border-color, #d4af37);
  pointer-events: none;
  z-index: 0;
}
.canvas-photo-item.frame-double-gold.is-selected {
  outline-offset: calc(14px + var(--frame-border-width, 1.5px) + 1px);
}

/* 8. Museum Gallery Passepartout Frame */
.canvas-photo-item.frame-passepartout .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-passepartout .photo-inner-wrap::before,
.canvas-placeholder-item.frame-passepartout .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
  background: #ffffff;
  border: var(--frame-border-width, 1px) solid var(--frame-border-color, rgba(0, 0, 0, 0.3));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}
.canvas-photo-item.frame-passepartout.is-selected {
  outline-offset: calc(12px + var(--frame-border-width, 1px) + 1px);
}

/* 9. Floating Soft Atmospheric Shadow Frame */
.canvas-photo-item.frame-shadow-float .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-shadow-float .canvas-photo-img {
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.30);
}
.canvas-photo-item.frame-shadow-float[style*="--frame-border-width"] .photo-inner-wrap::after,
.canvas-placeholder-item.frame-shadow-float[style*="--frame-border-width"] .placeholder-inner-wrap::after {
  content: '';
  position: absolute;
  top: calc(-1 * var(--frame-border-width));
  left: calc(-1 * var(--frame-border-width));
  right: calc(-1 * var(--frame-border-width));
  bottom: calc(-1 * var(--frame-border-width));
  border: var(--frame-border-width) solid var(--frame-border-color, #d4af37);
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}
.canvas-photo-item.frame-shadow-float.is-selected {
  outline-offset: 3px;
}
.canvas-photo-item.frame-shadow-float[style*="--frame-border-width"].is-selected {
  outline-offset: calc(var(--frame-border-width) + 2px);
}

/* 10. Floral / Golden Corner Flourishes Frame */
.canvas-photo-item.frame-floral {
  position: absolute;
}
.canvas-photo-item.frame-floral .photo-inner-wrap {
  overflow: visible;
  border: none;
  padding: 0;
  background: transparent;
}
.canvas-photo-item.frame-floral .photo-inner-wrap::before,
.canvas-placeholder-item.frame-floral .placeholder-inner-wrap::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  background: #ffffff;
  border: var(--frame-border-width, 1.5px) solid var(--frame-border-color, rgba(212, 175, 55, 0.6));
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.22);
  pointer-events: none;
  z-index: 0;
}
.canvas-photo-item.frame-floral::before {
  content: '';
  position: absolute;
  top: -11px;
  right: -11px;
  width: 14px;
  height: 14px;
  border-color: var(--frame-border-color, #d4af37);
  border-style: solid;
  border-width: 2.5px 2.5px 0 0;
  pointer-events: none;
  z-index: 3;
}
.canvas-photo-item.frame-floral::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: -11px;
  width: 14px;
  height: 14px;
  border-color: var(--frame-border-color, #d4af37);
  border-style: solid;
  border-width: 0 0 2.5px 2.5px;
  pointer-events: none;
  z-index: 3;
}
.canvas-photo-item.frame-floral .photo-inner-wrap::after {
  content: '';
  position: absolute;
  top: -11px;
  left: -11px;
  width: 14px;
  height: 14px;
  border-color: var(--frame-border-color, #d4af37);
  border-style: solid;
  border-width: 2.5px 0 0 2.5px;
  pointer-events: none;
  z-index: 3;
}
.canvas-photo-item.frame-floral.is-selected {
  outline-offset: calc(8px + var(--frame-border-width, 1.5px) + 1px);
}

/* Photo Swap Highlight when dragging another photo over an existing photo item */
.canvas-photo-item.photo-swap-hover {
  outline: 3px solid #d4af37 !important;
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.65) !important;
}

/* Canvas Placeholder / Empty Dropzone Slot */
.canvas-placeholder-item {
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.canvas-placeholder-item .placeholder-inner-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(212, 175, 55, 0.05);
  border: 2px dashed rgba(212, 175, 55, 0.45);
  border-radius: 6px;
  box-sizing: border-box;
  padding: 10px;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.canvas-placeholder-item.frame-circle .placeholder-inner-wrap {
  border-radius: 50%;
}

.canvas-placeholder-item.frame-rounded .placeholder-inner-wrap {
  border-radius: 12px;
}

.canvas-placeholder-item:hover .placeholder-inner-wrap,
.canvas-placeholder-item.placeholder-hover .placeholder-inner-wrap {
  background: rgba(212, 175, 55, 0.16);
  border-color: #d4af37;
  border-style: solid;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
  transform: scale(1.015);
}

.placeholder-icon {
  font-size: 26px;
  line-height: 1;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.placeholder-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--studio-text, #1e293b);
  line-height: 1.2;
}

.placeholder-sublabel {
  font-size: 10px;
  opacity: 0.75;
  color: var(--studio-text, #1e293b);
}

.canvas-ar-print-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(11, 13, 16, 0.88);
  border: 1px solid #d4af37;
  color: #f5e7b2;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Spread Panorama Layout (Double-Page Spread across Right and Left Pages) */
.canvas-photo-item.is-spread-item,
.canvas-placeholder-item.is-spread-item {
  width: 420px !important;
  height: 420px !important;
  left: 0 !important;
  top: 0 !important;
}

.canvas-photo-item.is-spread-item .photo-inner-wrap {
  overflow: hidden !important;
  direction: ltr !important;
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
}

.canvas-spread-photo-img {
  position: absolute !important;
  top: 0 !important;
  width: 840px !important;
  height: 420px !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
}

.canvas-spread-photo-img.is-left-part {
  left: 0 !important;
  right: auto !important;
}

.canvas-spread-photo-img.is-right-part {
  left: -420px !important;
  right: auto !important;
}

.canvas-placeholder-item.is-spread-item .placeholder-inner-wrap {
  direction: rtl !important;
  border-style: dashed;
  border-color: rgba(212, 175, 55, 0.45);
}

.canvas-placeholder-item.is-spread-item.is-spread-part-right .placeholder-inner-wrap {
  border-left-style: dotted;
  border-left-width: 2px;
}

.canvas-placeholder-item.is-spread-item.is-spread-part-left .placeholder-inner-wrap {
  border-right-style: dotted;
  border-right-width: 2px;
}

/* QR Item */
.qr-inner-wrap {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.canvas-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.qr-scan-tag {
  display: none !important;
}

/* Selected Item Bounding Box & 4 Corner Resize Handles */
.canvas-item.is-selected {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}
/* Selection handles stay elevated at z-index: 30 so they remain easy to grab even when an element is tucked behind another */
.canvas-item.is-selected .resize-handle,
.canvas-item.is-selected .rotate-handle,
.canvas-item.is-selected .rotate-handle-line,
.canvas-item.is-selected .text-edge-handle {
  z-index: 30 !important;
}

.resize-handle {
  width: 13px;
  height: 13px;
  background: #ffffff;
  border: 2.5px solid #0b0d10;
  box-shadow: 0 0 0 1.5px #d4af37;
  border-radius: 50%;
  position: absolute;
  z-index: 30;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.resize-handle.handle-nw {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}
.resize-handle.handle-ne {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}
.resize-handle.handle-sw {
  bottom: -7px;
  left: -7px;
  cursor: nesw-resize;
}
.resize-handle.handle-se {
  bottom: -7px;
  right: -7px;
  cursor: nwse-resize;
}

/* Edge Handles for Independent Crop / Edge Adjustments */
.resize-handle.handle-n,
.resize-handle.handle-s {
  width: 26px;
  height: 8px;
  border-radius: 4px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.resize-handle.handle-n {
  top: -4px;
}
.resize-handle.handle-s {
  bottom: -4px;
}

.resize-handle.handle-e,
.resize-handle.handle-w {
  width: 8px;
  height: 26px;
  border-radius: 4px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.resize-handle.handle-e {
  right: -4px;
}
.resize-handle.handle-w {
  left: -4px;
}

/* Rotation Handle for Items */
.rotate-handle-line {
  position: absolute;
  top: -22px;
  left: 50%;
  width: 1.5px;
  height: 22px;
  background: var(--gold-primary, #d4af37);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 38;
}

.rotate-handle {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0b0d10;
  border: 1.5px solid var(--gold-primary, #d4af37);
  color: #f5e7b2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: grab;
  z-index: 45;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.rotate-handle:hover {
  transform: translateX(-50%) scale(1.15);
  background: var(--gold-primary, #d4af37);
  color: #0b0d10;
}
.rotate-handle.dragging,
.rotate-handle:active {
  cursor: grabbing;
  transform: translateX(-50%) scale(1.22);
  background: var(--gold-primary, #d4af37);
  color: #0b0d10;
}

/* Text Element on Canvas */
.canvas-text-item {
  position: absolute;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1.5px dashed transparent;
  cursor: grab;
  user-select: none;
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100% - 12px);
  min-width: 40px;
  transform-origin: center center;
}
.canvas-text-item:hover {
  border-color: rgba(212, 175, 55, 0.45);
}
.canvas-text-item.is-selected {
  border: 1.5px dashed #d4af37;
  outline: none;
  background: rgba(212, 175, 55, 0.05);
}
.canvas-text-item.dragging {
  cursor: grabbing;
}

.drag-handle {
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.drag-handle.dragging {
  cursor: grabbing;
}

/* Text Anchor Bar with Move + Rotate Handles */
.text-anchor-bar {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0b0d10;
  border: 1px solid var(--gold-primary, #d4af37);
  border-radius: 999px;
  padding: 2px 7px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: auto;
  white-space: nowrap;
}
.canvas-text-item:hover .text-anchor-bar,
.canvas-text-item.is-selected .text-anchor-bar {
  opacity: 1;
}

.text-anchor-bar .text-drag-handle {
  position: static;
  transform: none;
  background: transparent;
  border: none;
  padding: 0 4px;
  box-shadow: none;
  color: #f5e7b2;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: grab;
  opacity: 1;
}
.text-anchor-bar .text-drag-handle:active {
  cursor: grabbing;
}

.text-anchor-bar .text-rotate-handle {
  position: static;
  transform: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.25);
  border: 1px solid var(--gold-primary, #d4af37);
  color: #f5e7b2;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  box-shadow: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.text-anchor-bar .text-rotate-handle:hover {
  background: var(--gold-primary, #d4af37);
  color: #0b0d10;
  transform: scale(1.15);
}
.text-anchor-bar .text-rotate-handle.dragging,
.text-anchor-bar .text-rotate-handle:active {
  cursor: grabbing;
  background: var(--gold-primary, #d4af37);
  color: #0b0d10;
}

/* Fallback standalone text drag handle */
.text-drag-handle {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: #0b0d10;
  color: #f5e7b2;
  border: 1px solid #d4af37;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 35;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: auto;
}
.text-drag-handle:active {
  cursor: grabbing;
  transform: translateX(-50%) scale(1.05);
}
.canvas-text-item:hover .text-drag-handle,
.canvas-text-item.is-selected .text-drag-handle,
.text-drag-handle:focus {
  opacity: 1;
}

/* Cross-page smooth drag */
.book-spread-container.is-dragging-item .book-page-surface,
.modern-book-spread.is-dragging-item .book-page-surface,
.book-page-surface.is-dragging-active {
  overflow: visible !important;
}
.canvas-item.dragging {
  z-index: 1000 !important;
}

.canvas-text-editable {
  width: 100%;
  outline: none;
  line-height: 1.32;
  min-height: 24px;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: text;
}

/* AR Photo Protection against Sticker collisions */
.canvas-item.ar-collision-danger {
  outline: 2px dashed #ef4444 !important;
  outline-offset: 3px !important;
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.85)) !important;
  animation: arCollisionPulse 0.8s infinite alternate ease-in-out;
}

.canvas-photo-item.ar-target-protected {
  outline: 2px solid #ef4444 !important;
  outline-offset: 2px !important;
  animation: arCollisionPulse 0.8s infinite alternate ease-in-out;
}

@keyframes arCollisionPulse {
  0% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4), 0 0 12px rgba(239, 68, 68, 0.5); }
  100% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.8), 0 0 22px rgba(239, 68, 68, 0.9); }
}

/* Sticker Warning Toast */
.sticker-warning-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border: 1px solid rgba(239, 68, 68, 0.65);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(239, 68, 68, 0.35);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
  text-align: right;
  max-width: 90vw;
}

.sticker-warning-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Modern Studio Header (Albume / WOW Style)
   ========================================================================== */
.modern-studio-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--studio-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

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

.studio-back-link {
  color: var(--studio-text-muted);
  text-decoration: none;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.studio-back-link:hover {
  background: #f1f5f9;
  color: var(--studio-text);
}

.studio-logo-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.studio-logo-badge {
  font-weight: 900;
  font-size: 18px;
  color: var(--studio-text);
  letter-spacing: -0.5px;
}

.studio-sub-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--studio-accent);
  background: var(--studio-accent-light);
  padding: 1px 6px;
  border-radius: 4px;
}

.header-divider-v {
  width: 1px;
  height: 20px;
  background: var(--studio-border);
}

.studio-project-title-box {
  display: flex;
  align-items: center;
  gap: 4px;
}

.studio-title-input {
  border: 1px solid transparent;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  color: var(--studio-text);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  max-width: 220px;
}

.studio-title-input:hover, .studio-title-input:focus {
  border-color: var(--studio-border);
  background: #f8fafc;
  outline: none;
}

.title-edit-hint {
  font-size: 11px;
  opacity: 0.5;
}

/* Center Segmented Switcher */
.header-center-switcher {
  display: flex;
  align-items: center;
}

.studio-segmented-control {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 4px;
  border: 1px solid var(--studio-border);
}

.studio-segment-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--studio-text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.studio-segment-btn:hover {
  color: var(--studio-text);
}

.studio-segment-btn.active {
  background: #ffffff;
  color: var(--studio-text);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.studio-segment-btn .seg-icon {
  font-size: 14px;
}

/* Header Action Buttons */
.header-actions-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-studio-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
  background: #ffffff;
  color: var(--studio-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-studio-secondary:hover {
  background: #f8fafc;
  border-color: var(--studio-border-strong);
}

.btn-studio-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--studio-accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
  transition: var(--transition-fast);
}

.btn-studio-primary:hover {
  background: var(--studio-accent-hover);
}

/* ==========================================================================
   Modern Designer Workspace Layout (WOW / Albume Style)
   ========================================================================== */
.modern-designer-workspace {
  display: flex;
  height: calc(100vh - 56px);
  width: 100%;
  overflow: hidden;
  background: var(--studio-bg);
  position: relative;
}

.designer-stage-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #e9edf2;
}

/* Top Floating Minimal Action Toolbar */
.floating-action-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--studio-border);
  max-width: calc(100% - 32px);
  overflow-x: auto;
  scrollbar-width: none;
}

.floating-action-toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-actions-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.studio-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--studio-text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.studio-tool-btn:hover {
  background: #f1f5f9;
}

.studio-tool-btn.danger:hover {
  background: #fee2e2;
  color: var(--studio-rose);
}

.studio-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.tool-icon {
  font-size: 15px;
  margin-bottom: 2px;
}

.tool-divider-v {
  width: 1px;
  height: 24px;
  background: var(--studio-border);
  margin: 0 4px;
}

.toolbar-context-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-inline-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.studio-select-sm {
  height: 30px;
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--studio-text);
}

.studio-icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--studio-text);
  cursor: pointer;
  transition: var(--transition-fast);
}

.studio-icon-btn:hover {
  background: #f1f5f9;
}

.studio-icon-btn.active {
  background: var(--studio-accent);
  color: #fff;
  border-color: var(--studio-accent);
}

.color-swatches-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.color-swatches-row .btn-text-color,
.color-swatches-row .btn-frame-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.1s ease;
  padding: 0;
}

.color-swatches-row .btn-text-color:hover,
.color-swatches-row .btn-frame-color:hover {
  transform: scale(1.15);
}

.custom-color-picker-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  margin-right: 2px;
}

.hidden-color-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.color-picker-icon-btn {
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--studio-border);
  background: #ffffff;
  cursor: pointer;
  transition: background 0.15s;
}

.color-picker-icon-btn:hover {
  background: #f1f5f9;
}

/* Crop Buttons in Context Toolbar */
.studio-crop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm, 6px);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--studio-border, #e2e8f0);
  background: #ffffff;
  color: var(--studio-text, #1e293b);
}

.studio-crop-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.studio-crop-btn.active {
  border-color: #d4af37 !important;
  background: rgba(212, 175, 55, 0.18) !important;
  color: #92400e !important;
  font-weight: 700 !important;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.28) !important;
}

#btn-crop-pan.studio-crop-btn {
  border-color: rgba(212, 175, 55, 0.6);
  background: rgba(212, 175, 55, 0.1);
  color: #92400e;
}

#btn-crop-pan.studio-crop-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: #d4af37;
}

/* Attach Video (AR) Button in Toolbar */
.studio-ar-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid #059669;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.studio-ar-pill-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.studio-ar-pill-btn .ar-pill-icon {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.studio-ar-pill-btn .ar-pill-text {
  white-space: nowrap;
  line-height: 1;
}

.studio-ar-pill-btn.is-attached {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border-color: #4338ca;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.studio-ar-pill-btn.is-attached:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

/* Canvas Viewport */
.canvas-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: none;
  padding: 24px 20px 20px 20px;
}

.modern-book-spread {
  display: flex;
  position: relative;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.14);
  border-radius: 6px;
  background: #ffffff;
  transform: scale(var(--spread-zoom, 1.25));
  transform-origin: center center;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  margin: 16px auto;
}

.modern-book-spread.is-cover-spread {
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
}

.toolbar-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-level-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--studio-text);
  min-width: 38px;
  text-align: center;
  user-select: none;
}

.btn-studio-secondary.btn-saved-success {
  border-color: #10b981 !important;
  color: #059669 !important;
  background: #ecfdf5 !important;
}

.book-page-wrapper {
  display: flex;
  flex-direction: column;
}

.book-page-label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--studio-text-muted);
  padding: 6px 0;
}

.modern-book-spine {
  width: 14px;
  background: linear-gradient(to right, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.03) 50%, rgba(0,0,0,0.12) 100%);
  position: relative;
  z-index: 5;
}

/* Bottom Spread Filmstrip (WOW & Albume Style) */
.bottom-filmstrip-container {
  height: 94px;
  background: #ffffff;
  border-top: 1px solid var(--studio-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: relative;
  z-index: 20;
}

.filmstrip-scroll-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior: contain;
  padding: 6px 4px;
  scrollbar-width: thin;
}

.filmstrip-item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.filmstrip-thumb-box {
  width: 78px;
  height: 44px;
  background: #f8fafc;
  border: 2px solid var(--studio-border);
  border-radius: 4px;
  position: relative;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--studio-text-muted);
  box-shadow: var(--studio-shadow-sm);
}

.filmstrip-thumb-box:hover {
  border-color: var(--studio-border-strong);
}

.filmstrip-item-card.active .filmstrip-thumb-box {
  border-color: var(--studio-accent);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

.filmstrip-thumb-ar-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #0ea5e9;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 3px;
  border-radius: 3px;
}

.filmstrip-thumb-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--studio-text-muted);
}

.filmstrip-item-card.active .filmstrip-thumb-title {
  color: var(--studio-accent);
  font-weight: 700;
}

/* Filmstrip Drag Reorder */
.filmstrip-item-card.is-draggable {
  cursor: grab;
  position: relative;
  user-select: none;
}
.filmstrip-item-card.is-draggable:active {
  cursor: grabbing;
}
.filmstrip-item-card.dragging {
  opacity: 0.35;
  transform: scale(0.92);
}
.filmstrip-item-card.drop-before {
  box-shadow: -4px 0 0 0 #0284c7;
}
.filmstrip-item-card.drop-after {
  box-shadow: 4px 0 0 0 #0284c7;
}

/* Cross-page drag hover indicator */
.book-page-surface.drag-over-sibling {
  outline: 2.5px dashed #0284c7 !important;
  outline-offset: -5px;
  background-color: rgba(2, 132, 199, 0.08) !important;
}


.filmstrip-nav-arrow {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  color: var(--studio-text);
  transition: var(--transition-fast);
}

.filmstrip-nav-arrow:hover {
  background: #f1f5f9;
}

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

.btn-filmstrip-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
  background: #f8fafc;
  color: var(--studio-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-filmstrip-add:hover {
  background: #f1f5f9;
  border-color: var(--studio-border-strong);
}

.btn-filmstrip-delete {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition-fast);
}

.btn-filmstrip-delete:hover {
  background: #fee2e2;
}

/* Modern Tabbed Right Sidebar */
.modern-tabbed-sidebar {
  width: 420px;
  flex-shrink: 0;
  background: #ffffff;
  border-left: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 25;
}

.sidebar-tab-nav {
  display: flex;
  height: 48px;
  border-bottom: 1px solid var(--studio-border);
  background: #f8fafc;
  padding: 0 4px;
}

.sidebar-nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: var(--studio-text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.sidebar-nav-item .nav-icon {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.sidebar-nav-item:hover {
  color: var(--studio-text);
  background: rgba(0, 0, 0, 0.02);
}

.sidebar-nav-item.active {
  color: var(--studio-accent);
  border-bottom-color: var(--studio-accent);
  background: #ffffff;
  font-weight: 700;
}

@media (max-width: 1280px) {
  .modern-tabbed-sidebar {
    width: 380px;
  }
  .sidebar-nav-item {
    font-size: 12px;
    gap: 3px;
    padding: 0 2px;
  }
}

.sidebar-tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

.sidebar-tab-content.active {
  display: flex;
}

.pane-action-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.pane-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.btn-sidebar-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--studio-accent);
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sidebar-upload:hover {
  background: var(--studio-accent-hover);
}

.btn-sidebar-gphotos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sidebar-gphotos:hover {
  background: #f8fafc;
  border-color: #4285f4;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
  transform: translateY(-1px);
}

.btn-sidebar-magic {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--studio-border);
  color: var(--studio-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  width: 100%;
}

.btn-sidebar-magic:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.pane-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--studio-text-muted);
  margin-bottom: 12px;
  padding: 0 2px;
}

.modern-tray-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  overflow-y: auto;
}

/* Template Cards Grid */
.templates-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.btn-template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--studio-border);
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-template-card:hover {
  background: #f1f5f9;
  border-color: var(--studio-accent);
}

.tpl-icon-box {
  font-size: 26px;
  margin-bottom: 8px;
}

.tpl-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--studio-text);
}

/* Stickers & Clipart Sidebar Panel */
.stickers-category-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 10px 2px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}
.btn-sticker-cat {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.btn-sticker-cat:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.btn-sticker-cat.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.stickers-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-right: 2px;
}
.sticker-tray-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 8px 10px 8px;
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}
.sticker-tray-card:hover {
  background: #ffffff;
  border-color: #d4af37;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.22);
  transform: translateY(-2px);
}
.sticker-tray-card:active {
  cursor: grabbing;
}
.sticker-tray-thumb {
  width: 58px;
  height: 58px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}
.sticker-tray-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  margin-top: 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.btn-remove-custom-sticker {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.9);
  color: #ffffff;
  border: none;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}
.sticker-tray-card:hover .btn-remove-custom-sticker {
  opacity: 1;
}
.btn-remove-custom-sticker:hover {
  transform: scale(1.15);
  background: #e11d48;
}

/* Style Group */
.style-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.style-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-text);
}

.studio-select-full {
  width: 100%;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
  background: #ffffff;
  padding: 0 10px;
  font-size: 13px;
  color: var(--studio-text);
}

.style-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--studio-text);
  cursor: pointer;
}

.style-hint-text {
  font-size: 11.5px;
  color: var(--studio-text-muted);
}

/* Attach AR Modal Styling */
.attach-ar-modal-card {
  max-width: 560px;
  width: 95%;
  background: #ffffff;
  border: 1px solid var(--studio-border);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  overflow: hidden;
  box-sizing: border-box;
}

.attach-ar-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.attach-target-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.attach-target-img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #000;
  flex-shrink: 0;
}

.attach-target-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.attach-target-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-target-status {
  font-size: 12px;
  color: #64748b;
}

.attach-source-switcher {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.attach-source-switcher .btn-source-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.attach-source-switcher .btn-source-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.attach-video-box {
  width: 100%;
  box-sizing: border-box;
}

.attach-dropzone {
  position: relative;
  width: 100%;
  min-height: 200px;
  max-height: 270px;
  box-sizing: border-box;
  border: 2px dashed #38bdf8;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.attach-dropzone:hover {
  background: #f0f9ff;
  border-color: #0284c7;
}

.attach-dropzone.has-video {
  padding: 0;
  border-style: solid;
  border-color: #cbd5e1;
  background: #000000;
}

.attach-dropzone-hint {
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.attach-dropzone-hint .dropzone-icon {
  font-size: 36px;
  margin-bottom: 2px;
}

.attach-dropzone-hint .dropzone-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.attach-dropzone-hint .dropzone-hint {
  font-size: 12px;
  color: #64748b;
}

/* Video Preview Container & Player - Strictly bounded! */
.attach-video-preview-wrap {
  position: relative;
  width: 100%;
  height: 250px;
  max-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  overflow: hidden;
  border-radius: 10px;
  box-sizing: border-box;
}

.attach-video-element {
  max-width: 100% !important;
  max-height: 250px !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
  background: #000000;
}

.attach-video-overlay-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.attach-video-badge {
  pointer-events: auto;
  background: rgba(16, 185, 129, 0.9);
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.btn-change-attached-video {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.btn-change-attached-video:hover {
  background: #0284c7;
  border-color: #38bdf8;
}

/* Dedicated Realtime Progress Bar */
.attach-progress-wrap {
  width: 100%;
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  box-sizing: border-box;
}

.attach-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.attach-progress-text {
  color: #0284c7;
}

.attach-progress-percent {
  color: #10b981;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 14px;
  direction: ltr;
  font-weight: 800;
}

.attach-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

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

.attach-status-msg {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  min-height: 18px;
  text-align: center;
}

.attach-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.btn-modal-action {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-modal-action.primary-gold {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-modal-action.primary-gold:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.btn-modal-action.primary-gold:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-modal-action.btn-danger-action {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.btn-modal-action.btn-danger-action:hover {
  background: #ffe4e6;
}

/* UI Hiding: Hide video file upload switcher from UI while preserving full code functionality */
.video-source-switcher,
.attach-source-switcher,
#tab-attach-file,
.video-source-switcher button[data-type="file"] {
  display: none !important;
}

/* Backgrounds Panel & Controls */
.bg-scope-bar {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 14px;
}

.btn-bg-scope {
  flex: 1;
  padding: 7px 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-bg-scope:hover {
  color: #0f172a;
}

.btn-bg-scope.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.bg-colors-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.btn-bg-color-swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, outline 0.15s ease;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 0;
}

.btn-bg-color-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.btn-bg-color-swatch.active {
  outline: 2px solid var(--gold-primary, #d4af37);
  outline-offset: 2px;
}

.sidebar-row-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-sidebar-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sidebar-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.bg-category-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  scrollbar-width: none;
}

.bg-category-bar::-webkit-scrollbar {
  display: none;
}

.btn-bg-cat {
  padding: 4px 9px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-bg-cat:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-bg-cat.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #1e293b;
}

.bg-textures-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.btn-bg-texture-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  background: #ffffff;
  cursor: grab;
  transition: all 0.15s ease;
  text-align: right;
  padding: 0;
}

.btn-bg-texture-card:hover {
  border-color: var(--gold-primary, #d4af37);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-bg-texture-card.active {
  outline: 2px solid var(--gold-primary, #d4af37);
  outline-offset: 2px;
}

.bg-texture-preview {
  height: 48px;
  width: 100%;
  border-bottom: 1px solid #e2e8f0;
  background-size: cover;
  background-position: center;
}

.bg-texture-name {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Template Dragging Styles */
.btn-template-card {
  cursor: grab;
  user-select: none;
}

.btn-template-card:active {
  cursor: grabbing;
}

/* ==========================================================================
   Frames Tab in Sidebar & Visual Previews
   ========================================================================== */
.frames-settings-box {
  background: var(--bg-surface-elevated, #f8fafc);
  border: 1px solid var(--studio-border, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.dark-theme .frames-settings-box,
body.dark-mode .frames-settings-box {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}
.frames-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.frames-settings-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--studio-text-secondary, #64748b);
  white-space: nowrap;
}
.frames-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.btn-frame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px;
  background: #ffffff;
  border: 1.5px solid var(--studio-border, #e2e8f0);
  border-radius: var(--radius-md, 8px);
  cursor: grab;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  text-align: center;
}
.dark-theme .btn-frame-card,
body.dark-mode .btn-frame-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}
.btn-frame-card:hover {
  border-color: var(--gold-primary, #d4af37);
  background: rgba(212, 175, 55, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.btn-frame-card.active {
  border-color: var(--gold-primary, #d4af37);
  background: rgba(212, 175, 55, 0.12);
  box-shadow: 0 0 0 1.5px var(--gold-primary, #d4af37);
}
.btn-frame-card:active {
  cursor: grabbing;
}
.btn-frame-card.is-disabled-for-ar {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  pointer-events: none !important;
}

/* Rubber-band Marquee Selection */
.selection-marquee {
  position: absolute;
  border: 1.5px dashed var(--gold-primary, #d4af37);
  background: rgba(212, 175, 55, 0.14);
  pointer-events: none;
  z-index: 999;
  border-radius: 2px;
}
.frame-mini-preview {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.frame-mini-img {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #60a5fa, #818cf8);
  display: block;
}
/* 10 Mini Preview Frame Styles */
.frame-prev-borderless .frame-mini-img {
  border-radius: 2px;
}
.frame-prev-polaroid {
  background: #ffffff;
  padding: 4px 4px 12px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.frame-prev-white {
  background: #ffffff;
  padding: 5px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
.frame-prev-gold {
  border: 3px solid #d4af37;
  border-radius: 2px;
}
.frame-prev-double-gold {
  background: #ffffff;
  padding: 3px;
  border: 1.5px solid #d4af37;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3.5px #d4af37;
}
.frame-prev-passepartout {
  background: #f8fafc;
  padding: 8px;
  box-shadow: inset 0 0 0 1px #cbd5e1, 0 3px 8px rgba(0, 0, 0, 0.2);
}
.frame-prev-shadow-float {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  border-radius: 2px;
}
.frame-prev-circle,
.frame-prev-circle .frame-mini-img {
  border-radius: 50%;
}
.frame-prev-rounded,
.frame-prev-rounded .frame-mini-img {
  border-radius: 10px;
}
.frame-prev-floral {
  border: 2px solid #d4af37;
  position: relative;
}
.frame-prev-floral::before,
.frame-prev-floral::after {
  content: '✦';
  position: absolute;
  font-size: 8px;
  color: #d4af37;
  line-height: 1;
}
.frame-prev-floral::before {
  top: 1px;
  left: 2px;
}
.frame-prev-floral::after {
  bottom: 1px;
  right: 2px;
}
.frame-card-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--studio-text, #0f172a);
  line-height: 1.2;
}
.dark-theme .frame-card-name,
body.dark-mode .frame-card-name {
  color: #f1f5f9;
}

/* ==========================================================================
   Inner Photo Pan & Repositioning Mode (Strictly for regular photos)
   ========================================================================== */
.canvas-photo-item.is-panning-active {
  outline: 2px dashed #f59e0b !important;
  outline-offset: 2px;
  z-index: 9999 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}
.canvas-photo-item.is-panning-active,
.canvas-photo-item.is-panning-active .photo-inner-wrap,
.canvas-photo-item.is-panning-active .canvas-photo-img {
  cursor: grab !important;
  touch-action: none;
}
.canvas-photo-item.is-panning-active.is-dragging,
.canvas-photo-item.is-panning-active.is-dragging .photo-inner-wrap,
.canvas-photo-item.is-panning-active.is-dragging .canvas-photo-img {
  cursor: grabbing !important;
}
.canvas-photo-item.is-panning-active .resize-handle,
.canvas-photo-item.is-panning-active .rotate-handle,
.canvas-photo-item.is-panning-active .rotate-handle-line {
  display: none !important;
}
.photo-pan-hint-badge {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(245, 158, 11, 0.5);
  pointer-events: auto;
  z-index: 10000;
  animation: fadeInPanBadge 0.2s ease-out;
}
@keyframes fadeInPanBadge {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.btn-done-pan {
  background: #f59e0b;
  color: #0f172a;
  border: none;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-done-pan:hover {
  background: #d97706;
  color: #ffffff;
  transform: scale(1.05);
}

/* ==========================================================================
   Draft Auto-Recovery Banner (Welcome Back & Continue Editing)
   ========================================================================== */
.draft-recovery-banner {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-bottom: 1.5px solid #bfdbfe;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  animation: slideDownBanner 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 45;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

.draft-recovery-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.draft-recovery-icon {
  font-size: 24px;
}
.draft-recovery-text {
  display: flex;
  flex-direction: column;
}
.draft-recovery-text strong {
  font-size: 14px;
  color: #1e3a8a;
  font-weight: 800;
}
.draft-recovery-text span {
  font-size: 12px;
  color: #475569;
}
.draft-recovery-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-draft-resume {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
}
.btn-draft-resume:hover {
  background: #0369a1;
  transform: translateY(-1px);
}
.btn-draft-dismiss {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-draft-dismiss:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

/* ==========================================================================
   Smart Anti-Abandonment Save Toast
   ========================================================================== */
.smart-save-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  z-index: 90;
  animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.smart-save-toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}
.smart-save-icon {
  font-size: 18px;
}
.smart-save-toast-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-smart-save-trigger {
  background: #10b981;
  border: none;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}
.btn-smart-save-trigger:hover {
  background: #059669;
  transform: scale(1.04);
}
.btn-smart-save-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}
.btn-smart-save-close:hover {
  color: #ffffff;
}

/* ==========================================================================
   Google Photos Picker & Modal
   ========================================================================== */
.gphotos-modal-card {
  max-width: 520px !important;
  width: 90vw;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15) !important;
  border-radius: 18px !important;
  padding: 28px !important;
}
.gphotos-modal-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 10px auto;
}
.btn-gphotos-connect {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}
.btn-gphotos-connect:hover {
  border-color: #4285f4;
  background: #f8fafc;
  box-shadow: 0 4px 16px rgba(66, 133, 244, 0.15);
  transform: translateY(-1px);
}
.gphotos-privacy-note {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  text-align: right;
}
.gphotos-demo-box {
  margin-top: 18px;
  background: #f0fdf4;
  border: 1.5px dashed #86efac;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.gphotos-demo-label {
  font-size: 13px;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 8px;
}
.btn-gphotos-demo {
  background: #15803d;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.2);
}
.btn-gphotos-demo:hover {
  background: #166534;
  transform: translateY(-1px);
}
.gphotos-status-msg {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.gphotos-status-msg.status-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.gphotos-status-msg.status-success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #86efac;
}
.gphotos-status-msg.status-error {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}
.gphotos-settings-accordion {
  margin-top: 16px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  text-align: center;
}
.btn-toggle-settings {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn-toggle-settings:hover {
  color: #0f172a;
  text-decoration: underline;
}
.gphotos-settings-box {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
}
.gphotos-input-group {
  margin-bottom: 8px;
  text-align: right;
}
.gphotos-input-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}
.studio-input-full {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  color: #0f172a;
  background: #ffffff;
  direction: ltr;
  box-sizing: border-box;
}
.studio-input-full:focus {
  border-color: #0284c7;
  outline: none;
}
.btn-save-keys {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}




