/* ==========================================================================
   THUMB IMPRESSION STUDIO - EXACT 2-COLUMN STUDIO WORKSPACE
   Matching aadhaar-pan-studio.html & whatsapp-aadhaar.html Architecture
   ========================================================================== */

body {
  background: #f3f4f5;
  background-image: none;
  font-family: var(--font-main, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
  margin: 0;
  padding: 0;
  color: #0f172a;
}

/* 2-Column Main Studio Workspace Grid */
.studio-workspace-grid {
  display: grid;
  grid-template-columns: 375px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px 16px 20px 16px;
  box-sizing: border-box;
  align-items: stretch;
}

@media (min-width: 761px) {
  .studio-workspace-grid {
    height: calc(100dvh - 82px);
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    padding-bottom: 12px;
  }
  .floating-tools-sidebar {
    position: static;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
  }
  .stage-main-wrapper {
    position: static;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .stage-top-bar {
    flex: 0 0 auto;
  }
  .stage-viewport-box {
    height: auto;
    min-height: 0;
    flex: 1 1 0;
    overflow: hidden;
    padding: 16px;
  }
}

@media (max-width: 1250px) {
  .studio-workspace-grid {
    grid-template-columns: 350px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .studio-workspace-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px;
    gap: 10px;
  }
  .stage-main-wrapper {
    position: static;
    grid-row: 1;
  }
  .floating-tools-sidebar {
    position: static;
    max-height: none;
    grid-row: 2;
  }
  .stage-viewport-box {
    height: 55vh;
    min-height: 320px;
    padding: 10px;
  }
}

/* Floating Left Sidebar (Sticky on Scroll) */
.floating-tools-sidebar {
  background: #ffffff;
  border: 1px solid #d9dde2;
  border-radius: 4px;
  gap: 0;
  padding: 0;
  scrollbar-color: #cbd5e1 #f5f5f5;
  scrollbar-width: thin;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.floating-tools-sidebar::-webkit-scrollbar {
  width: 5px;
}
.floating-tools-sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Left Sidebar Tool Cards */
.floating-tools-sidebar > .sidebar-card-box {
  border: 0 !important;
  border-bottom: 1px solid #e2e5e9 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 14px 16px;
  background: #ffffff !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-card-title {
  font-weight: 700;
  font-size: 13px !important;
  color: #1f2d48 !important;
  border-bottom: 1px solid #e7e9ed !important;
  padding-bottom: 8px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.5;
}

/* Right Main Stage Container */
.stage-main-wrapper {
  background: #ffffff;
  border: 1px solid #d9dde2;
  border-radius: 4px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* Stage Header & Step Switcher */
.stage-top-bar {
  background: #fafafa;
  border-bottom: 1px solid #d9dde2;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-step-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #eaedf2;
  border-radius: 8px;
  padding: 4px;
}

.stage-step-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #626973;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.stage-step-pill:hover {
  color: #1f2d48;
}

.stage-step-pill.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  font-weight: 800;
}

/* Stage Live Badge */
.stage-live-badge {
  font-weight: 700;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-front { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* Stage Viewport Area */
.stage-viewport-box {
  background: #e2e5e9;
  height: 100%;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 16px;
  user-select: none;
  box-sizing: border-box;
}

/* Clean Stage Dropzone */
.wa-dropzone {
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  width: 100%;
  max-width: 520px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wa-dropzone:hover {
  border-color: #2563eb;
  background-color: #eff6ff;
}

/* Interactive Crop Wrap */
.crop-editor-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Cropper Stage Container (PI7-Style Cropper.js) */
.cropper-stage-container {
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

@media (max-width: 760px) {
  .cropper-stage-container {
    max-height: 54vh;
  }
}

.cropper-stage-container .cropper-container {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}

/* Custom Cropper.js overlay & handles */
.cropper-view-box {
  outline: 2px solid #38bdf8 !important;
  outline-color: rgba(56, 189, 248, 0.95) !important;
}

.cropper-dashed {
  border-color: rgba(255, 255, 255, 0.45) !important;
}

.cropper-modal {
  background-color: rgba(15, 23, 42, 0.72) !important;
}

.cropper-line {
  background-color: #38bdf8 !important;
}

.cropper-point {
  background-color: #0284c7 !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45) !important;
  border-radius: 50% !important;
  width: 12px !important;
  height: 12px !important;
  opacity: 1 !important;
}

.cropper-point.point-e,
.cropper-point.point-w,
.cropper-point.point-s,
.cropper-point.point-n {
  margin: -6px 0 0 -6px !important;
}

.cropper-point.point-ne,
.cropper-point.point-nw,
.cropper-point.point-se,
.cropper-point.point-sw {
  margin: -6px !important;
}

/* Floating Bottom Stage Toolbar */
.wa-stage-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(15, 23, 42, 0.92);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  z-index: 80;
  backdrop-filter: blur(8px);
}

.wa-toolbar-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.wa-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.wa-toolbar-btn.primary {
  background: linear-gradient(135deg, #10b981, #0284c7);
  border-color: transparent;
  color: #ffffff;
  font-weight: 800;
}

/* Output Preview Viewport */
.preview-stage-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: auto;
  padding: 16px;
  box-sizing: border-box;
}

.preview-box-large {
  background: #ffffff;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 94%;
  transition: all 0.2s ease;
}

.preview-box-large.fit-mode #thumbPreview {
  width: auto;
  height: auto;
  max-width: 100%;
  min-width: 320px;
  max-height: 48vh;
  box-shadow: none;
  border: 1px dashed #cbd5e1;
  display: block;
}

.preview-box-large.actual-mode #thumbPreview {
  width: auto;
  height: auto;
  max-width: none;
  min-width: 0;
  box-shadow: none;
  border: 1px dashed #cbd5e1;
  display: block;
}

@media (max-width: 760px) {
  .preview-box-large.fit-mode #thumbPreview {
    min-width: 240px;
    max-height: 42vh;
  }
}

/* Preset Pill Grid & Buttons */
.preset-pill-grid {
  display: grid;
  gap: 6px;
}

.preset-pill-btn {
  padding: 8px 6px;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid #d9dde2;
  border-radius: 6px;
  background-color: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.preset-pill-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background-color: #eff6ff;
}

.preset-pill-btn.active {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Slider Row */
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: #2563eb;
}

/* Dark Theme Adjustments */
[data-theme="dark"] body {
  background: #090d16;
  color: #f1f5f9;
}

[data-theme="dark"] .floating-tools-sidebar,
[data-theme="dark"] .stage-main-wrapper {
  background: #111827 !important;
  border-color: #1f293d !important;
}

[data-theme="dark"] .floating-tools-sidebar > .sidebar-card-box {
  background: #111827 !important;
  border-bottom-color: #1f293d !important;
}

[data-theme="dark"] .sidebar-card-title {
  color: #f1f5f9 !important;
  border-bottom-color: #1f293d !important;
}

[data-theme="dark"] .stage-top-bar {
  background: #0d1522 !important;
  border-bottom-color: #1f293d !important;
}

[data-theme="dark"] .stage-step-pills {
  background: #1a2436 !important;
}

[data-theme="dark"] .stage-step-pill {
  color: #94a3b8 !important;
}

[data-theme="dark"] .stage-step-pill.active {
  background: #111827 !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .stage-viewport-box {
  background: #070c14 !important;
}

[data-theme="dark"] .wa-dropzone {
  background: #111827 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .preset-pill-btn {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .preset-pill-btn.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}
