/* ==========================================================================
   ClassKit Global - Studio Common Layout & Print Engine
   ========================================================================== */

.studio-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-page);
}

/* --------------------------------------------------------------------------
   Studio Header Toolbar
   -------------------------------------------------------------------------- */
.studio-header {
  height: 56px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 60;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

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

.btn-back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 16px;
  background-color: var(--bg-subtle);
  transition: all 0.15s ease;
}

.btn-back-home:hover {
  background-color: var(--border-light);
  color: var(--text-main);
}

.studio-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.zoom-control {
  display: flex;
  align-items: center;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 2px 4px;
  gap: 2px;
}

.zoom-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: bold;
}

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

.zoom-val {
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  color: var(--text-secondary);
  min-width: 44px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Studio Workspace Layout (Sidebar + Preview Canvas)
   -------------------------------------------------------------------------- */
.studio-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.studio-sidebar {
  width: 320px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.control-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.studio-preview-pane {
  flex: 1;
  background-color: var(--bg-subtle);
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 16px;
}

/* --------------------------------------------------------------------------
   A4 Printable Worksheet Canvas
   -------------------------------------------------------------------------- */
.a4-sheet {
  width: var(--a4-width);
  min-height: var(--a4-height);
  background: #FFFFFF;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-xs);
  padding: 14mm 12mm 12mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
  transform-origin: top center;
  transition: transform 0.15s ease;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--text-main);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.sheet-title-box h2 {
  font-size: 20px;
  font-weight: 900;
  color: #000000;
  letter-spacing: -0.02em;
}

.sheet-custom-text {
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
  font-weight: 600;
}

.sheet-info-box {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.sheet-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sheet-watermark {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #CBD5E1;
  text-align: center;
  font-size: 10px;
  color: #94A3B8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.watermark-clean {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Pure CSS Print Engine (@media print)
   -------------------------------------------------------------------------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body, html {
    background: #FFFFFF !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
  }

  .studio-header,
  .studio-sidebar,
  .zoom-control,
  .no-print {
    display: none !important;
  }

  .studio-wrapper,
  .studio-main,
  .studio-preview-pane {
    display: block !important;
    overflow: visible !important;
    background: #FFFFFF !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
  }

  .a4-sheet {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
    margin: 0 !important;
    padding: 12mm !important;
    page-break-after: always;
    transform: none !important;
  }

  /* Answer Key Page Break */
  .a4-sheet.answer-key-sheet {
    page-break-before: always;
  }
}
