/* save-ui.css — Save button, draft indicator, restore banner, scratch restore, mic guide banner */
/* ============================================================
   EDITOR ADDITIONS — Save button, draft indicator, restore banner
   Added by Agent 3 for scratch mode + explicit save feature
   ============================================================ */

/* ── Save button (now in .left-controls, uses .control-btn base) ── */
.doc-save-btn {
  position: relative;
  margin-right: 4px;
  margin-left: -8px !important;
  padding: 8px !important;
  color: rgb(143, 142, 138) !important;
}
.doc-save-btn svg {
  width: 14px !important;
  height: 14px !important;
}
.doc-save-btn:hover {
  color: rgb(19, 19, 19) !important;
}

/* Subtle separator between save and input icons */
.doc-save-btn::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}

/* Override writing-mode.css spotlight: left-controls must ALWAYS be clickable
   — STT, paste, upload are how users START writing */
.grammar-page.editor-empty .top-controls {
  pointer-events: auto !important;
  opacity: 1 !important;
}

.grammar-page.editor-empty .top-controls .left-controls {
  pointer-events: auto !important;
  opacity: 1 !important;
}

/* ── Mic permission guide banner ── */
.mic-guide-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 0;
  background: var(--color-card, #fff);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  font-family: 'Nunito Sans', sans-serif;
  animation: micGuideSlideIn 0.3s ease;
  transition: opacity 0.2s ease;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 500px;
  width: calc(100% - 32px);
}

@keyframes micGuideSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.mic-guide-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  color: rgb(60, 60, 58);
}

.mic-guide-text {
  flex: 1;
  min-width: 0;
}

.mic-guide-title {
  font-size: 14px;
  font-weight: 600;
  color: rgb(19, 19, 19);
  margin-bottom: 3px;
}

.mic-guide-desc {
  font-size: 13px;
  color: rgb(60, 60, 58);
  line-height: 1.45;
}

.mic-guide-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: rgb(60, 60, 58);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.mic-guide-close:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Dark mode */
[data-theme="dark"] .mic-guide-banner,
.dark-mode .mic-guide-banner {
  background: var(--color-card, #2b2c40);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .mic-guide-title,
.dark-mode .mic-guide-title {
  color: #cfd3ec;
}

[data-theme="dark"] .mic-guide-desc,
.dark-mode .mic-guide-desc {
  color: #a1a4b5;
}

[data-theme="dark"] .mic-guide-close,
.dark-mode .mic-guide-close {
  color: #a1a4b5;
}

/* ═══════════════════════════════════════════════════════════
   SCRATCH RESTORE TOAST — Bottom snackbar, auto-dismisses
   ═══════════════════════════════════════════════════════════ */

.scratch-restore-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #2b333b;
  color: #f0f0f0;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  font-family: var(--font-family, 'Nunito Sans', sans-serif);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.scratch-restore-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.scratch-restore-undo {
  border: none;
  background: transparent;
  color: #93b4ff;
  font-size: 13px;
  font-weight: 650;
  font-family: var(--font-family, 'Nunito Sans', sans-serif);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.scratch-restore-undo:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ── Dark mode ── */
[data-theme="dark"] .scratch-restore-toast {
  background: #3b3e56;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ── Dark mode: save button ── */
[data-theme="dark"] .doc-save-btn {
  color: var(--color-text-tertiary, #64748b);
}

[data-theme="dark"] .doc-save-btn:hover {
  color: var(--color-primary, #696cff);
}

/* ── Mobile ── */
@media (max-width: 767px) {
  .doc-save-btn {
    min-height: 36px;
    min-width: 36px;
    padding: 6px;
  }

  .scratch-restore-toast {
    bottom: 16px;
    max-width: calc(100% - 32px);
    font-size: 12px;
  }
}

/* prefers-color-scheme fallback removed — theme controlled by [data-theme] only */
