/* ========================================
   EDITOR.JS STYLES
   Warm neutral design matching write.css
   ======================================== */

/* ----------------------------------------
   EDITOR CONTAINER
   ---------------------------------------- */
.codex-editor {
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

.codex-editor__redactor {
  padding: 0 !important;
}

.ce-block {
  padding: 4px 0;
  position: relative;
}

.ce-block__content {
  max-width: 100%;
  margin: 0;
}

/* ----------------------------------------
   PARAGRAPH
   ---------------------------------------- */
.ce-paragraph {
  font-size: 16px;
  line-height: 1.75;
  color: #e8e8e8;
  padding: 6px 0;
  outline: none;
}

.ce-paragraph[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: #666;
  pointer-events: none;
}

/* ----------------------------------------
   HEADERS
   ---------------------------------------- */
.ce-header {
  font-weight: 700;
  color: #fff;
  outline: none;
  line-height: 1.3;
  padding: 8px 0;
}

h2.ce-header { font-size: 26px; }
h3.ce-header { font-size: 22px; }
h4.ce-header { font-size: 18px; }

/* ----------------------------------------
   LISTS
   ---------------------------------------- */
.cdx-list {
  padding-left: 24px;
  margin: 8px 0;
}

.cdx-list__item {
  padding: 4px 0;
  line-height: 1.7;
  color: #e8e8e8;
  font-size: 16px;
}

/* ----------------------------------------
   CODE BLOCK
   ---------------------------------------- */
.ce-code__textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #e8e8e8;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 16px;
  min-height: 80px;
  resize: vertical;
}

.ce-code__textarea:focus {
  border-color: rgba(255, 255, 255, 0.15);
  outline: none;
}

/* ----------------------------------------
   QUOTE
   ---------------------------------------- */
.cdx-quote {
  margin: 12px 0;
  padding: 16px 20px;
  border-left: 3px solid #555;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0 8px 8px 0;
}

.cdx-quote__text {
  font-style: italic;
  font-size: 16px;
  line-height: 1.7;
  color: #ccc;
  margin-bottom: 8px;
}

.cdx-quote__caption {
  font-size: 13px;
  color: #777;
}

/* ----------------------------------------
   IMAGE
   ---------------------------------------- */
.image-tool {
  margin: 12px 0;
}

.image-tool__image {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.image-tool__image-picture {
  max-width: 100%;
  display: block;
}

.image-tool__caption {
  padding: 10px 14px;
  font-size: 13px;
  color: #777;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  outline: none;
}

.image-tool--empty .image-tool__image {
  background: rgba(0, 0, 0, 0.25);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  padding: 40px;
  text-align: center;
  cursor: pointer;
}

.image-tool--empty .image-tool__image:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* ----------------------------------------
   DELIMITER
   ---------------------------------------- */
.ce-delimiter {
  text-align: center;
  padding: 20px 0;
}

.ce-delimiter::before {
  content: '• • •';
  color: #555;
  letter-spacing: 8px;
}

/* ----------------------------------------
   CHECKLIST
   ---------------------------------------- */
.cdx-checklist {
  margin: 8px 0;
}

.cdx-checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
}

.cdx-checklist__item-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  cursor: pointer;
}

.cdx-checklist__item--checked .cdx-checklist__item-checkbox {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.cdx-checklist__item-text {
  flex: 1;
  color: #e8e8e8;
  line-height: 1.5;
  outline: none;
}

.cdx-checklist__item--checked .cdx-checklist__item-text {
  color: #666;
  text-decoration: line-through;
}

/* ----------------------------------------
   INPUT FIELDS
   ---------------------------------------- */
.cdx-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #e8e8e8;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}

.cdx-input:focus {
  border-color: rgba(255, 255, 255, 0.15);
}

.cdx-input::placeholder {
  color: #666;
}

/* ----------------------------------------
   TOOLBAR - Positioned on the right
   ---------------------------------------- */
.ce-toolbar {
  position: absolute !important;
  left: auto !important;
  right: -70px !important;
  top: 0 !important;
  transform: none !important;
  width: auto !important;
  z-index: 10;
  pointer-events: auto;
  opacity: 0;
  animation: toolbarFadeIn 0.4s ease 0.3s forwards;
}

@keyframes toolbarFadeIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.ce-toolbar__content {
  max-width: none !important;
  margin: 0 !important;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.ce-toolbar__actions {
  position: relative !important;
  right: auto !important;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  opacity: 1 !important;
  padding: 6px;
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.ce-toolbar__actions:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.ce-toolbar__actions::before {
  content: none;
}

/* Plus Button */
.ce-toolbar__plus {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  animation: plusPulse 3s ease-in-out 1s 2;
}

@keyframes plusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1); }
}

.ce-toolbar__plus:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  transform: scale(1.08);
  animation: none;
}

.ce-toolbar__plus:active {
  transform: scale(0.95);
}

.ce-toolbar__plus svg {
  width: 16px;
  height: 16px;
}

/* Settings Button */
.ce-toolbar__settings-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ce-toolbar__settings-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: scale(1.05);
}

.ce-toolbar__settings-btn:active {
  transform: scale(0.95);
}

.ce-toolbar__settings-btn svg {
  width: 14px;
  height: 14px;
}

/* ----------------------------------------
   POPOVER (Block Toolbox)
   ---------------------------------------- */
.ce-popover {
  position: absolute !important;
  z-index: 100 !important;
  margin-top: 24px !important;
  background: rgba(13, 13, 13, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6) !important;
  overflow: hidden !important;
  min-width: 200px !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: popoverIn 0.2s ease-out;
}

@keyframes popoverIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ce-popover__container {
  background: transparent !important;
}

.ce-popover__items {
  padding: 8px !important;
  background: transparent !important;
  max-height: 320px;
  overflow-y: auto;
}

/* Popover Items */
.ce-popover-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 12px !important;
  border-radius: 8px !important;
  color: #aaa !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  border: none !important;
}

.ce-popover-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.ce-popover-item--focused {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

/* Popover Item Icon */
.ce-popover-item__icon {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
  color: #777 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.ce-popover-item:hover .ce-popover-item__icon {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}

.ce-popover-item__icon svg {
  width: 14px !important;
  height: 14px !important;
}

/* Popover Item Title */
.ce-popover-item__title {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: inherit !important;
}

.ce-popover-item__secondary-title {
  font-size: 12px !important;
  color: #666 !important;
}

/* Search in Popover */
.cdx-search-field {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  margin: 8px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
}

.cdx-search-field__icon {
  color: #666 !important;
  padding-left: 12px !important;
}

.cdx-search-field__icon svg {
  width: 14px !important;
  height: 14px !important;
}

.cdx-search-field__input {
  background: transparent !important;
  border: none !important;
  color: #e8e8e8 !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
  width: 100% !important;
  outline: none !important;
}

.cdx-search-field__input::placeholder {
  color: #666 !important;
}

/* Nothing Found */
.ce-popover__nothing-found-message {
  color: #666 !important;
  font-size: 13px !important;
  padding: 20px !important;
  text-align: center !important;
}

/* ----------------------------------------
   BLOCK SETTINGS
   ---------------------------------------- */
.ce-settings {
  background: rgba(13, 13, 13, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6) !important;
  padding: 8px !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.ce-settings__default-zone,
.ce-settings__plugin-zone {
  display: flex !important;
  gap: 4px !important;
  padding: 4px 0 !important;
  background: transparent !important;
}

.ce-settings__button,
.cdx-settings-button {
  width: 32px !important;
  height: 32px !important;
  color: #777 !important;
  border-radius: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.ce-settings__button:hover,
.cdx-settings-button:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.cdx-settings-button--active {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

.cdx-settings-button svg {
  width: 16px !important;
  height: 16px !important;
}

/* ----------------------------------------
   INLINE TOOLBAR
   ---------------------------------------- */
.ce-inline-toolbar {
  background: rgba(13, 13, 13, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.ce-inline-toolbar__toggler-and-button-wrapper,
.ce-inline-toolbar__buttons {
  padding: 4px !important;
  background: transparent !important;
}

.ce-inline-tool {
  width: 32px !important;
  height: 32px !important;
  color: #777 !important;
  border-radius: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  transition: all 0.15s ease !important;
}

.ce-inline-tool:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.ce-inline-tool--active {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

.ce-inline-tool svg {
  width: 14px !important;
  height: 14px !important;
}

/* Inline Input */
.ce-inline-toolbar__dropdown {
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-right: 4px !important;
  padding-right: 4px !important;
}

.ce-inline-toolbar-input {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
  color: #e8e8e8 !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  margin: 4px !important;
}

.ce-inline-toolbar-input:focus {
  border-color: rgba(255, 255, 255, 0.15) !important;
  outline: none !important;
}

/* ----------------------------------------
   CONVERSION TOOLBAR
   ---------------------------------------- */
.ce-conversion-toolbar {
  background: rgba(13, 13, 13, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
  padding: 6px !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.ce-conversion-tool {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  color: #aaa !important;
  background: transparent !important;
  transition: all 0.15s ease !important;
}

.ce-conversion-tool:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fff !important;
}

.ce-conversion-tool__icon {
  width: 26px !important;
  height: 26px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #777 !important;
}

.ce-conversion-tool:hover .ce-conversion-tool__icon {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}

/* ----------------------------------------
   BLOCK STATES
   ---------------------------------------- */
.ce-block--focused {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 6px;
}

.ce-block--selected .ce-block__content {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

/* ----------------------------------------
   SELECTION
   ---------------------------------------- */
::selection {
  background: rgba(90, 130, 170, 0.4);
}

::-moz-selection {
  background: rgba(90, 130, 170, 0.4);
}

/* ----------------------------------------
   BUTTONS
   ---------------------------------------- */
.cdx-button {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ccc !important;
  border-radius: 6px !important;
  padding: 8px 16px !important;
  font-size: 13px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.cdx-button:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}

/* ----------------------------------------
   LOADER
   ---------------------------------------- */
.cdx-loader {
  background: rgba(13, 13, 13, 0.9) !important;
}

/* ----------------------------------------
   SCROLLBAR
   ---------------------------------------- */
.ce-popover__items::-webkit-scrollbar,
.ce-code__textarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.ce-popover__items::-webkit-scrollbar-track,
.ce-code__textarea::-webkit-scrollbar-track {
  background: transparent;
}

.ce-popover__items::-webkit-scrollbar-thumb,
.ce-code__textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.ce-popover__items::-webkit-scrollbar-thumb:hover,
.ce-code__textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ----------------------------------------
   SEPARATOR
   ---------------------------------------- */
.ce-popover-item-separator,
.ce-popover__items-separator {
  height: 1px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  margin: 4px 8px !important;
}

/* ----------------------------------------
   DANGER/CONFIRM ACTIONS
   ---------------------------------------- */
.ce-popover-item--confirmation {
  color: #f87171 !important;
}

.ce-popover-item--confirmation .ce-popover-item__icon {
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.2) !important;
}

/* ----------------------------------------
   HEADER LEVEL SELECTOR
   ---------------------------------------- */
.ce-popover-header {
  padding: 8px 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: transparent !important;
}

.ce-popover-header__text {
  color: #666 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

/* ----------------------------------------
   TOOLBOX
   ---------------------------------------- */
.ce-toolbox {
  background: rgba(13, 13, 13, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.ce-toolbox__button {
  color: #888 !important;
  transition: color 0.15s ease !important;
}

.ce-toolbox__button:hover {
  color: #fff !important;
}

/* ----------------------------------------
   BLOCK TUNES
   ---------------------------------------- */
.ce-block__tunes {
  background: transparent !important;
}

/* ----------------------------------------
   MOBILE — Toolbar as sticky bottom bar
   ---------------------------------------- */
@media (max-width: 768px) {
  .ce-toolbar {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    z-index: 50;
    opacity: 1;
    animation: none;
    padding: 8px 16px;
    background: rgba(15, 15, 15, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-sizing: border-box;
  }

  .ce-toolbar__content {
    justify-content: center;
  }

  .ce-toolbar__actions {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    gap: 8px;
  }

  .ce-toolbar__actions:hover {
    border-color: transparent;
    box-shadow: none;
  }

  .ce-toolbar__plus,
  .ce-toolbar__settings-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .ce-toolbar__plus svg {
    width: 18px;
    height: 18px;
  }

  .ce-toolbar__settings-btn svg {
    width: 16px;
    height: 16px;
  }
}
