/* Kvill — Edit mode: inline slide editing UI (Phase 1: text-only) */

/* ─── Edit button active state ─────────────────────── */

/* Toolbar edit button (mobile only — #mToolbar is hidden on desktop) active state */
.m-toolbar-btn.is-active {
  background: var(--accent-blue);
  color: #ffffff;
}

.m-toolbar-btn.is-active svg {
  color: #ffffff;
}

.m-toolbar-btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── FAB edit button (desktop entry point — #mToolbar is hidden ≥768px) ─── */

/* Active = clean solid accent-blue fill, white icon. No outer glow/rings —
   matches Kvill FAB minimalism (editorial, spacious). Same rule both themes
   because --accent-blue is identical in light & dark (#3b82f6). Inherits
   the base .m-fab-secondary backdrop-blur + border-radius. */
.m-fab-btn.m-fab-edit.is-active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  /* Keep base shadow intact — reset the elevated active-popup shadow that
     visual/fab.css might attach via .active (we use .is-active, not .active,
     but declaring shadow explicitly prevents fallthrough). */
  box-shadow:
    0 0.5px 1px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(59, 130, 246, 0.18);
}

.m-fab-btn.m-fab-edit.is-active svg {
  color: #ffffff;
}

[data-theme="dark"] .m-fab-btn.m-fab-edit.is-active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow:
    0 0.5px 1px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .m-fab-btn.m-fab-edit.is-active svg {
  color: #ffffff;
}

.m-fab-btn.m-fab-edit.is-active:hover {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
}

.m-fab-btn.m-fab-edit.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Undo/Redo buttons — визуально меньше, размер как иконки-actions ─── */

.m-toolbar-btn.m-edit-action svg {
  width: 18px;
  height: 18px;
}

.m-toolbar-btn.m-edit-action:disabled,
.m-toolbar-btn.m-edit-action[disabled] {
  opacity: 0.3;
  cursor: default;
}

/* ─── Edit indicator (Сохраняю… / Сохранено) ─────── */

.m-edit-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bg-input);
  transition: opacity 0.2s var(--ease);
}

.m-edit-indicator.is-saving {
  color: var(--text-2);
}

.m-edit-indicator.is-ok {
  color: var(--accent);
}

.m-edit-indicator.is-error {
  color: #d33;
}

.m-edit-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── body.edit-mode-active: global visuals while editing ─── */

body.edit-mode-active .m-slide-card {
  outline: 2px solid transparent;
  transition: outline-color 0.2s var(--ease);
  cursor: default;
}

/* Suppress click-to-fullscreen press animation while editing — click on card
   should feel inert; only clicks on text inside iframe have meaning. */
body.edit-mode-active .m-slide-card:active {
  transform: none;
  box-shadow: var(--m-card-shadow);
}

body.edit-mode-active .m-slide-card.is-editing {
  outline-color: var(--accent);
}

/* Iframe pointer events — enabled ONLY during edit mode. Default is none (mobile-app.js).
   We set via inline style per-iframe from JS to avoid breaking fullscreen/other contexts. */

/* ─── Mobile banner for iPhones (Phase 1 disabled) ─── */

.m-edit-mobile-banner {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--m-toolbar-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  box-shadow: var(--m-toolbar-shadow);
  z-index: 200;
  animation: fadeInUp 0.25s var(--ease);
  pointer-events: none;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── Outline в iframe (leaf-highlight) — инжектится как <style> в iframeDoc ─── */
/* Этот селектор НЕ применяется к parent-документу — для справки только:
   [data-edit-id] { outline: 1px dashed rgba(100,180,255,0.45); }
   [data-edit-id]:hover { outline-color: var(--accent); }
   [data-edit-id][contenteditable="true"]:focus { outline: 2px solid var(--accent); cursor: text; }
*/

/* ─── Hide edit button/counter conflicts at narrow widths ─── */

@media (max-width: 480px) {
  .m-toolbar-btn.m-edit-action {
    min-width: 36px;
    width: 36px;
  }
  .m-edit-indicator {
    font-size: 10px;
    padding: 2px 8px;
  }
}
