/* ==========================================================================
   MiniZine Maker - Modern CSS & 3D Flipbook Styles
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79, 70, 229, 0.2);

  --accent: #f97316;
  --accent-hover: #ea580c;

  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border-color: #e2e8f0;
  --border-focus: #818cf8;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Hub Header (Menu Utama - PaperCraft Studio)
   ========================================================================== */

.hub-header {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hub-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: white;
}

.hub-logo {
  font-size: 1.5rem;
}

.hub-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #a5b4fc, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: 0.25rem;
}

.hub-modes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #1e293b;
  padding: 0.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid #334155;
}

.hub-mode-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hub-mode-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.hub-mode-btn.active {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.mode-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  letter-spacing: 0.04em;
}

/* App Header */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 54px;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* Nav Tabs Bar */
.nav-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-container::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.nav-tab:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.03);
}

.nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

/* Main Content Area */
.app-main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-panel.active {
  display: block;
}

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

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px var(--primary-glow);
}

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

.btn-accent {
  background: var(--accent);
  color: white;
}

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

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

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

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

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

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

.btn-danger {
  color: #ef4444;
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 0.45rem;
  border-radius: var(--radius-sm);
}

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

/* ==========================================================================
   Tab 1: Editor & Upload Grid
   ========================================================================== */

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

.toolbar-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.info-icon {
  color: var(--primary);
}

.toolbar-title {
  font-weight: 700;
  font-size: 1rem;
}

.toolbar-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

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

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

@media (max-width: 1100px) {
  .editor-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

/* Editor Card */
.editor-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  user-select: none;
}

.editor-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.editor-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.02);
}

.editor-card.is-dragging {
  opacity: 0.4;
}

/* Drag handle indication only on photos */
.card-preview-area[draggable="true"],
.pol-photo-frame[draggable="true"] {
  cursor: grab;
}

.card-preview-area[draggable="true"]:active,
.pol-photo-frame[draggable="true"]:active {
  cursor: grabbing;
}

.photo-drag-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.card-preview-area[draggable="true"]:hover .photo-drag-hint,
.pol-photo-frame[draggable="true"]:hover .photo-drag-hint {
  opacity: 0.95;
  transform: scale(1);
}

/* Custom mode Ctrl + Drag pan styles */
.card-preview-area.ctrl-hover,
.pol-photo-frame.ctrl-hover,
.card-preview-area.is-panning,
.pol-photo-frame.is-panning {
  cursor: move !important;
}

body.is-panning-active {
  cursor: move !important;
  user-select: none;
}

.card-preview-area.ctrl-hover .photo-drag-hint,
.pol-photo-frame.ctrl-hover .photo-drag-hint {
  opacity: 1 !important;
  background: var(--primary) !important;
  transform: scale(1.08) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4), 0 3px 8px rgba(0, 0, 0, 0.35);
}

#modulePolaroid .pol-photo-frame.ctrl-hover .photo-drag-hint {
  background: #f43f5e !important;
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slot-num {
  width: 26px;
  height: 26px;
  background: var(--bg-subtle);
  color: var(--text-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
}

.slot-text {
  display: flex;
  flex-direction: column;
}

.slot-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.slot-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.slot-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-cover {
  background: #fef3c7;
  color: #b45309;
}

.badge-back {
  background: #f1f5f9;
  color: #475569;
}

.badge-page {
  background: var(--primary-light);
  color: var(--primary);
}

/* Card Preview Area (Aspect ratio ~ A7 portrait 1:1.41) */
.card-preview-area {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.414;
  background: #f8fafc;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-preview-area:hover {
  border-color: var(--primary);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 1rem;
  color: var(--text-muted);
}

.upload-placeholder span {
  font-weight: 600;
  font-size: 0.82rem;
}

.upload-placeholder small {
  font-size: 0.7rem;
  color: var(--text-light);
}

.thumbnail-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  transition: transform 0.2s ease;
}

.thumbnail-wrapper.fit-cover img,
.thumbnail-wrapper.fit-fill img {
  object-fit: cover;
}

.thumbnail-wrapper.fit-contain img,
.thumbnail-wrapper.fit-fit img {
  object-fit: contain;
}

.thumbnail-wrapper.fit-stretch img {
  object-fit: fill;
}

.thumbnail-wrapper.fit-custom img {
  object-fit: cover;
}

/* ==========================================================================
   Card Fit Controls & Custom Adjustments Toolbar
   Supports: Fill | Fit | Stretch | Custom (Zoom & Pan Sliders)
   ========================================================================== */

.card-fit-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.15rem;
  margin-bottom: 0.15rem;
  width: 100%;
}

.fit-mode-toolbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  background: var(--bg-subtle, #f1f5f9);
  padding: 3px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-color, #e2e8f0);
}

.btn-fit-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0.28rem 0.2rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-fit-pill:hover {
  color: var(--text-main, #1e293b);
  background: rgba(255, 255, 255, 0.75);
}

.btn-fit-pill.active {
  background: var(--primary, #4f46e5);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

#modulePolaroid .btn-fit-pill.active {
  background: #f43f5e;
}

.custom-adjust-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm, 6px);
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: fadeIn 0.15s ease-out;
}

.adjust-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.adjust-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
}

.adjust-val {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  font-size: 0.72rem;
}

.adjust-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #cbd5e1;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
  margin: 0.2rem 0;
}

.adjust-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary, #4f46e5);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s ease;
}

.adjust-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#modulePolaroid .adjust-slider::-webkit-slider-thumb {
  background: #f43f5e;
}

.btn-reset-custom {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-reset-custom:hover {
  color: #ef4444;
  background: #fee2e2;
}

.custom-hint-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  background: var(--primary-light);
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: var(--radius-sm, 6px);
  color: var(--primary);
  font-size: 0.72rem;
  line-height: 1.3;
  margin-top: 0.25rem;
  font-weight: 500;
}

#modulePolaroid .custom-hint-badge {
  background: #ffe4e6;
  border-color: rgba(244, 63, 94, 0.2);
  color: #e11d48;
}

.custom-hint-badge svg {
  flex-shrink: 0;
}

.custom-hint-badge strong {
  color: var(--primary-hover, #4338ca);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-size: 0.7rem;
}

#modulePolaroid .custom-hint-badge strong {
  color: #be123c;
}

.hidden-file-input {
  display: none;
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-upload {
  flex: 1;
}

.card-caption-group {
  margin-top: -0.25rem;
}

.input-caption {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  background: var(--bg-surface);
  color: var(--text-main);
  transition: border-color var(--transition-fast);
}

.input-caption:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Global Drop Zone Overlay */
.global-dropzone {
  position: fixed;
  inset: 0;
  background: rgba(79, 70, 229, 0.9);
  color: white;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  pointer-events: none;
}

.global-dropzone.active {
  display: flex;
}

.dropzone-box {
  border: 4px dashed white;
  border-radius: var(--radius-xl);
  padding: 3rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

/* ==========================================================================
   Tab 2: Print Sheet / Imposition View
   ========================================================================== */

.sheet-layout-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

@media (max-width: 1024px) {
  .sheet-layout-container {
    grid-template-columns: 1fr;
  }
}

.sheet-canvas-wrapper {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  width: 100%;
}

.sheet-canvas-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.canvas-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.canvas-box {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  min-height: 420px;
}

#sheetCanvas, #polSheetCanvas {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  background: white;
  border-radius: 2px;
}

.sheet-legend {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-color {
  width: 16px;
  height: 8px;
  border-radius: 2px;
}

.legend-fold {
  border-top: 2px dashed #0284c7;
}

.legend-cut {
  border-top: 3px dashed #ef4444;
}

/* Settings Sidebar (Sticky / Fixed to Screen on Scroll) */
.settings-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  position: sticky;
  top: 75px;
  max-height: calc(100vh - 95px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.settings-card::-webkit-scrollbar {
  width: 6px;
}

.settings-card::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.settings-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.65rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.setting-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.setting-select {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.88rem;
  background: var(--bg-surface);
  color: var(--text-main);
}

.setting-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  cursor: pointer;
}

.toggle-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.export-actions-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Tab 3: Simulator Buku Mini (3D Flipbook)
   ========================================================================== */

.flipbook-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-surface);
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.flipbook-viewport {
  width: 100%;
  max-width: 860px;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1600px;
  user-select: none;
}

@media (max-width: 600px) {
  .flipbook-viewport {
    height: 380px;
  }
}

.flipbook-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
}

/* The Book Structure */
.book {
  display: flex;
  width: 640px;
  height: 450px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--transition-slow);
}

@media (max-width: 768px) {
  .book {
    width: 90vw;
    height: calc(90vw * 0.7);
    max-height: 420px;
  }
}

/* Closed Cover Mode (Right page only) */
.book.book-closed-front {
  transform: translateX(-25%);
}

/* Closed Back Cover Mode (Left page only) */
.book.book-closed-back {
  transform: translateX(25%);
}

.book-page {
  flex: 1;
  height: 100%;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.book-page:hover {
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2);
}

/* Page Curvature / Rounded Corners */
.book-page-left {
  border-radius: 8px 0 0 8px;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.book-page-right {
  border-radius: 0 8px 8px 0;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

/* Spine Shadow Simulation */
.spine-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35px;
  pointer-events: none;
  z-index: 10;
}

.spine-shadow-left {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}

.spine-shadow-right {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}

.book-spine {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.15);
  transform: translateX(-50%);
  z-index: 20;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.page-content {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.page-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-image-wrapper img {
  width: 100%;
  height: 100%;
}

.page-image-wrapper.fit-cover img {
  object-fit: cover;
}

.page-image-wrapper.fit-contain img {
  object-fit: contain;
}

.page-caption-overlay {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  max-width: 80%;
  backdrop-filter: blur(4px);
  z-index: 15;
}

.page-number-tag {
  position: absolute;
  bottom: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.8);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  z-index: 15;
}

.empty-page-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  color: var(--text-light);
  padding: 1.5rem;
}

.placeholder-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.placeholder-sub {
  font-size: 0.75rem;
}

/* Flipbook Controls Bar */
.flipbook-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.control-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.spread-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 200px;
}

.spread-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.spread-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.flipbook-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   Tab 4: Panduan Lipat & Gunting (Folding Guide)
   ========================================================================== */

.guide-hero {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 2.5rem;
}

.guide-hero h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.guide-hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

@media (max-width: 900px) {
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .steps-grid {
    grid-template-columns: 1fr;
  }
}

.step-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-badge {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

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

.step-diagram {
  width: 100%;
  height: 160px;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.step-diagram svg {
  max-width: 100%;
  max-height: 100%;
}

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

/* ==========================================================================
   Toasts & Spinner
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: #065f46;
}

.toast-error {
  background: #991b1b;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Polaroid Studio Module Styles
   ========================================================================== */

#modulePolaroid {
  display: none;
}

.pol-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .pol-editor-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .pol-editor-grid {
    grid-template-columns: 1fr;
  }
}

/* Authentic Polaroid Card in Editor */
.pol-editor-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  user-select: none;
  position: relative;
}

.pol-editor-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.pol-editor-card.drag-over {
  border-color: var(--primary) !important;
  transform: scale(1.02);
}

.pol-editor-card.is-dragging {
  opacity: 0.4;
}

.pol-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.pol-header-left {
  display: flex;
  align-items: center;
}

.pol-header-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.pol-num-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.pol-card-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pol-date-top {
  width: 84px;
  font-size: 0.72rem;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  text-align: right;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 3px;
  padding: 0.1rem 0.25rem;
  background: rgba(255, 255, 255, 0.5);
  outline: none;
  transition: all var(--transition-fast);
}

.pol-date-top:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.15);
}

/* Photo Frame inside Card (Aspect ratio 46:62 / ~3:4) */
.pol-photo-frame {
  width: 100%;
  aspect-ratio: 46 / 62;
  background: #0f172a;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
  position: relative;
}

.pol-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.pol-photo-frame.fit-cover img,
.pol-photo-frame.fit-fill img {
  object-fit: cover;
}

.pol-photo-frame.fit-contain img,
.pol-photo-frame.fit-fit img {
  object-fit: contain;
}

.pol-photo-frame.fit-stretch img {
  object-fit: fill;
}

.pol-photo-frame.fit-custom img {
  object-fit: cover;
}

.pol-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
}

.hidden-pol-input {
  display: none;
}

.pol-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.25rem;
  min-height: 2.2rem;
  justify-content: center;
}

.pol-card-bottom.is-clean {
  min-height: 1.8rem;
}

.pol-caption-disabled-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.35rem 0.2rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.025);
  border: 1px dashed rgba(0, 0, 0, 0.1);
  font-style: italic;
  user-select: none;
}

.pol-caption-input {
  width: 100%;
  border: none;
  background: transparent;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
  padding: 0.3rem 0.2rem;
  font-size: 0.95rem;
  text-align: center;
  outline: none;
}

.pol-caption-input:focus {
  border-bottom-color: var(--primary);
}

.pol-date-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.15rem 0.2rem;
  font-size: 0.72rem;
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  outline: none;
  opacity: 0.8;
}

/* Desk Gallery (Corkboard / Wood Desk) */
.pol-desk-board {
  background: #e2d9cc;
  background-image: radial-gradient(#d3c6b2 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  padding: 3rem 2rem;
  border-radius: var(--radius-xl);
  border: 12px solid #854d0e;
  box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.15), var(--shadow-xl);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem 1.5rem;
  justify-items: center;
}

@media (max-width: 900px) {
  .pol-desk-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pol-desk-item {
  width: 100%;
  max-width: 220px;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pol-desk-item:hover {
  transform: scale(1.05) rotate(0deg) !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

.pol-washi-tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 22px;
  background: rgba(245, 158, 11, 0.7);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 100%);
  z-index: 5;
}

.pol-desk-photo {
  width: 100%;
  aspect-ratio: 46 / 62;
  overflow: hidden;
  background: #1e293b;
  border-radius: 2px;
}

.pol-desk-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pol-desk-photo.fit-cover img,
.pol-desk-photo.fit-fill img {
  object-fit: cover;
}

.pol-desk-photo.fit-contain img,
.pol-desk-photo.fit-fit img {
  object-fit: contain;
}

.pol-desk-photo.fit-stretch img {
  object-fit: fill;
}

.pol-desk-photo.fit-custom img {
  object-fit: cover;
}

.pol-empty-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 600;
}

.pol-desk-caption {
  font-size: 0.95rem;
  text-align: center;
  min-height: 1.4rem;
  word-break: break-word;
}

.pol-desk-date {
  font-size: 0.72rem;
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.pol-desk-date-top {
  text-align: right;
  font-size: 0.72rem;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  margin-top: 0.05rem;
  margin-bottom: -0.35rem;
  padding-right: 0.15rem;
  letter-spacing: 0.5px;
}

/* Screen mode: print containers are hidden */
.print-container {
  display: none;
}

/* ==========================================================================
   Print Stylesheet (@media print)
   Supports printing MiniZine (Landscape) and Polaroid (Portrait or Landscape)
   ========================================================================== */

@media print {
  @page {
    margin: 0;
  }

  html, body {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    overflow: hidden !important;
  }

  /* Hide regular UI elements */
  .hub-header,
  .app-header,
  .nav-bar,
  .app-main,
  .toast-container,
  .global-dropzone {
    display: none !important;
  }

  /* If printing Polaroid module */
  body[data-print-mode="polaroid"] #printContainer {
    display: none !important;
  }

  body[data-print-mode="polaroid"] #printPolaroidContainer {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    align-items: center !important;
    justify-content: center !important;
    background: white !important;
    z-index: 99999 !important;
  }

  /* If printing MiniZine module */
  body:not([data-print-mode="polaroid"]) #printPolaroidContainer {
    display: none !important;
  }

  body:not([data-print-mode="polaroid"]) #printContainer {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    align-items: center !important;
    justify-content: center !important;
    background: white !important;
    z-index: 99999 !important;
  }

  .print-image {
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain !important;
    margin: auto !important;
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
  }
}

