/* ============================================================
   special-chars.css
   Styles for the "Insert Special Characters" panel.
   Compatible with Bootstrap 3 layout used by CMSfor sol-backend.
   ============================================================ */

/* ── Overlay (semi-transparent backdrop) ── */
.sc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* top/right/bottom/left: 0 */
  z-index: 9000;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sc-overlay--open {
  display: block;
  opacity: 1;
}

/* ── Panel ── */
.sc-panel {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -44%) scale(0.96);
  z-index: 9100;
  width: min(820px, 96vw);
  max-height: 82vh;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #d1d9e0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-family: "robotoregular", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

.sc-panel--open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* ── Header ── */
.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f8f9fa;
  color: #333;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
}

.sc-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sc-close-btn {
  background: transparent;
  border: none;
  color: #6c757d;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  min-width: 0;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.sc-close-btn:hover {
  color: #dc3545;
  background: #fff0f0;
}

/* ── Search Bar ── */
.sc-search-wrap {
  padding: 10px 16px 8px;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
  background: #f8f9fa;
}

.sc-search {
  width: 100%;
  font-size: 13px;
  border-radius: 20px !important;
  border: 1px solid #ced4da !important;
  padding: 7px 14px !important;
  height: auto !important;
  background: #fff;
  color: #495057;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sc-search:focus {
  border-color: #2c3e50 !important;
  box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.18) !important;
  outline: none;
}

/* ── Body / Scroll container ── */
.sc-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  padding: 10px 16px 4px;
  -webkit-overflow-scrolling: touch;
}

/* Smooth scrollbar (modern browsers) */
.sc-body::-webkit-scrollbar {
  width: 6px;
}

.sc-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.sc-body::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 3px;
}

.sc-body::-webkit-scrollbar-thumb:hover {
  background: #888;
}

/* ── Category sections ── */
.sc-category {
  margin-bottom: 12px;
}

.sc-search-results {
  margin-bottom: 12px;
}

.sc-category-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #6c757d;
  padding: 4px 0 6px;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 6px;
}

/* ── Character Grid ── */
.sc-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Individual Character Button ── */
.sc-char-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 16px;
  background: #f4f6f8;
  border: 1px solid #e2e6ea;
  border-radius: 5px;
  cursor: pointer;
  color: #2d2d2d;
  transition: background 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.12s;
  padding: 0;
  min-width: 0;
  line-height: 1;
  font-family:
    "Segoe UI Symbol",
    "Noto Sans Symbols",
    "Cambria Math",
    "STIX Two Math",
    "DejaVu Sans",
    Arial,
    sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

.sc-char-btn:hover {
  background: #e8f0fe;
  border-color: #4a90d9;
  color: #1a1a2e;
  transform: translateY(-1px) scale(1.12);
  box-shadow: 0 3px 8px rgba(74, 144, 217, 0.25);
  z-index: 1;
}

.sc-char-btn:active,
.sc-char-btn--inserted {
  background: #2c3e50;
  border-color: #2c3e50;
  color: #fff;
  transform: scale(0.96);
  box-shadow: none;
  transition: background 0.05s, color 0.05s, transform 0.05s;
}

/* ── No result message ── */
.sc-no-result {
  font-size: 13px;
  color: #888;
  padding: 8px 0;
  font-style: italic;
}

/* ── Footer ── */
.sc-footer {
  padding: 8px 16px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  font-size: 11px;
  color: #888;
  text-align: center;
  border-radius: 0 0 8px 8px;
  flex-shrink: 0;
}

/* ── Quill toolbar button style tweak ─────────────────────────
   Keeps the "Ω Special Characters" button visually consistent
   with other custom toolbar buttons (fraction, audio, etc.)
   ──────────────────────────────────────────────────────────── */
.ql-toolbar .ql-specialchar {
  font-size: 14px;
  font-weight: 700;
  width: auto;
  padding: 0 6px;
  color: #444;
}

.ql-toolbar .ql-specialchar:hover {
  color: #06c;
}

/* ── Bigger icons: fraction & specialchar ────────────────────────
   Default Quill toolbar buttons are 28px × 28px with an 18×18 SVG.
   We scale both buttons up so the Ω and ½ glyphs are clearly
   readable without sacrificing toolbar proportions.
   ──────────────────────────────────────────────────────────── */
.ql-toolbar .ql-fraction,
.ql-toolbar .ql-specialchar {
  width: 36px !important;
  height: 28px !important;
  padding: 0 2px !important;
}

.ql-toolbar .ql-fraction svg,
.ql-toolbar .ql-specialchar svg {
  width: 26px !important;
  height: 26px !important;
}

/* Make the text inside those SVGs sharper / bigger */
.ql-toolbar .ql-fraction svg text,
.ql-toolbar .ql-specialchar svg text {
  font-size: 13px !important;
  font-weight: 700 !important;
  font-family: "Segoe UI", Arial, sans-serif !important;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .sc-panel {
    width: 98vw;
    max-height: 90vh;
    top: 50%;
  }

  .sc-char-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ============================================================
   FRACTION INPUT POPUP
   Floating panel that appears below the ½ toolbar button.
   ============================================================ */
.ql-fraction-popup {
  display: none;
  position: fixed;
  z-index: 9200;
  width: 320px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.10);
  font-family: "robotoregular", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  animation: ql-fp-in 0.18s ease;
}

@keyframes ql-fp-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ql-fraction-popup.ql-fp--open {
  display: block;
}

/* Header */
.ql-fp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #1a6b3c 0%, #27ae60 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.ql-fp-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  min-width: 0;
  border-radius: 3px;
  transition: color 0.12s, background 0.12s;
}

.ql-fp-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

/* Live preview section */
.ql-fp-preview-wrap {
  background: #f0faf4;
  border-bottom: 1px solid #d4edda;
  padding: 12px 16px 6px;
  text-align: center;
}

.ql-fp-live-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}

.ql-fp-preview-label {
  font-size: 10px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 6px;
}

/* Inputs row */
.ql-fp-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 4px;
}

.ql-fp-field {
  flex: 1;
}

.ql-fp-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ql-fp-label small {
  text-transform: none;
  font-weight: 400;
  color: #888;
  letter-spacing: 0;
}

.ql-fp-input {
  border-radius: 4px !important;
  font-size: 14px !important;
  text-align: center;
  font-weight: 600;
}

.ql-fp-divider-sym {
  font-size: 20px;
  color: #aaa;
  padding-bottom: 6px;
  flex-shrink: 0;
  line-height: 1;
  align-self: center;
}

/* Action buttons */
.ql-fp-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
  justify-content: flex-end;
}

.ql-fp-actions .btn {
  min-width: 0;
  font-size: 12px !important;
}

/* ============================================================
   INLINE FRACTION — displayed inside .ql-editor
   Renders the stacked fraction: numerator over a horizontal
   rule over denominator, vertically centred on the text baseline.
   ============================================================ */

/* Inside the Quill editor */
.ql-custom-fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1.15;
  margin: 0 3px;
  font-size: 0.88em;
  position: relative;
  top: 0.05em;
  /* nudge down slightly for optical alignment */
  cursor: default;
  user-select: text;
}

.ql-cf-num {
  display: block;
  text-align: center;
  min-width: 1.4em;
  padding: 0 3px 1px;
  border-bottom: 1.5px solid currentColor;
  font-weight: 600;
  line-height: 1.2;
}

.ql-cf-bar {
  /* The bar is rendered as the border-bottom on .ql-cf-num */
  display: none;
}

.ql-cf-den {
  display: block;
  text-align: center;
  min-width: 1.4em;
  padding: 1px 3px 0;
  font-weight: 600;
  line-height: 1.2;
}

/* Slightly larger fraction in the live preview for clarity */
#ql-math-preview .ql-custom-fraction {
  font-size: 1.4em;
  color: #2c3e50;
}

/* Custom Math Expressions: Mixed, Sqrt, Sub, Sup */

.ql-custom-mixed {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.ql-mixed-whole {
  margin-right: 1px;
}

.ql-custom-sqrt {
  display: inline-flex;
  align-items: flex-end;
  /* Align bottom to keep text baseline stable */
  white-space: nowrap;
  vertical-align: middle;
}

.ql-sqrt-index {
  font-size: 0.7em;
  margin-right: -0.2em;
  transform: translateY(-0.8em);
}

.ql-sqrt-symbol {
  font-size: 1.34em;
  line-height: 0.8;
  margin-right: -0.02em;
}

.ql-sqrt-value {
  border-top: 1px solid currentColor;
  padding: 0.05em 0.1em 0 0.1em;
  display: inline-block;
}

.ql-custom-sub,
.ql-custom-sup {
  display: inline-flex;
  align-items: baseline;
}