/* =========================================================
   ReadiFreeze — Admin / Blog editor UI
   ========================================================= */

/* ---- gear button (bottom-left) ---- */
.rf-gear {
  position: fixed; left: 18px; bottom: 18px; z-index: 80;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(18,22,29,0.66); border: 1px solid var(--line);
  color: var(--muted-2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; font-size: 19px; line-height: 1;
  transition: color .25s, border-color .25s, transform .4s var(--ease), background .25s;
}
.rf-gear:hover { color: var(--fg); border-color: rgba(94,158,255,0.5); transform: rotate(45deg); background: rgba(22,27,34,0.9); }
.rf-gear.active { color: var(--accent-2); border-color: var(--accent); }

/* ---- admin-only chrome (hidden until authenticated) ---- */
.admin-only { display: none !important; }
body.rf-admin .admin-only { display: inline-flex !important; }

.newpost-btn {
  align-self: flex-start; margin-top: 6px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  color: #04070d; background: var(--accent-2); border: none; border-radius: 99px;
  padding: 10px 18px; cursor: pointer; transition: transform .25s var(--ease), background .25s;
}
.newpost-btn:hover { transform: translateY(-2px); background: #c4ecff; }

/* ---- card admin controls ---- */
.log-card .card-tools { display: none; gap: 8px; margin-top: 14px; }
body.rf-admin .log-card.post .card-tools { display: flex; }
.card-tools button {
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600;
  border-radius: 8px; padding: 6px 12px; cursor: pointer; border: 1px solid var(--line);
  background: rgba(255,255,255,0.04); color: var(--muted); transition: all .2s;
}
.card-tools button:hover { color: var(--fg); border-color: rgba(255,255,255,0.25); }
.card-tools button.del:hover { color: #ff8d8d; border-color: rgba(255,141,141,0.5); }
.log-card.post { cursor: pointer; }
.log-card.post .read-more { margin-top: 14px; font-family: var(--font-body); font-size: 0.84rem; color: var(--accent-2); font-weight: 600; }

/* ---- overlays / modals ---- */
.rf-overlay {
  position: fixed; inset: 0; z-index: 95; padding: 24px;
  background: rgba(4,6,9,0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; animation: rf-fade .25s var(--ease);
}
.rf-overlay[hidden] { display: none; }
@keyframes rf-fade { from { opacity: 0; } to { opacity: 1; } }
.rf-modal {
  width: min(860px, 96vw); max-height: 90vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px clamp(20px, 4vw, 34px); box-shadow: 0 40px 90px rgba(0,0,0,0.6);
}
.rf-modal.sm { width: min(420px, 94vw); }
.rf-modal h3 { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 6px; }
.rf-modal .rf-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }
.rf-modal label { display: block; font-size: 0.8rem; color: var(--muted); margin: 16px 0 7px; font-weight: 600; letter-spacing: 0.02em; }
.rf-input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--fg); font-family: var(--font-body); font-size: 1rem; padding: 11px 14px;
}
.rf-input:focus { outline: none; border-color: var(--accent); }
.rf-row { display: flex; gap: 12px; flex-wrap: wrap; }
.rf-row .rf-input { flex: 1; min-width: 160px; }

.rf-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }
.rf-btn {
  font-family: var(--font-body); font-weight: 600; font-size: 0.92rem;
  border-radius: 99px; padding: 11px 22px; cursor: pointer; border: 1px solid transparent; transition: all .25s var(--ease);
}
.rf-btn.primary { background: var(--accent-2); color: #04070d; }
.rf-btn.primary:hover { transform: translateY(-2px); background: #c4ecff; }
.rf-btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.rf-btn.ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.3); }
.rf-menu-row { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.rf-menu-row .rf-btn { text-align: center; }

/* ---- rich-text toolbar ---- */
.rf-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; margin-top: 8px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px 10px 0 0; border-bottom: none;
}
.rf-toolbar .grp { display: flex; gap: 2px; padding: 0 4px; border-right: 1px solid var(--line-soft); }
.rf-toolbar .grp:last-child { border-right: none; }
.rf-toolbar button {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 7px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font-size: 0.9rem; font-family: var(--font-body); display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.rf-toolbar button:hover { background: rgba(255,255,255,0.08); color: var(--fg); }
.rf-toolbar button b { font-weight: 800; } .rf-toolbar button i { font-style: italic; } .rf-toolbar button u { text-decoration: underline; }
.rf-toolbar button .sm { font-size: 0.72rem; font-weight: 700; }

.rf-editor-body {
  min-height: 280px; max-height: 50vh; overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  padding: 18px 20px; color: var(--fg); font-family: var(--font-body); font-size: 1.02rem; line-height: 1.65;
}
.rf-editor-body:focus { outline: none; border-color: var(--accent); }
.rf-editor-body:empty::before { content: attr(data-ph); color: var(--muted-2); }

/* ---- shared rendered-content styling (editor + reader) ---- */
.rf-rich h1, .rf-editor-body h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; margin: 22px 0 10px; letter-spacing: -0.02em; }
.rf-rich h2, .rf-editor-body h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin: 20px 0 9px; letter-spacing: -0.02em; }
.rf-rich h3, .rf-editor-body h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin: 18px 0 8px; }
.rf-rich p, .rf-editor-body p { margin: 10px 0; }
.rf-rich ul, .rf-rich ol, .rf-editor-body ul, .rf-editor-body ol { margin: 10px 0; padding-left: 24px; }
.rf-rich li, .rf-editor-body li { margin: 5px 0; }
.rf-rich a, .rf-editor-body a { color: var(--accent-2); text-decoration: underline; }
.rf-rich img, .rf-editor-body img { max-width: 100%; height: auto; border-radius: 12px; margin: 14px 0; display: block; }
.rf-rich blockquote, .rf-editor-body blockquote {
  margin: 14px 0; padding: 6px 18px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic;
}
.rf-rich table, .rf-editor-body table { border-collapse: collapse; width: 100%; margin: 14px 0; }
.rf-rich td, .rf-rich th, .rf-editor-body td, .rf-editor-body th { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

/* ---- reader (full post) ---- */
.rf-article { width: min(760px, 96vw); }
.rf-article .meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-2); letter-spacing: 0.06em; margin-bottom: 8px; }
.rf-article h2.title { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -0.03em; margin-bottom: 22px; line-height: 1.05; }
.rf-article .rf-rich { font-size: 1.08rem; line-height: 1.7; color: #d8dee6; }

.rf-close { float: right; background: transparent; border: 1px solid var(--line); color: var(--muted); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; }
.rf-close:hover { color: var(--fg); border-color: rgba(255,255,255,0.3); }

.rf-toast {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--fg);
  padding: 11px 20px; border-radius: 99px; font-size: 0.9rem; z-index: 120; opacity: 0;
  transition: opacity .3s, transform .3s var(--ease); pointer-events: none;
}
.rf-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
