/* ==========================================================================
   ClassKit Global - Studio Common Framework Stylesheet
   Shared across all 12 screen-free printable generator studios.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Studio Header Toolbar
   -------------------------------------------------------------------------- */
.studio-header {
  height: 56px;
  background-color: var(--bg-surface, #FFFFFF);
  border-bottom: 1px solid var(--border-light, #E2E8F0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.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, 8px);
  color: var(--text-muted, #64748B);
  text-decoration: none;
  font-size: 16px;
  background-color: var(--bg-subtle, #F8FAFC);
  border: 1px solid var(--border-light, #E2E8F0);
  transition: all 0.15s ease;
}

.btn-back-home:hover {
  background-color: var(--border-light, #E2E8F0);
  color: var(--text-main, #0F172A);
}

.studio-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main, #0F172A);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  background-color: #ECFDF5;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid #A7F3D0;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: #10B981;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

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

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

.zoom-btn {
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  background: transparent;
  border: none;
  color: var(--text-muted, #64748B);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.zoom-btn.active, .zoom-btn:hover {
  background-color: #FFFFFF;
  color: var(--text-main, #0F172A);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-print-primary {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 800;
  color: #FFFFFF;
  background-color: var(--primary, #E11D48);
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.28);
  transition: all 0.15s ease;
}

.btn-print-primary:hover {
  background-color: var(--primary-hover, #BE123C);
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.35);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Studio Main 2-Column Body
   -------------------------------------------------------------------------- */
.studio-body {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* Left Control Sidebar */
.studio-sidebar {
  width: 410px;
  min-width: 410px;
  max-width: 410px;
  height: 100%;
  background-color: var(--bg-surface, #FFFFFF);
  border-right: 1px solid var(--border-light, #E2E8F0);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-sizing: border-box;
}

.sidebar-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light, #E2E8F0);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main, #0F172A);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.2px;
}

/* Common Studio Sidebar Form Controls */
.form-group-wb { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-label-wb { font-size: 12px; font-weight: 800; color: var(--text-main, #0F172A); }
.form-input-wb {
  height: 38px; padding: 0 12px; border: 1.5px solid var(--border-medium, #CBD5E1);
  border-radius: var(--radius-sm, 6px); font-size: 13px; font-weight: 700;
  color: var(--text-main, #0F172A); outline: none; background: #FFFFFF;
  box-sizing: border-box; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input-wb:focus { border-color: var(--primary, #E11D48); box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12); }
.form-row-checkboxes { display: flex; flex-direction: column; gap: 8px; }
.checkbox-label-wb { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-main, #1E293B); cursor: pointer; user-select: none; }
.checkbox-label-wb input[type="checkbox"] { accent-color: var(--primary, #E11D48); width: 16px; height: 16px; cursor: pointer; }
.option-label-sub { font-size: 11.5px; font-weight: 700; color: var(--text-muted, #64748B); margin-bottom: 6px; letter-spacing: -0.2px; }
.sub-option-wrap { margin-top: 10px; padding: 8px 10px; background: var(--bg-subtle, #F8FAFC); border-radius: 8px; border: 1px solid var(--border-light, #E2E8F0); }
.segmented-control { display: flex; gap: 4px; background: #EDF2F7; padding: 4px; border-radius: 8px; }
.seg-btn {
  flex: 1; padding: 8px 4px; font-size: 11.5px; font-weight: 700; color: #64748B;
  background: transparent; border: none; border-radius: 6px; cursor: pointer;
  transition: all 0.15s ease; text-align: center; user-select: none; white-space: nowrap;
}
.seg-btn:hover { color: #0F172A; }
.seg-btn.active { background: #FFFFFF; color: #0F172A; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.layout-hint-text { font-size: 11.5px; color: #64748B; line-height: 1.4; margin-top: 8px; padding: 4px 6px; }
.solution-control-row { display: flex; align-items: center; gap: 8px; }
.btn-toggle-solution {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  padding: 9px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  background: #F1F5F9; color: #334155; border: 1px solid #CBD5E1; cursor: pointer; transition: all 0.15s ease;
}
.btn-toggle-solution:hover { background: #E2E8F0; color: #0F172A; }
.btn-toggle-solution.active { background: #EFF6FF; border-color: #3B82F6; color: #1D4ED8; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.btn-toggle-solution.is-pro-locked { background: #FFFBEB; border-color: #FDE68A; color: #B45309; }
.btn-toggle-solution.is-pro-locked:hover { background: #FEF3C7; border-color: #F59E0B; color: #92400E; }
.btn-secondary-action {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 700; background: #FFFFFF; color: #334155; border: 1px solid #CBD5E1;
  cursor: pointer; transition: all 0.15s ease;
}
.btn-secondary-action:hover { background: #F8FAFC; border-color: #94A3B8; color: #0F172A; }
.btn-secondary-action.is-pro-locked {
  background: #FFFBEB; border-color: #FDE68A; color: #B45309;
}
.btn-secondary-action.is-pro-locked:hover {
  background: #FEF3C7; border-color: #F59E0B; color: #92400E; transform: translateY(-1px);
}
.btn-print-primary.is-pro-locked {
  background: #475569 !important; border-color: #334155 !important; color: #FFFFFF !important;
  cursor: pointer; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25) !important;
}
.btn-print-primary.is-pro-locked:hover { background: #334155 !important; transform: translateY(-1px); }
.btn-sidebar-generate {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px;
  border-radius: 10px; font-size: 13.5px; font-weight: 800; background: #F1F5F9; border: 1.5px solid #CBD5E1;
  color: #1E293B; cursor: pointer; transition: all 0.18s ease;
}
.btn-sidebar-generate:hover { background: #E2E8F0; border-color: #94A3B8; color: #0F172A; transform: translateY(-1px); }

/* Right Realtime A4 Preview Viewport */
.studio-viewport {
  flex: 1;
  height: 100%;
  background-color: #F1F5F9;
  overflow: auto;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  box-sizing: border-box;
}

.a4-wrapper {
  transition: transform 0.15s ease;
  transform-origin: top center;
}

/* --------------------------------------------------------------------------
   Standardized A4 Sheet Header & Footer Components
   -------------------------------------------------------------------------- */
.sheet-header-block {
  display: block;
  border-bottom: 2px solid #0F172A;
  padding-bottom: 2mm;
  margin-bottom: 3mm;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
}

.sheet-meta-row,
.sheet-header-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4mm;
  margin-bottom: 2mm;
  width: 100%;
  box-sizing: border-box;
  font-size: 8.5pt;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
}

.sheet-main-title {
  font-size: 16pt;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: #0F172A;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  display: block;
}

.sheet-name-field {
  display: inline-block;
  min-width: 25mm;
  border-bottom: 1px solid #64748B;
  text-align: center;
  height: 3.5mm;
  vertical-align: bottom;
}

.sheet-answer-tag {
  font-size: 8.5pt;
  font-weight: 800;
  color: #1D4ED8;
  letter-spacing: 0.5px;
}

.sheet-footer-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #CBD5E1;
  padding-top: 1.8mm;
  margin-top: 2mm;
  font-size: 7pt;
  color: #64748B;
  font-weight: 500;
  flex-shrink: 0;
  line-height: 1.2;
  box-sizing: border-box;
}

.sheet-footer-block .footer-brand-tag {
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap;
}

.sheet-footer-block span:last-child {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Studio Common Pro Term Pass Modal
   -------------------------------------------------------------------------- */
.pro-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: modalFadeIn 0.2s ease-out;
}

.pro-modal-card {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPopIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.pro-modal-icon {
  font-size: 44px;
  margin-bottom: 12px;
  line-height: 1;
}

.pro-modal-title {
  font-size: 20px;
  font-weight: 900;
  color: #0F172A;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.pro-modal-desc {
  font-size: 13.5px;
  color: #64748B;
  line-height: 1.5;
  margin: 0 0 20px;
}

.pro-features-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 auto 24px;
  text-align: left;
  max-width: 360px;
}

.pro-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  line-height: 1.4;
}

.pro-feature-item svg {
  width: 16px;
  height: 16px;
  color: #059669;
  flex-shrink: 0;
  margin-top: 2px;
}

.pro-modal-pricing-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 24px;
}

.pro-modal-plan {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.pro-modal-plan.featured {
  background: #FFF1F2;
  border-color: #FECDD3;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.08);
}

.pro-plan-badge {
  position: absolute;
  top: -10px;
  background: #E11D48;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 5px rgba(225, 29, 72, 0.25);
  line-height: 1.3;
}

.pro-plan-title {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
  line-height: 1.2;
}

.pro-modal-plan.featured .pro-plan-title {
  color: #BE123C;
}

.pro-plan-price {
  font-size: 22px;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.1;
}

.pro-modal-plan.featured .pro-plan-price {
  color: #E11D48;
}

.pro-plan-price span {
  font-size: 11px;
  font-weight: 600;
  color: #64748B;
}

.pro-modal-plan.featured .pro-plan-price span {
  color: #BE123C;
}

.pro-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-pro-confirm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  background: var(--primary, #E11D48);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  box-sizing: border-box;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
}

.btn-pro-confirm:hover {
  background: var(--primary-hover, #BE123C);
  transform: translateY(-1px);
}

.btn-pro-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid #CBD5E1;
  color: #64748B;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.btn-pro-close:hover {
  background: #F1F5F9;
  color: #0F172A;
}

/* --------------------------------------------------------------------------
   Global Print Rules (@media print)
   -------------------------------------------------------------------------- */
@media print {
  .pro-modal-backdrop,
  .studio-header,
  .studio-sidebar,
  .zoom-control,
  .btn-print-primary {
    display: none !important;
  }

  @page {
    size: A4 portrait;
    margin: 0;
  }

  body, html {
    background: #FFFFFF !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .studio-body,
  .studio-viewport,
  .a4-wrapper {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    background: transparent !important;
    overflow: visible !important;
  }
}

/* --------------------------------------------------------------------------
   Worksheet Selection & Anti-Copy Protection
   -------------------------------------------------------------------------- */
.a4-wrapper,
.a4-sheet,
.scale-sheet,
.worksheet-page {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.studio-sidebar input,
.studio-sidebar textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}
