/* /opt/kracker/frontend/app/editor/editor.css */
/* Rich text editor — description + comments */

.rte{
  position: relative;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(12,14,20,.28);
  overflow: visible;
}
.rte:focus-within{
  border-color: rgba(76,125,255,.55);
  box-shadow: var(--focus-ring);
}

.rte-toolbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(18,20,28,.55);
  border-radius: 14px 14px 0 0;
}

.rte-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(233,237,246,.82);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
}
.rte-btn:hover{ background: rgba(255,255,255,.06); color: var(--text); }
.rte-btn.is-active{
  background: rgba(76,125,255,.18);
  color: #fff;
}
.rte-btn-menu{ padding-right: 6px; }
.rte-chevron{
  font-size: 9px;
  opacity: .55;
  margin-left: 2px;
}
.rte-toolbar-mono{
  font-family: var(--font-mono);
  font-size: 12px;
}
.rte-toolbar-mark{
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(240, 201, 77, 0.78);
  color: #fff8dc;
  font-weight: 700;
}
.rte-color-letter{
  font-weight: 700;
  border-bottom: 2px solid #5b8def;
  line-height: 1.1;
  padding-bottom: 1px;
}

.rte-sep{
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: rgba(255,255,255,.12);
  flex: 0 0 auto;
}

.rte-menu-wrap{
  position: relative;
}
.rte-menu{
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 220px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(22,24,34,.98);
  box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.rte-menu-head{
  padding: 6px 10px 4px;
  font-size: 11px;
  color: var(--muted);
  text-transform: none;
}
.rte-menu-item{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
}
.rte-menu-item:hover,
.rte-menu-item.is-active{
  background: rgba(76,125,255,.16);
}
.rte-menu-item i{
  width: 16px;
  text-align: center;
  color: var(--muted);
  flex: 0 0 auto;
}
.rte-color-swatch{
  width: 18px;
  font-weight: 700;
  flex: 0 0 auto;
}
.rte-h-preview{ display:block; }
.rte-h-preview-h1{ font-size: 22px; font-weight: 700; }
.rte-h-preview-h2{ font-size: 18px; font-weight: 700; }
.rte-h-preview-h3{ font-size: 16px; font-weight: 650; }
.rte-h-preview-h4{ font-size: 14px; font-weight: 650; }
.rte-h-preview-h5{ font-size: 13px; font-weight: 600; }
.rte-h-preview-h6{ font-size: 12px; font-weight: 600; color: var(--muted); }
.rte-h-preview-p{ font-size: 13px; font-weight: 400; color: var(--muted); }

.rte-surface{
  min-height: 120px;
  max-height: 480px;
  overflow-y: auto;
  padding: 12px 14px;
  outline: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.rte-surface:empty:before,
.rte-surface[data-placeholder]:not(:focus):not(.is-filled):before{
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.rte-surface:empty:before{
  content: attr(data-placeholder);
  color: var(--muted);
}

/* Content typography inside editor + readonly render */
.rte-surface p,
.rte-content p{ margin: 0 0 .55em; }
.rte-surface p:last-child,
.rte-content p:last-child{ margin-bottom: 0; }
.rte-surface h1, .rte-content h1{ font-size: 1.75em; font-weight: 700; margin: .4em 0 .35em; line-height: 1.25; }
.rte-surface h2, .rte-content h2{ font-size: 1.45em; font-weight: 700; margin: .4em 0 .35em; line-height: 1.3; }
.rte-surface h3, .rte-content h3{ font-size: 1.25em; font-weight: 650; margin: .35em 0 .3em; line-height: 1.35; }
.rte-surface h4, .rte-content h4{ font-size: 1.1em; font-weight: 650; margin: .3em 0 .25em; }
.rte-surface h5, .rte-content h5{ font-size: 1em; font-weight: 600; margin: .3em 0 .2em; }
.rte-surface h6, .rte-content h6{ font-size: .92em; font-weight: 600; margin: .25em 0 .2em; color: rgba(233,237,246,.78); }
.rte-surface ul, .rte-content ul,
.rte-surface ol, .rte-content ol{
  margin: .35em 0 .55em;
  padding-left: 1.4em;
}
.rte-surface li, .rte-content li{ margin: .15em 0; }
.rte-surface code, .rte-content code,
.rte-mono{
  font-family: var(--font-mono);
  font-size: .92em;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 1px 5px;
}
.rte-surface mark, .rte-content mark,
.rte-mark{
  background: rgba(240, 201, 77, 0.78);
  color: #fff8dc;
  border-radius: 3px;
  padding: 0 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.rte-surface a, .rte-content a{
  color: #7eb0ff;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.rte-surface a:hover, .rte-content a:hover{ color: #a8c9ff; }

.rte-content{
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.55;
  font-size: 14px;
}
.rte-content--readonly a{ pointer-events: auto; }

.rte-link-bubble{
  position: absolute;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  width: 340px;
  max-width: calc(100vw - 32px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(40,42,52,.98);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.rte-link-bubble[hidden]{ display: none !important; }
.rte-link-bubble-row{
  display: flex;
  align-items: center;
  gap: 10px;
}
.rte-link-label{
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.rte-link-input{
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(12,14,20,.55);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
.rte-link-input:focus{
  border-color: rgba(76,125,255,.55);
}
.rte-link-open{
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.rte-link-open:hover{ color: var(--text); background: rgba(255,255,255,.06); }
.rte-link-bubble-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.rte-link-cancel,
.rte-link-apply{
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
}
.rte-link-cancel{
  background: transparent;
  color: var(--muted);
}
.rte-link-cancel:hover{ color: var(--text); background: rgba(255,255,255,.05); }
.rte-link-apply{
  background: rgba(76,125,255,.95);
  color: #fff;
}
.rte-link-apply:hover{ background: rgba(76,125,255,1); }

/* Description view / edit (pencil) */
.desc-view-wrap{
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 48px;
  padding: 4px 0 8px;
}
.desc-view{
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 8px;
}
.desc-view.is-empty{ min-height: 1.5em; }
.desc-edit-btn{
  flex: 0 0 auto;
  margin-top: 2px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(233,237,246,.45);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.desc-view-wrap:hover .desc-edit-btn,
.desc-edit-btn:focus{
  opacity: 1;
  color: rgba(233,237,246,.85);
}
.desc-edit-btn:hover{
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.desc-edit-wrap{ display: flex; flex-direction: column; gap: 8px; }
/* class {display:flex} must not override [hidden] */
.desc-view-wrap[hidden],
.desc-edit-wrap[hidden]{
  display: none !important;
}
.desc-edit-actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

/* Compact variant for comments */
.rte--compact .rte-surface{
  min-height: 72px;
  max-height: 240px;
}

/* Keep attachment controls spacing when editor replaces textarea */
.textarea-wrapper .rte{ margin-bottom: 0; }
