/**
 * Fayzar Publishing Studio - Ultra-Modern Layout & Print Stylesheet
 * 100% Offline with Local Typography & Authentic Document Rules.
 */

@font-face {
  font-family: 'SutonnyMJ';
  src: url('../fonts/SutonnyOMJ.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SutonnyOMJ';
  src: url('../fonts/SutonnyOMJ.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Font Awesome 6 Free';
  font-style: normal;
  font-weight: 900;
  font-display: block;
  src: url("../webfonts/fa-solid-900.woff2") format("woff2"),
       url("../webfonts/fa-solid-900.ttf") format("truetype");
}

@font-face {
  font-family: 'Font Awesome 6 Brands';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../webfonts/fa-brands-400.woff2") format("woff2"),
       url("../webfonts/fa-brands-400.ttf") format("truetype");
}

.fa-solid, .fas {
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}
.fa-brands, .fab {
  font-family: 'Font Awesome 6 Brands';
  font-weight: 400;
}

/* Typography Helpers */
.font-sutonny {
  font-family: 'SutonnyOMJ', 'SutonnyMJ', sans-serif !important;
}
.font-kalpurush {
  font-family: 'Kalpurush', 'Hind Siliguri', 'Segoe UI', sans-serif;
}

/* Document Paper Mockup */
.paper-sheet {
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
  margin: 0 auto;
}

/* Standard A4 Portrait */
.paper-sheet.size-a4-portrait {
  width: 210mm;
  min-height: 297mm;
  padding: 10mm 12mm;
}

/* Standard A4 Landscape */
.paper-sheet.size-a4-landscape {
  width: 297mm;
  min-height: 210mm;
  padding: 8mm 10mm;
}

/* Legal Portrait (for Deeds & Stamp) */
.paper-sheet.size-legal-portrait {
  width: 216mm;
  min-height: 356mm;
  padding: 15mm 15mm;
}

/* User-Configurable Margins */
.paper-sheet.margin-narrow {
  padding: 8mm 10mm !important;
}
.paper-sheet.margin-standard {
  padding: 10mm 12mm !important;
}
.paper-sheet.margin-normal {
  padding: 15mm 15mm !important;
}
.paper-sheet.margin-wide {
  padding: 20mm 20mm !important;
}

/* ===================================================
   Microsoft Word Authentic Desktop UI & Office Suite
   =================================================== */

/* Theme: Classic Office Light (Default) & Modern Dark */
body.theme-office-light {
  background: #edebe9;
  color: #201f1e;
}
body.theme-office-dark {
  background: #1f1f1f;
  color: #f1f5f9;
}

/* 1. Microsoft Word Window Titlebar */
.word-titlebar {
  height: 34px;
  background: #2b579a; /* Iconic Word Deep Blue */
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  user-select: none;
  font-size: 12px;
  flex-shrink: 0;
  z-index: 40;
  border-bottom: 1px solid #1f3f70;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.theme-office-dark .word-titlebar {
  background: #1f1f1f;
  border-bottom: 1px solid #2d2d2d;
}

.word-app-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #185abd;
  border-radius: 3px;
  font-weight: 900;
  font-size: 13px;
  color: #fff;
  margin-right: 6px;
  font-family: 'Segoe UI', sans-serif;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.quick-access-btn {
  background: transparent;
  border: none;
  color: #f1f5f9;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.12s ease;
}
.quick-access-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.titlebar-doc-name {
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-ctrl-btn {
  width: 38px;
  height: 34px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s;
}
.window-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.window-ctrl-btn.btn-close:hover {
  background: #e81123 !important;
  color: #fff !important;
}

/* 2. Microsoft Word Ribbon Tabs */
.word-ribbon-tabs {
  background: #2b579a;
  display: flex;
  align-items: flex-end;
  padding: 0 10px;
  height: 30px;
  user-select: none;
  gap: 2px;
  border-bottom: 1px solid #d2d0ce;
  flex-shrink: 0;
}
.theme-office-dark .word-ribbon-tabs {
  background: #1f1f1f;
  border-bottom: 1px solid #333333;
}

.word-tab-btn {
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px 7px 14px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: all 0.15s ease;
}
.word-tab-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.word-tab-btn.active {
  background: #f3f2f1;
  color: #2b579a;
  font-weight: 700;
  border-top: 2px solid #2b579a;
}
.theme-office-dark .word-tab-btn.active {
  background: #2b2b2b;
  color: #38bdf8;
  border-top: 2px solid #38bdf8;
}
.word-tab-btn.file-tab {
  background: #185abd;
  color: #ffffff;
  font-weight: bold;
}
.word-tab-btn.file-tab:hover {
  background: #104a9b;
}

/* 3. Microsoft Word Ribbon Action Panel */
.word-ribbon-panel {
  background: #f3f2f1;
  border-bottom: 1px solid #d2d0ce;
  padding: 5px 14px;
  display: flex;
  align-items: stretch;
  gap: 12px;
  user-select: none;
  min-height: 92px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  overflow-x: auto;
}
.theme-office-dark .word-ribbon-panel {
  background: #2b2b2b;
  border-bottom: 1px solid #3a3a3a;
  color: #f1f5f9;
}

.word-ribbon-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid #d2d0ce;
  padding-right: 10px;
  margin-right: 2px;
}
.theme-office-dark .word-ribbon-group {
  border-right-color: #3f3f3f;
}

.ribbon-group-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.ribbon-group-footer {
  font-size: 10px;
  color: #605e5c;
  text-align: center;
  font-weight: 600;
  padding-top: 3px;
  letter-spacing: 0.3px;
}
.theme-office-dark .ribbon-group-footer {
  color: #a19f9d;
}

/* Word Large & Small Buttons */
.word-btn-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #323130;
  min-width: 52px;
  transition: all 0.12s;
}
.theme-office-dark .word-btn-large {
  color: #f1f5f9;
}
.word-btn-large:hover {
  background: #edebe9;
  border-color: #c8c6c4;
}
.theme-office-dark .word-btn-large:hover {
  background: #383838;
  border-color: #484848;
}
.word-btn-large i {
  font-size: 17px;
  margin-bottom: 3px;
}
.word-btn-large.active {
  background: #c7e0f4 !important;
  border-color: #0078d4 !important;
  color: #004578 !important;
}
.theme-office-dark .word-btn-large.active {
  background: #034d82 !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
}

.word-btn-sm {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #d2d0ce;
  border-radius: 3px;
  font-size: 11px;
  color: #323130;
  cursor: pointer;
  transition: all 0.1s;
}
.theme-office-dark .word-btn-sm {
  background: #383838;
  border-color: #484848;
  color: #f1f5f9;
}
.word-btn-sm:hover {
  background: #edebe9;
  border-color: #a19f9d;
}
.theme-office-dark .word-btn-sm:hover {
  background: #484848;
}
.word-btn-sm.active {
  background: #0078d4 !important;
  color: #ffffff !important;
  border-color: #005a9e !important;
}

.word-select {
  background: #ffffff;
  border: 1px solid #d2d0ce;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #323130;
  cursor: pointer;
  height: 25px;
}
.theme-office-dark .word-select {
  background: #383838;
  border-color: #484848;
  color: #f1f5f9;
}

/* 4. Microsoft Word Dual Rulers (Horizontal + Vertical) */
.word-canvas-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.word-ruler-corner {
  width: 22px;
  height: 20px;
  background: #e1dfdd;
  border-right: 1px solid #c8c6c4;
  border-bottom: 1px solid #c8c6c4;
  flex-shrink: 0;
}
.theme-office-dark .word-ruler-corner {
  background: #242424;
  border-color: #383838;
}

/* Horizontal Ruler */
.word-ruler-h-bar {
  height: 20px;
  background: #f3f2f1;
  border-bottom: 1px solid #c8c6c4;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  width: 100%;
}
.theme-office-dark .word-ruler-h-bar {
  background: #2b2b2b;
  border-bottom-color: #383838;
}

.ruler-h-track {
  width: 210mm;
  max-width: 100%;
  height: 18px;
  background: #ffffff;
  border: 1px solid #a19f9d;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 8px;
  color: #605e5c;
  font-family: 'Segoe UI', Arial, sans-serif;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.theme-office-dark .ruler-h-track {
  background: #333333;
  color: #a19f9d;
  border-color: #484848;
}

.ruler-h-margin-left, .ruler-h-margin-right {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #c8c6c4;
  width: 12mm;
  z-index: 1;
}
.ruler-h-margin-left { left: 0; }
.ruler-h-margin-right { right: 0; }
.theme-office-dark .ruler-h-margin-left,
.theme-office-dark .ruler-h-margin-right {
  background: #202020;
}

/* Indent handles on Horizontal Ruler */
.ruler-indent-first {
  position: absolute;
  top: 0;
  left: 12mm;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #000;
  z-index: 5;
  transform: translateX(-50%);
}
.ruler-indent-hanging {
  position: absolute;
  bottom: 3px;
  left: 12mm;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid #000;
  z-index: 5;
  transform: translateX(-50%);
}
.ruler-indent-box {
  position: absolute;
  bottom: 0;
  left: 12mm;
  width: 7px;
  height: 3px;
  background: #000;
  z-index: 5;
  transform: translateX(-50%);
}
.ruler-indent-right {
  position: absolute;
  bottom: 0;
  right: 12mm;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid #000;
  z-index: 5;
  transform: translateX(50%);
}

/* Vertical Ruler */
.word-ruler-v-bar {
  width: 22px;
  background: #f3f2f1;
  border-right: 1px solid #c8c6c4;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  flex-shrink: 0;
  padding: 30px 0;
}
.theme-office-dark .word-ruler-v-bar {
  background: #2b2b2b;
  border-right-color: #383838;
}
.ruler-v-track {
  width: 18px;
  height: 297mm;
  background: #ffffff;
  border: 1px solid #a19f9d;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 4px 2px;
  font-size: 8px;
  color: #605e5c;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.theme-office-dark .ruler-v-track {
  background: #333333;
  color: #a19f9d;
  border-color: #484848;
}
.ruler-v-margin-top, .ruler-v-margin-bottom {
  position: absolute;
  left: 0;
  right: 0;
  background: #c8c6c4;
  height: 10mm;
  z-index: 1;
}
.ruler-v-margin-top { top: 0; }
.ruler-v-margin-bottom { bottom: 0; }
.theme-office-dark .ruler-v-margin-top,
.theme-office-dark .ruler-v-margin-bottom {
  background: #202020;
}

/* 5. Office Desktop Canvas */
.office-canvas {
  flex: 1;
  width: 100%;
  background: #edebe9; /* Authentic Microsoft Word Canvas Gray */
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px 15px 60px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.2s ease;
}
.theme-office-dark .office-canvas {
  background: #292929; /* Word Dark Mode Canvas */
}

/* Zoom Container */
#zoom-container {
  transform-origin: top center;
  transition: transform 0.12s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Authentic Paper Elevation & Corner Marks */
.paper-sheet {
  background-color: #ffffff;
  color: #000000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16), 0 0 1px rgba(0, 0, 0, 0.28);
  border-radius: 1px;
  position: relative;
  transition: all 0.2s ease;
  margin: 0 auto;
}

/* Corner Crop Marks (Word Text Boundaries) */
.word-crop-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.crop-tl, .crop-tr, .crop-bl, .crop-br {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: #8a8886;
  opacity: 0.55;
}
.margin-standard .crop-tl { top: 10mm; left: 12mm; border-top: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-standard .crop-tr { top: 10mm; right: 12mm; border-top: 1px solid #8a8886; border-right: 1px solid #8a8886; }
.margin-standard .crop-bl { bottom: 10mm; left: 12mm; border-bottom: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-standard .crop-br { bottom: 10mm; right: 12mm; border-bottom: 1px solid #8a8886; border-right: 1px solid #8a8886; }

.margin-narrow .crop-tl { top: 8mm; left: 10mm; border-top: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-narrow .crop-tr { top: 8mm; right: 10mm; border-top: 1px solid #8a8886; border-right: 1px solid #8a8886; }
.margin-narrow .crop-bl { bottom: 8mm; left: 10mm; border-bottom: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-narrow .crop-br { bottom: 8mm; right: 10mm; border-bottom: 1px solid #8a8886; border-right: 1px solid #8a8886; }

.margin-normal .crop-tl { top: 15mm; left: 15mm; border-top: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-normal .crop-tr { top: 15mm; right: 15mm; border-top: 1px solid #8a8886; border-right: 1px solid #8a8886; }
.margin-normal .crop-bl { bottom: 15mm; left: 15mm; border-bottom: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-normal .crop-br { bottom: 15mm; right: 15mm; border-bottom: 1px solid #8a8886; border-right: 1px solid #8a8886; }

.margin-wide .crop-tl { top: 20mm; left: 20mm; border-top: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-wide .crop-tr { top: 20mm; right: 20mm; border-top: 1px solid #8a8886; border-right: 1px solid #8a8886; }
.margin-wide .crop-bl { bottom: 20mm; left: 20mm; border-bottom: 1px solid #8a8886; border-left: 1px solid #8a8886; }
.margin-wide .crop-br { bottom: 20mm; right: 20mm; border-bottom: 1px solid #8a8886; border-right: 1px solid #8a8886; }

@media print {
  .word-crop-marks { display: none !important; }
}

/* Word Page Break Between Sheets */
.word-page-break {
  width: 210mm;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  user-select: none;
}
.word-page-break::before, .word-page-break::after {
  content: '';
  flex: 1;
  border-top: 1.5px dashed #a19f9d;
}
.word-page-break-badge {
  background: #f3f2f1;
  border: 1px solid #c8c6c4;
  border-radius: 12px;
  padding: 2px 12px;
  font-size: 10px;
  font-weight: bold;
  color: #605e5c;
  display: flex;
  align-items: center;
  gap: 5px;
}
.theme-office-dark .word-page-break-badge {
  background: #242424;
  border-color: #3a3a3a;
  color: #a19f9d;
}

/* Floating Selection Mini-Toolbar */
#word-mini-toolbar {
  position: absolute;
  z-index: 1000;
  background: #ffffff;
  border: 1px solid #c8c6c4;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  padding: 3px 6px;
  display: none;
  align-items: center;
  gap: 4px;
}
.theme-office-dark #word-mini-toolbar {
  background: #2b2b2b;
  border-color: #484848;
}

/* Live Word-like Direct Page Editing */
.editing-active .question-paper,
.editing-active .paper-sheet [contenteditable="true"] {
  outline: 2px dashed #0078d4 !important;
  outline-offset: 3px !important;
  cursor: text !important;
  transition: outline 0.15s ease;
}
.editing-active .question-paper:hover {
  outline: 2px solid #005a9e !important;
  background-color: rgba(0, 120, 212, 0.02);
}
.editing-active .question-paper:focus {
  outline: 2px solid #107c41 !important;
}

/* 6. Microsoft Word Status Bar */
.office-status-bar {
  background: #2b579a; /* Iconic Word Deep Blue */
  border-top: 1px solid #1f3f70;
  padding: 4px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #ffffff;
  z-index: 30;
  user-select: none;
  flex-shrink: 0;
}
.theme-office-dark .office-status-bar {
  background: #185abd;
  border-top-color: #104a9b;
}

.status-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.status-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* Fullscreen / Maximized Mode */
body.fullscreen-preview #editor-pane {
  display: none !important;
}
body.fullscreen-preview #preview-section {
  width: 100% !important;
}

/* Left Editor in Office Theme */
.theme-office-light #editor-pane {
  background: #f8f9fa !important;
  border-right-color: #d2d0ce !important;
  color: #201f1e !important;
}
.theme-office-light #editor-pane .editor-header {
  background: #f3f2f1 !important;
  border-bottom-color: #d2d0ce !important;
  color: #201f1e !important;
}
.theme-office-light #editor-pane .editor-header span {
  color: #201f1e !important;
}
.theme-office-light #input-text {
  background: #ffffff !important;
  border-color: #d2d0ce !important;
  color: #201f1e !important;
}
.theme-office-light #editor-pane .editor-footer {
  background: #f3f2f1 !important;
  border-top-color: #d2d0ce !important;
  color: #605e5c !important;
}
.theme-office-light .word-ribbon-panel {
  color: #201f1e !important;
}
.theme-office-light .word-ribbon-panel button,
.theme-office-light .word-ribbon-panel span,
.theme-office-light .word-ribbon-panel select {
  color: #201f1e !important;
}
.theme-office-light #lbl-font-size,
.theme-office-light #lbl-split-count {
  color: #2b579a !important;
}


.two-columns {
  column-count: 2;
  column-gap: 0.2in;
  column-rule: 1px solid #000000;
}

.qp-columns-flex {
  display: flex !important;
  width: 100% !important;
  column-gap: 0.2in !important;
}

/* Dense Zero-Gap Typesetting (0 Line Gap Mandate) */
.dense-zero-gap,
.dense-zero-gap p,
.dense-zero-gap div,
.dense-zero-gap h1,
.dense-zero-gap h2,
.dense-zero-gap h3 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  line-height: 1.35 !important;
}

/* Booklet Sheets Presentation */
.sheet-label {
  font-size: 11px;
  font-weight: bold;
  color: #475569;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 8px;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-break-indicator {
  page-break-after: always;
  break-after: page;
}

/* Column Break for Booklet */
.column-break-after {
  break-after: column;
  -webkit-column-break-after: always;
}

.qp-col-skip-box {
  border: 1.5px dashed #94a3b8;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  text-align: center;
  color: #64748b;
  border-radius: 4px;
}

/* ===================================================
   MCQ Question & Indented Options Layout (Pure CSS)
   =================================================== */
.mcq-q-item {
  margin: 0 0 2px 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
  break-inside: avoid;
}

.mcq-q-row {
  display: flex;
  align-items: flex-start;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
}

.mcq-num {
  flex-shrink: 0;
  font-weight: bold;
  font-size: 12pt;
  margin: 0 !important;
  margin-right: 4px !important;
  padding: 0 !important;
}

.mcq-text {
  flex: 1;
  text-align: justify;
  font-size: 12pt;
  margin: 0 !important;
  padding: 0 !important;
}

/* The options row is indented so options start cleanly aligned under question text */
.mcq-options-row {
  padding-left: 20px;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1.35 !important;
}

.mcq-stimulus-row {
  padding-left: 20px;
  margin: 1px 0 !important;
  font-size: 12pt;
  color: #1e293b;
  line-height: 1.35 !important;
}

/* Pure CSS Grid for MCQ Options (Guaranteed 4 or 2 Columns) */
.mcq-grid {
  display: grid;
  width: 100%;
  column-gap: 8px;
  row-gap: 0px;
  font-size: 12pt;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
}

.mcq-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mcq-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mcq-grid-1 {
  grid-template-columns: 1fr;
}

.mcq-opt {
  display: flex;
  align-items: baseline;
  overflow: hidden;
  white-space: normal;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
}

.mcq-opt-label {
  font-weight: bold;
  color: #1e293b;
  margin-right: 5px !important;
  flex-shrink: 0;
}

.mcq-opt-text {
  color: #0f172a;
  word-break: break-word;
}

/* Standalone Header Styles (Independent of Tailwind) */
.qp-header {
  text-align: center;
  margin: 0 0 3px 0 !important;
  padding: 0 0 2px 0 !important;
  border-bottom: 1.5px solid #000000 !important;
}

.qp-metrics {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-weight: bold !important;
  font-size: 12pt !important;
  margin: 2px 0 0 0 !important;
  padding-top: 2px !important;
  border-top: 1px solid #94a3b8 !important;
  line-height: 1.2 !important;
}

/* ===================================================
   Creative Question (CQ) Layout (Pure CSS)
   =================================================== */
.cq-q-item {
  margin: 0 0 4px 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
  break-inside: avoid;
}

.cq-q-row {
  display: flex;
  align-items: flex-start;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
}

.cq-num {
  font-weight: bold;
  font-size: 12pt;
  margin-right: 5px;
  flex-shrink: 0;
}

.cq-text {
  flex: 1;
  font-weight: 600;
  font-size: 12pt;
  text-align: justify;
}

/* Stimulus is indented by 16px so NOTHING is under the serial number! */
.cq-stimulus {
  padding-left: 16px !important;
  margin: 1px 0 !important;
  font-size: 12pt;
  color: #0f172a;
  line-height: 1.35 !important;
}

/* Sub-questions are indented by 16px (aligned with question text and stimulus!) */
.cq-subs {
  padding-left: 16px !important;
  margin: 1px 0 0 0 !important;
}

.cq-sub-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 !important;
  font-size: 12pt;
  line-height: 1.35 !important;
}

.cq-sub-lbl {
  font-weight: bold;
  margin-right: 4px;
  flex-shrink: 0;
}

.cq-sub-txt {
  flex: 1;
  text-align: justify;
}

.cq-sub-mark {
  font-weight: bold;
  font-size: 12pt;
  margin-left: 8px;
  text-align: right;
  white-space: nowrap;
}

/* Stamp Header Guide */
.stamp-header-spacer {
  transition: opacity 0.2s ease;
}

/* Print Rules - 100% Vector Output */
@media print {
  body {
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .no-print, .studio-toolbar, .studio-sidebar, .sheet-label {
    display: none !important;
  }
  .paper-sheet {
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    page-break-after: always;
    break-after: page;
  }
  .paper-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .stamp-header-spacer, .qp-col-skip-box {
    border: none !important;
    background: transparent !important;
    color: transparent !important;
  }
  .stamp-header-spacer *, .qp-col-skip-box * {
    visibility: hidden !important;
  }
}

/* ==========================================================================
   7. WORD MODALS, DIALOGS & DIRECT EDITING TOOLS
   ========================================================================== */

/* Word Modal Backdrop & Dialog */
.word-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.word-modal-backdrop.hidden {
  display: none !important;
}

.word-modal-card {
  background: #ffffff;
  color: #201f1e;
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  border: 1px solid #c8c6c4;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: modalPop 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.theme-office-dark .word-modal-card {
  background: #2b2b2b;
  color: #f3f2f1;
  border-color: #484848;
}

@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

.word-modal-header {
  background: #2b579a;
  color: #ffffff;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.theme-office-dark .word-modal-header {
  background: #185abd;
}

.word-modal-body {
  padding: 16px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.word-modal-footer {
  padding: 10px 16px;
  background: #f3f2f1;
  border-top: 1px solid #e1dfdd;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.theme-office-dark .word-modal-footer {
  background: #242424;
  border-top-color: #3a3a3a;
}

.word-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #8a8886;
  border-radius: 3px;
  font-size: 12px;
  background: #ffffff;
  color: #201f1e;
  outline: none;
}
.word-input:focus {
  border-color: #0078d4;
  box-shadow: 0 0 0 1px #0078d4;
}
.theme-office-dark .word-input {
  background: #383838;
  border-color: #555555;
  color: #ffffff;
}

.word-btn-primary {
  background: #0078d4;
  color: #ffffff;
  border: 1px solid #005a9e;
  padding: 5px 14px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
}
.word-btn-primary:hover {
  background: #106ebe;
}

.word-btn-secondary {
  background: #ffffff;
  color: #201f1e;
  border: 1px solid #8a8886;
  padding: 5px 14px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
}
.word-btn-secondary:hover {
  background: #f3f2f1;
}
.theme-office-dark .word-btn-secondary {
  background: #383838;
  color: #f3f2f1;
  border-color: #555555;
}

/* Inserted Tables on Document */
.word-inserted-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: inherit;
}
.word-inserted-table th,
.word-inserted-table td {
  border: 1px solid #333333;
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
  min-height: 22px;
}
.word-inserted-table th {
  background: rgba(0, 0, 0, 0.05);
  font-weight: bold;
}

/* Inserted Divider Line */
.word-inserted-hr {
  border: none;
  border-top: 1.5px solid #333333;
  margin: 10px 0;
}

/* Export Hub Large Cards */
.export-hub-card {
  background: #ffffff;
  border: 1px solid #c8c6c4;
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.export-hub-card:hover {
  border-color: #0078d4;
  background: #f8fbfd;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}
.theme-office-dark .export-hub-card {
  background: #333333;
  border-color: #484848;
}
.theme-office-dark .export-hub-card:hover {
  background: #3a3a3a;
  border-color: #38bdf8;
}

/* ─────────────────────────────────────────────────
   PRINT CSS — হাই-কোয়ালিটি প্রিন্ট আউটপুট
   ───────────────────────────────────────────────── */
@media print {
  .no-print,
  #word-titlebar,
  #word-ribbon-panels,
  .word-ribbon-tabs,
  #editor-pane,
  #word-ruler-wrapper,
  #word-ruler-v,
  .office-status-bar,
  #word-mini-toolbar,
  #studio-toast,
  .word-modal-backdrop { display: none !important; }

  body { background: white !important; overflow: visible !important; }

  #preview-section, #office-canvas, #zoom-container,
  .word-canvas-wrapper, main {
    overflow: visible !important; flex: none !important;
    height: auto !important; width: 100% !important; display: block !important;
  }

  .paper-sheet {
    box-shadow: none !important; border-radius: 0 !important;
    border: none !important; margin: 0 auto !important;
    page-break-after: always;
  }
  .paper-sheet:last-child { page-break-after: avoid; }

  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* OMR Bubble — প্রিন্টে সঠিক আকার */
.omr-bubble {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid #333; display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 9px; margin: 1px;
}
@media print {
  .omr-bubble { width: 12px; height: 12px; border: 1.5px solid #000; font-size: 8px; }
}

/* Auto-Save Indicator */
#autosave-indicator { transition: color 0.3s ease; white-space: nowrap; }

/* Responsive — ছোট স্ক্রিন (১৩" ল্যাপটপ) */
@media (max-width: 1280px) {
  .word-ribbon-group { gap: 3px; padding: 4px 6px; }
  .word-ribbon-panel { min-height: 58px; flex-wrap: wrap; }
  .ribbon-group-footer { font-size: 8.5px; }
  .word-btn-large { padding: 3px 5px; min-width: 44px; font-size: 9px; }
  .word-btn-large i { font-size: 11px; }
  .word-select { font-size: 10px; padding: 2px 4px; }
}
@media (max-width: 1024px) {
  .word-ribbon-tabs { overflow-x: auto; scrollbar-width: none; }
  .word-ribbon-tabs::-webkit-scrollbar { display: none; }
  #editor-pane { width: 42% !important; }
}

/* Drag-over highlight for textarea */
#input-text.border-blue-400 {
  border-color: #60a5fa !important;
  background: rgba(96, 165, 250, 0.05) !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* Salary Slip dark bg — print */
@media print {
  [style*="background: #1a1a2e"] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
