/* ==========================================================================
   PDF & Image Document Studio - CSS Stylesheet
   DodoDeck Studio Suite - Integrated with Light/Dark Theme & Full Photoshop Rulers
   ========================================================================== */

:root {
  --studio-primary: #1d4ed8;
  --studio-primary-hover: #1e40af;
  --studio-bg: #0f172a;
  --studio-sidebar: #1e293b;
  --studio-viewport: #1e2538;
  --studio-toolbar-bg: #ffffff;
  --studio-border: #e2e8f0;
  --studio-text: #0f172a;
  --studio-text-muted: #64748b;
  --guide-color: #06b6d4; /* Photoshop Cyan Guide Line */
}

[data-theme="dark"] {
  --studio-viewport: #090d16;
  --studio-toolbar-bg: #1e293b;
  --studio-border: #334155;
  --studio-text: #f8fafc;
  --studio-text-muted: #94a3b8;
}

/* Studio Header / Sub-Navbar */
.studio-header {
  height: 54px;
  background-color: #0b1120;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 50;
}

.studio-header-left,
.studio-header-center,
.studio-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-title-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-badge {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.studio-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-left: 12px;
}

.studio-filename {
  font-size: 13px;
  font-weight: 600;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e2e8f0;
}

.studio-pill {
  background-color: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #94a3b8;
}

/* Page Navigation */
.studio-page-nav {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 6px;
  border-radius: 8px;
  gap: 4px;
}

.studio-nav-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.studio-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.studio-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.studio-page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #cbd5e1;
}

.studio-page-indicator input {
  width: 42px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 4px;
  text-align: center;
  padding: 2px 4px;
  font-weight: 600;
  font-size: 12px;
}

/* Zoom controls */
.studio-zoom-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 6px;
  border-radius: 8px;
  font-size: 12px;
  color: #cbd5e1;
}

.studio-icon-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.studio-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Studio Buttons */
.s-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.s-btn-primary {
  background-color: var(--studio-primary);
  color: #ffffff;
}

.s-btn-primary:hover:not(:disabled) {
  background-color: var(--studio-primary-hover);
}

.s-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.s-btn-outline {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
}

.s-btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.s-btn-outline.active {
  background-color: rgba(6, 182, 212, 0.25);
  border-color: #06b6d4;
  color: #38bdf8;
}

.s-btn-success {
  background-color: #059669;
  color: #fff;
}
.s-btn-success:hover:not(:disabled) {
  background-color: #047857;
}

/* Studio Workspace Container */
.studio-workspace-container {
  display: flex;
  height: calc(100vh - 120px);
  min-height: 650px;
  width: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--studio-viewport);
}

/* Left Sidebar (Thumbnails) */
.studio-sidebar {
  width: 170px;
  background-color: #0f172a;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  transition: width 0.2s ease;
}

.studio-sidebar.collapsed {
  width: 0;
  display: none;
}

/* Right Ad Sidebar (Non-intrusive Display Slot) */
.studio-ad-sidebar {
  width: 180px;
  flex-shrink: 0;
  background-color: #0b1120;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  user-select: none;
  z-index: 10;
}

.studio-ad-header {
  width: 100%;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  text-align: center;
}

.studio-ad-body {
  flex: 1;
  width: 100%;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  overflow-y: auto;
}

.studio-banner-slot {
  width: 160px;
  min-height: 600px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 10px;
  box-sizing: border-box;
}

.studio-banner-slot .ad-pill {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.studio-banner-slot .ad-sub {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin: 0 0 4px;
}

.studio-banner-slot .ad-hint {
  font-size: 10px;
  color: #64748b;
}

@media (max-width: 1100px) {
  .studio-ad-sidebar {
    display: none !important;
  }
}

.studio-sidebar-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-sidebar-header h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin: 0;
}

.studio-thumbnails-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thumbnail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.03);
}

.thumbnail-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.thumbnail-item.active {
  background-color: rgba(37, 99, 235, 0.15);
  border: 2px solid var(--studio-primary);
}

.thumbnail-canvas {
  width: 120px;
  border-radius: 4px;
  background-color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.thumbnail-page-num {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
  font-weight: 500;
}

/* Main Editor Area */
.studio-editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Floating Toolbar */
.studio-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--studio-toolbar-bg);
  color: var(--studio-text);
  padding: 6px 14px;
  border-radius: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 60;
  border: 1px solid var(--studio-border);
  max-width: 96vw;
  flex-wrap: nowrap;
}

.s-tool-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.s-divider {
  width: 1px;
  height: 22px;
  background-color: #cbd5e1;
  margin: 0 4px;
}
[data-theme="dark"] .s-divider {
  background-color: #475569;
}

.s-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: none;
  background: transparent;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
[data-theme="dark"] .s-tool-btn {
  color: #cbd5e1;
}

.s-tool-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}
[data-theme="dark"] .s-tool-btn:hover {
  background-color: #334155;
  color: #fff;
}

.s-tool-btn.active {
  background-color: var(--studio-primary);
  color: #ffffff !important;
}

.s-select-input {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 11.5px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  max-width: 155px;
  outline: none;
}
[data-theme="dark"] .s-select-input {
  background: #0f172a;
  color: #f8fafc;
  border-color: #334155;
}

.s-font-size-control {
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
}
[data-theme="dark"] .s-font-size-control {
  border-color: #334155;
}

.s-font-size-control input {
  width: 36px;
  border: none;
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 0;
  outline: none;
  background: transparent;
  color: inherit;
}

.s-prop-btn {
  background: #f8fafc;
  border: none;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
[data-theme="dark"] .s-prop-btn {
  background: #1e293b;
  color: #cbd5e1;
}

.s-prop-btn:hover {
  background: #e2e8f0;
}
[data-theme="dark"] .s-prop-btn:hover {
  background: #334155;
}

.s-prop-btn.active {
  background: var(--studio-primary);
  color: #fff;
}

.s-icon-only-btn {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
}
[data-theme="dark"] .s-icon-only-btn {
  border-color: #334155;
}

.s-toggle-btn {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-width: 26px;
  height: 26px;
}
[data-theme="dark"] .s-toggle-btn {
  border-color: #334155;
}

.s-bg-toggle-indicator {
  display: inline-block;
  width: 9px;
  height: 9px;
  background-color: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 2px;
}

.s-color-control-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.s-color-picker-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #cbd5e1;
  cursor: pointer;
}
[data-theme="dark"] .s-color-picker-wrapper {
  border-color: #475569;
}

.s-color-picker-wrapper input[type=color] {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  border: none;
  opacity: 0;
}

.s-color-preview {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #000;
}

.s-bg-preview {
  background-color: #fff;
}

.s-danger-btn {
  border: 1px solid #fca5a5;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 6px;
  padding: 4px 8px;
}
.s-danger-btn:hover {
  background: #fecaca;
}

/* Photoshop Rulers Layout */
.s-ruler-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.s-top-ruler-bar {
  height: 18px;
  background-color: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  z-index: 30;
  cursor: ns-resize;
  user-select: none;
}

.s-ruler-corner {
  width: 18px;
  height: 18px;
  background-color: #0b1120;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 8px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  cursor: pointer;
}

.s-ruler-corner:hover {
  background-color: #ef4444;
  color: #fff;
}

.s-top-ruler-canvas {
  flex: 1;
  height: 18px;
  display: block;
}

.s-ruler-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.s-left-ruler-bar {
  width: 18px;
  background-color: #0f172a;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 30;
  cursor: ew-resize;
  user-select: none;
}

.s-left-ruler-canvas {
  width: 18px;
  height: 100%;
  display: block;
}

/* Photoshop Guide Lines */
.s-guides-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

.s-guide-line {
  position: absolute;
  pointer-events: all;
  background-color: var(--guide-color);
  z-index: 40;
}

.s-guide-line.horizontal {
  left: 0;
  width: 100%;
  height: 1.5px;
  cursor: ns-resize;
  box-shadow: 0 0 4px rgba(6, 182, 212, 0.6);
}

.s-guide-line.vertical {
  top: 0;
  height: 100%;
  width: 1.5px;
  cursor: ew-resize;
  box-shadow: 0 0 4px rgba(6, 182, 212, 0.6);
}

.s-guide-label {
  position: absolute;
  background: #0f172a;
  color: #38bdf8;
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 9px;
  font-family: monospace;
  pointer-events: none;
  white-space: nowrap;
}

/* Viewport */
.studio-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 70px 24px 40px 24px;
  position: relative;
}

/* Welcome Card (Dropzone) */
.studio-welcome-card {
  background: #ffffff;
  padding: 44px 36px;
  border-radius: 16px;
  text-align: center;
  max-width: 540px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  margin-top: 30px;
  border: 2px dashed #cbd5e1;
  transition: all 0.2s;
}
[data-theme="dark"] .studio-welcome-card {
  background: #0f172a;
  border-color: #334155;
}

.studio-welcome-card.drag-over {
  border-color: var(--studio-primary);
  background: #eff6ff;
}
[data-theme="dark"] .studio-welcome-card.drag-over {
  background: rgba(37, 99, 235, 0.15);
}

.studio-welcome-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: #eff6ff;
  color: var(--studio-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
[data-theme="dark"] .studio-welcome-icon {
  background: rgba(37, 99, 235, 0.2);
}

.studio-welcome-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--studio-text);
  margin-bottom: 8px;
}

.studio-welcome-card p {
  font-size: 14px;
  color: var(--studio-text-muted);
  line-height: 1.5;
  margin-bottom: 22px;
}

.studio-welcome-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.studio-drag-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #94a3b8;
}

/* Document Page Container */
.studio-page-container {
  position: relative;
  background-color: #ffffff;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
  margin-bottom: 50px;
  user-select: none;
}

.studio-pdf-canvas {
  display: block;
}

/* PDF.js Text Layer */
.studio-pdf-text-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.15;
  line-height: 1.0;
  pointer-events: none;
}

.studio-pdf-text-layer > span {
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  color: transparent;
  pointer-events: all;
  border-radius: 1px;
  box-sizing: border-box;
}

body[data-tool="selectText"] .studio-pdf-text-layer > span {
  pointer-events: all;
  cursor: pointer;
}

body[data-tool="selectText"] .studio-pdf-text-layer > span:hover {
  background-color: rgba(37, 99, 235, 0.25) !important;
  outline: 1px dashed #2563eb;
}

/* Interactive Overlay Layer */
.studio-editor-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.overlay-item {
  position: absolute;
  pointer-events: all;
  cursor: move;
  box-sizing: border-box;
  background-color: #ffffff;
  padding: 0;
}

.overlay-item.selected {
  outline: 1.5px solid var(--studio-primary) !important;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.25);
  z-index: 100;
}

.overlay-item.whiteout-item {
  background-color: #ffffff;
  border: none !important;
}

.overlay-item.highlight-item {
  background-color: rgba(254, 240, 138, 0.45);
}

.overlay-item.image-item {
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.overlay-item.image-item img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.overlay-item.text-item {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Quick Delete Button */
.item-delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 18px;
  height: 18px;
  background-color: #ef4444;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 110;
  transition: transform 0.15s;
}

.item-delete-btn:hover {
  background-color: #dc2626;
  transform: scale(1.15);
}

.overlay-item.selected .item-delete-btn {
  display: flex;
}

/* Editable text box inside item */
.overlay-item .text-content {
  width: 100%;
  height: 100%;
  outline: none;
  border: none;
  background: transparent;
  cursor: text;
  line-height: 1.15;
  padding: 0 1px;
}

/* Inline Edit Input */
.inline-editor-input {
  position: absolute;
  z-index: 100;
  border: 1.5px solid var(--studio-primary);
  background-color: #ffffff;
  padding: 0 2px;
  outline: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  border-radius: 1px;
  font-family: inherit;
  box-sizing: border-box;
}

/* 8-Direction Resize Handles */
.resize-handle {
  position: absolute;
  width: 7px;
  height: 7px;
  background-color: #ffffff;
  border: 1.5px solid var(--studio-primary);
  border-radius: 1px;
  display: none;
  z-index: 105;
}

.overlay-item.selected .resize-handle {
  display: block;
}

/* Corners */
.resize-handle.tl { top: -4px; left: -4px; cursor: nwse-resize; }
.resize-handle.tr { top: -4px; right: -4px; cursor: nesw-resize; }
.resize-handle.bl { bottom: -4px; left: -4px; cursor: nesw-resize; }
.resize-handle.br { bottom: -4px; right: -4px; cursor: nwse-resize; }

/* Edges */
.resize-handle.t { top: -4px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.b { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.l { left: -4px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.r { right: -4px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

/* Drag selection box for watermark remover / highlight */
.drag-selection-box {
  position: absolute;
  border: 1.5px dashed #ef4444;
  background-color: rgba(239, 68, 68, 0.15);
  pointer-events: none;
  z-index: 90;
}

/* Toast Notification */
.studio-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.studio-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Dropdown Menu for Export */
.s-dropdown {
  position: relative;
  display: inline-block;
}

.s-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background-color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 120;
  min-width: 180px;
}

.s-dropdown-menu.show {
  display: block;
}

.s-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  background: transparent;
  border: none;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.s-dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* SEO / Guide Info Section */
.studio-guide-section {
  max-width: 1100px;
  margin: 40px auto 30px;
  padding: 0 20px;
}

.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.guide-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}


/* ==========================================================================
   Mobile Responsive Layout & Touch Optimizations for PDF Studio
   ========================================================================== */

@media (max-width: 768px) {
  /* Studio Sub-Header */
  .studio-header {
    height: auto;
    min-height: 48px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
  }
  .studio-header-left {
    gap: 6px;
    flex: 1;
    min-width: 130px;
  }
  .studio-filename {
    max-width: 110px;
    font-size: 12px;
  }
  .studio-header-center,
  .studio-page-nav {
    padding: 3px 6px;
    gap: 3px;
  }
  .studio-page-indicator {
    font-size: 11px;
    gap: 3px;
  }
  .studio-page-indicator span:first-child {
    display: none; /* Hide 'Page' label on small screens */
  }
  .studio-page-indicator input {
    width: 32px;
    padding: 1px 2px;
    font-size: 11px;
  }
  .studio-header-right {
    gap: 5px;
    flex-wrap: wrap;
  }
  .studio-zoom-controls {
    padding: 2px 4px;
    gap: 2px;
  }
  #studioZoomLevel {
    font-size: 11px;
    min-width: 34px;
  }
  #studioZoomFitBtn,
  #studioRulerToggleBtn {
    display: none !important; /* Rulers and Fit hidden on phone header, fit is automatic */
  }
  .s-btn {
    padding: 6px 10px;
    font-size: 11.5px;
    border-radius: 6px;
    min-height: 34px;
  }

  /* Workspace Container */
  .studio-workspace-container {
    height: calc(100vh - 106px);
    min-height: 450px;
  }

  /* Sidebar Thumbnails: overlay slide on mobile */
  .studio-sidebar {
    position: fixed;
    left: 0;
    top: 96px;
    bottom: 0;
    width: 190px;
    z-index: 950;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    display: none;
  }
  .studio-sidebar.mobile-open {
    display: flex !important;
  }

  /* Viewport and Canvas */
  .studio-viewport {
    padding: 12px 8px 90px; /* Space for bottom floating toolbar */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Photoshop Rulers: Hidden on mobile so they don't eat precious screen space */
  .studio-top-ruler-bar,
  .studio-left-ruler-bar,
  .studio-ruler-corner {
    display: none !important;
  }

  /* Floating Toolbar: Dock at Bottom with Smooth Horizontal Touch Scroll */
  .studio-toolbar {
    position: fixed !important;
    top: auto !important;
    bottom: 12px !important;
    left: 8px !important;
    right: 8px !important;
    transform: none !important;
    max-width: calc(100vw - 16px) !important;
    width: auto !important;
    border-radius: 16px !important;
    padding: 7px 10px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    scrollbar-width: none !important;
    justify-content: flex-start !important;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.45) !important;
    z-index: 900 !important;
    border: 1px solid var(--studio-border) !important;
  }
  .studio-toolbar::-webkit-scrollbar {
    display: none;
  }
  .s-tool-btn {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: 10px;
    flex-shrink: 0;
    min-height: 36px;
  }
  .s-select-input {
    max-width: 125px;
    font-size: 11px;
    flex-shrink: 0;
    min-height: 34px;
  }
  .s-font-size-control {
    flex-shrink: 0;
  }
  .s-color-control-group {
    flex-shrink: 0;
  }

  /* Touch-friendly larger resize handles */
  .resize-handle {
    width: 13px !important;
    height: 13px !important;
    border-width: 2px !important;
    border-radius: 50% !important;
    touch-action: none;
  }
  .resize-handle.tl { top: -7px; left: -7px; }
  .resize-handle.tr { top: -7px; right: -7px; }
  .resize-handle.bl { bottom: -7px; left: -7px; }
  .resize-handle.br { bottom: -7px; right: -7px; }
  .resize-handle.t { top: -7px; }
  .resize-handle.b { bottom: -7px; }
  .resize-handle.l { left: -7px; }
  .resize-handle.r { right: -7px; }

  /* Delete Button on annotations */
  .item-delete-btn {
    width: 24px !important;
    height: 24px !important;
    top: -12px !important;
    right: -12px !important;
    font-size: 14px !important;
  }
}

/* OCR Detected Word on Image */
.ocr-detected-word {
  position: absolute;
  cursor: pointer;
  background-color: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.4);
  border-radius: 2px;
  transition: all 0.15s ease;
  z-index: 30;
  user-select: none;
  box-sizing: border-box;
}
.ocr-detected-word:hover {
  background-color: rgba(37, 99, 235, 0.25);
  border-color: #2563eb;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
}

/* Inline Image Text Editor Widget */
.inline-image-editor-wrap {
  position: absolute;
  display: flex;
  align-items: center;
  z-index: 500;
  pointer-events: auto;
}

.inline-image-input {
  box-sizing: border-box;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.inline-editor-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 3px 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.inline-act-btn {
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.inline-act-btn.save {
  background: #16a34a;
}
.inline-act-btn.save:hover {
  background: #15803d;
  transform: scale(1.05);
}

.inline-act-btn.cancel {
  background: #ef4444;
}
.inline-act-btn.cancel:hover {
  background: #dc2626;
  transform: scale(1.05);
}
