/* exam-composer.css — Phân hệ Soạn Đề Thi A4 (chamnhanh.net) */
.ec-studio-shell.hidden,
.ec-drawer.hidden,
.ec-modal-backdrop.hidden,
.ec-figure-floating-bar.hidden,
.ec-drop-indicator.hidden,
.ec-studio-shell .hidden {
  display: none !important;
}

/* Ẩn các nút nổi Zalo / Hỗ trợ khi đang mở Soạn Đề Thi A4 */
html.exam-composer-mode #ag-support-fab,
body.exam-composer-mode #ag-support-fab,
html.exam-composer-mode #btn-floating-zalo,
body.exam-composer-mode #btn-floating-zalo,
html.exam-composer-mode .floating-zalo-pill,
body.exam-composer-mode .floating-zalo-pill,
html.exam-composer-mode .floating-zalo-fab,
body.exam-composer-mode .floating-zalo-fab,
html.exam-composer-mode [id*="zalo-fab"],
body.exam-composer-mode [id*="zalo-fab"],
html.exam-composer-mode #support-assistant-root,
body.exam-composer-mode #support-assistant-root {
  display: none !important;
}

.ec-studio-shell {
  position: fixed;
  inset: 0;
  z-index: 1040;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  color: #0f172a;
}

/* Split-Pane Docked Geometry Board Mode (55% Left Word Editor | 45% Right Geometry Board) */
html.ec-split-board-mode .ec-studio-shell,
body.ec-split-board-mode .ec-studio-shell {
  width: 55vw;
  right: auto;
}

html.ec-split-board-mode #geometry-drawing-board-view,
body.ec-split-board-mode #geometry-drawing-board-view {
  left: 55vw !important;
  width: 45vw !important;
  z-index: 1045 !important;
  border-left: 2px solid #cbd5e1;
}

html.ec-split-board-mode #geometry-drawing-board-view .geo-board-header-left .hide-on-mobile,
body.ec-split-board-mode #geometry-drawing-board-view #btn-geo-board-back,
html.ec-split-board-mode #geometry-drawing-board-view #btn-export-word,
body.ec-split-board-mode #geometry-drawing-board-view #btn-export-word {
  display: none !important;
}

html.ec-split-board-mode #geometry-drawing-board-view #drawer-panel,
body.ec-split-board-mode #geometry-drawing-board-view #drawer-panel {
  width: 220px;
}

html.ec-split-board-mode #geometry-drawing-board-view .geo-board-header,
body.ec-split-board-mode #geometry-drawing-board-view .geo-board-header {
  flex-wrap: wrap !important;
  height: auto !important;
  min-height: 44px;
  padding: 6px 10px !important;
  gap: 6px !important;
}

html.ec-split-board-mode #geometry-drawing-board-view .geo-board-header-actions,
body.ec-split-board-mode #geometry-drawing-board-view .geo-board-header-actions {
  flex-wrap: wrap;
  max-width: 100%;
  gap: 4px;
}

html.ec-split-board-mode #geometry-drawing-board-view #tool-guide-pill,
body.ec-split-board-mode #geometry-drawing-board-view #tool-guide-pill {
  display: none !important;
}

.ec-board-dock-actions {
  display: none;
}

html.ec-split-board-mode .ec-board-dock-actions,
body.ec-split-board-mode .ec-board-dock-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 54px;
  z-index: 35;
}

.ec-drag-pill {
  padding: 6px 10px;
  border-radius: 9px;
  background: #7c3aed;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: grab;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  user-select: none;
}
.ec-drag-pill:active { cursor: grabbing; }
.ec-drag-selected-pill {
  background: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.ec-insert-pill {
  padding: 6px 10px;
  border-radius: 9px;
  background: #2563eb;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.ec-close-split-pill {
  padding: 6px 10px;
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  cursor: pointer;
}

/* Màn hình hẹp / iPad (<= 1280px) ở chế độ chia đôi: xếp khay công cụ xuống đáy để dành 100% bề rộng cho Canvas */
@media (min-width: 768px) and (max-width: 1280px) {
  html.ec-split-board-mode #geometry-drawing-board-view .ggb-main-body,
  body.ec-split-board-mode #geometry-drawing-board-view .ggb-main-body {
    flex-direction: column-reverse !important;
    flex: 1 1 0;
    height: auto !important;
  }

  html.ec-split-board-mode #geometry-drawing-board-view #left-dock,
  body.ec-split-board-mode #geometry-drawing-board-view #left-dock {
    width: 100% !important;
    height: 196px !important;
    flex-direction: column !important;
    border-right: none !important;
    border-top: 1px solid var(--ggb-border) !important;
  }

  html.ec-split-board-mode #geometry-drawing-board-view #left-dock.is-mobile-collapsed,
  body.ec-split-board-mode #geometry-drawing-board-view #left-dock.is-mobile-collapsed {
    height: 56px !important;
  }

  html.ec-split-board-mode #geometry-drawing-board-view #left-dock.is-mobile-collapsed .ggb-drawer-panel,
  body.ec-split-board-mode #geometry-drawing-board-view #left-dock.is-mobile-collapsed .ggb-drawer-panel {
    display: none !important;
  }

  html.ec-split-board-mode #geometry-drawing-board-view .dgs-mobile-sheet-handle,
  body.ec-split-board-mode #geometry-drawing-board-view .dgs-mobile-sheet-handle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 16px;
    background: var(--ggb-surface-2);
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
  }

  html.ec-split-board-mode #geometry-drawing-board-view .ggb-icon-strip,
  body.ec-split-board-mode #geometry-drawing-board-view .ggb-icon-strip {
    width: 100% !important;
    height: 38px !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    border-right: none !important;
    border-bottom: 1px solid var(--ggb-border-soft) !important;
    padding: 2px 4px !important;
  }

  html.ec-split-board-mode #geometry-drawing-board-view .rail-nav-btn,
  body.ec-split-board-mode #geometry-drawing-board-view .rail-nav-btn {
    flex-direction: row !important;
    width: auto !important;
    height: 32px !important;
    padding: 0 10px !important;
    gap: 5px !important;
  }

  html.ec-split-board-mode #geometry-drawing-board-view #drawer-panel,
  body.ec-split-board-mode #geometry-drawing-board-view #drawer-panel {
    width: 100% !important;
    flex: 1 1 auto !important;
    height: auto !important;
  }
}

.dgs-prompt-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  z-index: 15;
}
.dgs-prompt-input {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
}
.dgs-prompt-input:focus {
  outline: none;
  border-color: #2563eb;
}
.dgs-prompt-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.dgs-prompt-btn-draw {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #2563eb;
}
.dgs-prompt-btn-pull {
  display: none;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}
html.ec-split-board-mode .dgs-prompt-btn-pull,
body.ec-split-board-mode .dgs-prompt-btn-pull {
  display: inline-flex;
  align-items: center;
}

.ec-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.ec-toolbar-left,
.ec-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ec-title-input {
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  min-width: 150px;
  max-width: 260px;
}
.ec-title-input:focus {
  border-color: #2563eb;
  outline: none;
  background: #f8fafc;
}

.ec-save-badge {
  font-size: 11px;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 999px;
}

.ec-quota-pill {
  border: 1px solid #cbd5e1;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ec-quota-pill.is-warn {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.ec-btn,
.ec-select {
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
}
.ec-btn.is-active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}
.ec-btn-primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.ec-btn-ghost {
  border-color: transparent;
  background: transparent;
}

.ec-more-tools-wrap {
  position: relative;
  display: inline-flex;
}

.ec-more-tools-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 226px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  padding: 6px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ec-more-tools-popover.hidden {
  display: none !important;
}

.ec-more-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
}

.ec-more-item:hover {
  background: #f1f5f9;
}

.ec-more-item-warn {
  color: #b45309;
}

.ec-more-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 3px 4px;
}

/* Kho Đề Thi Đã Soạn */
.ec-vault-modal-card {
  max-width: 640px;
  width: min(94vw, 640px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.ec-vault-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.ec-vault-search {
  flex: 1 1 200px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
}

.ec-vault-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ec-vault-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.ec-vault-card-info {
  min-width: 0;
  flex: 1;
}

.ec-vault-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ec-vault-card-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

.ec-vault-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ec-vault-empty {
  text-align: center;
  color: #64748b;
  font-size: 13px;
  padding: 28px 12px;
}

.ec-word-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

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

@media (max-width: 1024px) {
  .ec-ribbon-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .ec-ribbon-group::-webkit-scrollbar {
    display: none;
  }
  .ec-fmt-btn,
  .ec-fmt-select {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

.ec-fmt-btn {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  cursor: pointer;
}
.ec-fmt-btn:hover:not(:disabled) {
  background: #e2e8f0;
}
.ec-fmt-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ec-sep {
  width: 1px;
  height: 16px;
  background: #cbd5e1;
  margin: 0 3px;
}

.ec-mobile-tabs {
  display: none;
  gap: 6px;
}

.ec-a4-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 18px 12px 56px;
  display: block;
}

@media (max-width: 1023px) {
  .ec-a4-viewport {
    padding: 12px 8px 48px;
  }
  .ec-a4-page {
    padding: 16px 18px 28px;
    min-width: 0;
  }
}

.ec-a4-page {
  width: 100%;
  max-width: 794px;
  min-height: 1122px;
  height: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.07);
  padding: 20px 44px 36px;
  font-family: "Times New Roman", Times, serif;
  font-size: 15px;
  line-height: 1.6;
  cursor: text;
}
.ec-page1-bar {
  margin: -10px -28px 14px;
  height: 26px;
  padding: 0 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: Inter, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  user-select: none;
  cursor: default;
}
.ec-tab-stop {
  display: inline-block;
  min-width: 28px;
}
.ec-word-table.ec-table-borderless,
.ec-word-table.ec-table-borderless th,
.ec-word-table.ec-table-borderless td {
  border: 1px dashed #cbd5e1 !important;
  background: transparent !important;
}
.ec-layout-2col {
  width: 100%;
  table-layout: fixed;
  margin: 8px 0;
}
.ec-layout-2col td {
  width: 50%;
  vertical-align: top;
  padding: 6px 10px;
}
.ec-table-floating-bar {
  flex-wrap: wrap;
  max-width: min(96vw, 720px);
}
.ec-word-table td.ec-cell-selected,
.ec-word-table th.ec-cell-selected {
  background: rgba(59, 130, 246, 0.16) !important;
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.ec-fmt-btn-accent {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 700;
}

.ec-a4-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 13.5px;
}

.ec-bold { font-weight: 700; }

.ec-student-info-line {
  font-size: 14px;
  padding-bottom: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid #94a3b8;
}

.ec-editor-wrap {
  position: relative;
}

.ec-word-editor {
  min-height: 780px;
  outline: none;
  word-break: break-word;
}

.ec-doc-block {
  margin: 0 0 8px 0;
}
.ec-doc-section {
  margin-top: 14px;
  text-transform: uppercase;
}
.ec-q-num {
  color: #1e3a8a;
}

.ec-math-chip {
  display: inline-block;
  padding: 1px 4px;
  margin: 0 2px;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px dashed transparent;
  cursor: pointer;
}
.ec-math-chip:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.ec-opt-trigger {
  cursor: pointer;
  padding: 0 3px;
  border-radius: 4px;
}
.ec-opt-item.is-correct .ec-opt-trigger {
  color: #16a34a;
  text-decoration: underline;
  background: #dcfce7;
}
.ec-opt-trigger.ec-opt-check {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  padding: 0 5px;
}
.ec-opt-item.is-correct .ec-opt-trigger.ec-opt-check {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #60a5fa;
  text-decoration: none;
}
.ec-options-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 18px;
  margin: 4px 0 8px 18px;
}
.ec-options-4row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 4px 0 8px 18px;
}