/* ============================================
   VLEditor - White Theme
   ============================================ */
:root {
  --rte-bg: #ffffff;
  --rte-border: #e2e8f0;
  --rte-border-dark: #cbd5e1;
  --rte-toolbar-bg: #f8fafc;
  --rte-btn-hover: #f1f5f9;
  --rte-btn-active: #dbeafe;
  --rte-accent: #2563eb;
  --rte-accent-light: #eff6ff;
  --rte-text: #1e293b;
  --rte-text-muted: #94a3b8;
  --rte-placeholder: #b0bac5;
  --rte-shadow: 0 1px 4px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
  --rte-radius: 10px;
  --rte-status-bg: #f8fafc;
  --rte-error-bg: #fff5f5;
  --rte-error-border: #fed7d7;
  --rte-error-text: #c53030;
}

/* ---- Container ---- */
.rte-container {
  width: 100%;
  height: 500px;
  border: 1.5px solid var(--rte-border);
  border-radius: var(--rte-radius);
  box-shadow: var(--rte-shadow);
  display: flex;
  flex-direction: column;
  background: var(--rte-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
  margin: 20px 0;
}

.rte-container:focus-within {
  border-color: var(--rte-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12), var(--rte-shadow);
}

/* ---- Toolbar ---- */
.rte-toolbar {
  background: var(--rte-toolbar-bg);
  border-bottom: 1px solid var(--rte-border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rte-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px;
  min-height: 34px;
}

/* ---- Toolbar Buttons ---- */
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  color: var(--rte-text);
  padding: 0;
  transition: background .12s, border-color .12s, color .12s;
  flex-shrink: 0;
  outline: none;
  -webkit-appearance: none;
}

.rte-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  display: block;
}

.rte-btn:hover {
  background: var(--rte-btn-hover);
  border-color: var(--rte-border-dark);
}

.rte-btn:focus-visible {
  outline: 2px solid var(--rte-accent);
  outline-offset: 1px;
}

.rte-btn.rte-active {
  background: var(--rte-btn-active);
  border-color: var(--rte-accent);
  color: var(--rte-accent);
}

/* ---- Color Buttons ---- */
.rte-color-btn {
  position: relative;
  cursor: pointer;
}

.rte-color-btn input[type="color"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  top: 0;
  left: 0;
  border: none;
  padding: 0;
}

/* ---- Separator ---- */
.rte-sep {
  width: 1px;
  height: 20px;
  background: var(--rte-border-dark);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ---- Select Dropdowns — cross-platform consistent ---- */
.rte-select-wrap {
  display: inline-flex;
  position: relative;
}

.rte-select {
  height: 28px;
  border: 1px solid var(--rte-border-dark);
  border-radius: 5px;
  background: #ffffff;
  color: var(--rte-text);
  font-size: 12px;
  font-family: inherit;
  padding: 0 22px 0 7px;
  cursor: pointer;
  outline: none;
  max-width: 130px;
  transition: border-color .12s;
  /* Cross-platform: remove native arrow and add consistent styling */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  box-sizing: border-box;
}

.rte-select:hover,
.rte-select:focus {
  border-color: var(--rte-accent);
}

/* ---- Editor Area ---- */
.rte-editor {
  flex: 1;
  padding: 18px 22px;
  outline: none;
  min-height: 300px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--rte-text);
  background: #ffffff;
  overflow-y: auto;
  word-break: break-word;
}

.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--rte-placeholder);
  pointer-events: none;
  display: block;
}

.rte-editor h1 {
  font-size: 2em;
  font-weight: 700;
  margin: .67em 0;
}

.rte-editor h2 {
  font-size: 1.5em;
  font-weight: 600;
  margin: .75em 0;
}

.rte-editor h3 {
  font-size: 1.25em;
  font-weight: 600;
  margin: .83em 0;
}

.rte-editor h4 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 1em 0;
}

.rte-editor p {
  margin: .5em 0;
}

.rte-editor a {
  color: var(--rte-accent);
  text-decoration: underline;
}

.rte-editor blockquote {
  border-left: 4px solid var(--rte-accent);
  margin: 1em 0;
  padding: .5em 1em;
  color: #64748b;
  background: #f0f6ff;
  border-radius: 0 6px 6px 0;
}

.rte-editor pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1em;
  border-radius: 7px;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
  font-size: 13px;
}

.rte-editor table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
}

.rte-editor table td,
.rte-editor table th {
  border: 1px solid var(--rte-border-dark);
  padding: 8px 12px;
}

.rte-editor table th {
  background: #f0f4ff;
  font-weight: 600;
}

.rte-editor ul,
.rte-editor ol {
  padding-left: 1.5em;
  margin: .5em 0;
}

.rte-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ---- Inline Error Popup (inside editor, above textarea) ---- */
.rte-error-popup {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--rte-error-bg);
  border: 1.5px solid var(--rte-error-border);
  border-left: 4px solid var(--rte-error-text);
  color: var(--rte-error-text);
  padding: 11px 14px;
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  line-height: 1.5;
}

.rte-error-popup svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--rte-error-text);
}

.rte-error-msg {
  flex: 1;
}

.rte-error-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rte-error-text);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: .7;
  flex-shrink: 0;
}

.rte-error-close:hover {
  opacity: 1;
}

/* ---- Status Bar ---- */
.rte-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 14px;
  background: var(--rte-status-bg);
  border-top: 1px solid var(--rte-border);
  font-size: 11px;
  color: #94a3b8;
  user-select: none;
}

/* ---- Fullscreen ---- */
.rte-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  border-radius: 0 !important;
  border: none !important;
}

.rte-fullscreen .rte-editor {
  flex: 1;
  height: calc(100vh - 130px) !important;
  max-height: none !important;
}

.rte-body-fullscreen {
  overflow: hidden;
}

/* ---- Modals ---- */
.rte-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 16px;
  box-sizing: border-box;
}

.rte-modal {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .22), 0 4px 16px rgba(0, 0, 0, .1);
  min-width: 320px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: auto;
  width: 100%;
}

.rte-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rte-border);
  font-weight: 600;
  font-size: 15px;
  color: var(--rte-text);
}

.rte-modal-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 5px;
  transition: background .12s, color .12s;
}

.rte-modal-close:hover {
  background: #f1f5f9;
  color: var(--rte-text);
}

.rte-modal-body {
  padding: 18px 20px;
}

/* ---- Charmap / Emoji ---- */
.rte-charmap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 350px;
}

.rte-char-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--rte-border-dark);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s;
}

.rte-char-btn:hover {
  background: var(--rte-btn-active);
  border-color: var(--rte-accent);
}

/* ---- Toast ---- */
.rte-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  z-index: 100001;
  animation: rteToastIn .18s ease;
  white-space: nowrap;
}

@keyframes rteToastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ---- Print ---- */
@media print {

  .rte-toolbar,
  .rte-statusbar {
    display: none !important;
  }

  .rte-container {
    border: none !important;
    box-shadow: none !important;
  }
}
.swal2-container{z-index:2147483000!important}
