/* ═══════════════════════════════════════════════════════════
   Pāla CMS — Editor & Auth styles
   ═══════════════════════════════════════════════════════════ */

/* ── Sign-in button (top nav) ───────────────────────────────────────────── */
.pala-login-btn {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 0.78em;
  font-weight: bold;
  letter-spacing: 0.4px;
  padding: 11px 18px;
  background: transparent;
  color: #444;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  box-sizing: border-box;
}
.pala-login-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}
.pala-login-btn--on {
  color: #1a6e3c;
}
.pala-login-btn--on:hover {
  background: rgba(26, 110, 60, 0.07);
}

/* ── Login Modal ────────────────────────────────────────────────────────── */
#pala-login-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99990;
}
.plm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.plm-box {
  position: relative;
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  padding: 38px 42px;
  margin: 0 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
  box-sizing: border-box;
  animation: plm-slide-in 0.22s ease;
}
@keyframes plm-slide-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
.plm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
.plm-logo {
  font-size: 0.88em;
  font-weight: bold;
  letter-spacing: 0.4px;
  color: #444;
}
.plm-close {
  background: none;
  border: none;
  font-size: 1em;
  cursor: pointer;
  color: #aaa;
  padding: 3px 7px;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.plm-close:hover { color: #333; background: #f0f0f0; }
.plm-title {
  font-size: 1.65em;
  font-weight: 800;
  margin: 0 0 8px;
  color: #111;
  letter-spacing: -0.3px;
}
.plm-sub {
  font-size: 0.87em;
  color: #888;
  margin: 0 0 28px;
  line-height: 1.5;
}
#plm-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.plm-label {
  font-size: 0.74em;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
}
.plm-input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid #ddd;
  border-radius: 5px;
  font-size: 0.95em;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.plm-input:focus {
  border-color: #333;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}
.plm-err {
  background: #fff2f2;
  border: 1px solid #f5b7b7;
  border-radius: 5px;
  color: #c0392b;
  font-size: 0.84em;
  padding: 9px 12px;
  margin-top: 6px;
  line-height: 1.4;
}
.plm-submit {
  margin-top: 18px;
  padding: 13px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s;
  font-family: inherit;
}
.plm-submit:hover   { background: #333; }
.plm-submit:disabled { background: #aaa; cursor: not-allowed; }

/* ── Edit buttons (shown above page content) ────────────────────────────── */
.pala-edit-wrap {
  padding: 12px 16px 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pala-edit-btn {
  background: transparent;
  border: 1.5px dashed #bbb;
  color: #999;
  padding: 6px 16px;
  font-size: 0.78em;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.3px;
  transition: all 0.15s;
  font-family: inherit;
}
.pala-edit-btn:hover {
  border-color: #333;
  border-style: solid;
  color: #333;
  background: rgba(0, 0, 0, 0.03);
}
.pala-edit-btn--secondary {
  border-color: #ccc;
  color: #aaa;
}
.pala-edit-btn--secondary:hover {
  border-color: #666;
  color: #555;
}

/* ── Editor shell ───────────────────────────────────────────────────────── */
.pala-editor-shell {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

/* Sticky toolbar bar */
.pala-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 200;
}
.pala-editor-label {
  font-size: 0.82em;
  color: #666;
  font-weight: 600;
}
.pala-editor-label em {
  color: #222;
  font-style: normal;
}
.pala-editor-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Editor action buttons */
.pala-eb {
  padding: 7px 13px;
  font-size: 0.8em;
  font-weight: 600;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.14s;
  background: #fff;
  color: #444;
  font-family: inherit;
  letter-spacing: 0.2px;
}
.pala-eb:hover { background: #eee; border-color: #999; }

.pala-eb--save {
  background: #111;
  color: #fff;
  border-color: #111;
}
.pala-eb--save:hover   { background: #333; border-color: #333; }
.pala-eb--save:disabled { background: #999; border-color: #999; cursor: not-allowed; }

.pala-eb--cancel:hover { background: #fff2f2; border-color: #f5b7b7; color: #c0392b; }

.pala-eb--src.pala-eb--on {
  background: #edf2ff;
  border-color: #8ba4e8;
  color: #2c4ea6;
}

/* ── Quill editor overrides ─────────────────────────────────────────────── */
#pala-quill-el .ql-toolbar.ql-snow {
  border: none;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
  padding: 8px 16px;
  font-family: inherit;
}
#pala-quill-el .ql-container.ql-snow {
  border: none;
  font-family: Arial, sans-serif;
  font-size: 1em;
}
#pala-quill-el .ql-editor {
  min-height: 55vh;
  padding: 24px 28px;
  line-height: 1.75;
  font-size: 0.96em;
  color: #1a1a1a;
}
#pala-quill-el .ql-editor p { margin-bottom: 0.8em; }

/* ── Source / raw HTML textarea ─────────────────────────────────────────── */
.pala-src-area {
  flex: 1;
  width: 100%;
  min-height: 60vh;
  padding: 18px 20px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82em;
  line-height: 1.55;
  border: none;
  border-top: 1px solid #ddd;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  background: #1e1e1e;
  color: #d4d4d4;
  tab-size: 2;
}
.pala-src-hint {
  padding: 9px 16px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 0.8em;
  color: #92400e;
  font-weight: 500;
}

/* ── Loading placeholder ─────────────────────────────────────────────────── */
.pala-editor-loading {
  padding: 60px 20px;
  text-align: center;
  color: #aaa;
  font-size: 0.9em;
  letter-spacing: 0.3px;
}

/* ── Toast notification ──────────────────────────────────────────────────── */
.pala-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #111;
  color: #fff;
  padding: 13px 22px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 0.3px;
  z-index: 999999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.pala-toast--in {
  opacity: 1;
  transform: translateY(0);
}

/* ── Word editor toolbar ─────────────────────────────────────────────────── */
.pala-word-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}
.pala-word-fmt-row {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 7px 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
}
.pala-word-bar .pala-editor-actions {
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}
.pala-tb {
  padding: 4px 9px;
  font-size: 0.8em;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  color: #333;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
  white-space: nowrap;
  line-height: 1.4;
}
.pala-tb:hover { background: #eee; border-color: #aaa; }
.pala-tb b, .pala-tb i, .pala-tb u, .pala-tb s { font-size: 1em; }
.pala-tb-sep {
  width: 1px;
  height: 20px;
  background: #d8d8d8;
  margin: 0 4px;
  display: inline-block;
  vertical-align: middle;
}
.pala-tb-select {
  padding: 4px 6px;
  font-size: 0.8em;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: inherit;
  outline: none;
}
.pala-tb-select:focus { border-color: #888; }

/* ── Word editor paper ───────────────────────────────────────────────────── */
.pala-word-paper {
  flex: 1;
  background: #e8e8e8;
  padding: 40px 20px;
  min-height: 70vh;
  overflow-y: auto;
}

/* Editable text zone — looks like a Word page */
.pala-word-zone {
  background: #fff;
  max-width: 740px;
  margin: 0 auto 4px;
  padding: 40px 56px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  outline: none;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1em;
  line-height: 1.8;
  color: #1a1a1a;
  min-height: 60px;
  box-sizing: border-box;
}
.pala-word-zone:focus {
  box-shadow: 0 1px 4px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08),
              0 0 0 2px rgba(59,130,246,0.25);
}
.pala-word-zone p  { margin: 0 0 0.9em; }
.pala-word-zone h1 { font-size: 2em;   margin: 0.6em 0 0.4em; }
.pala-word-zone h2 { font-size: 1.6em; margin: 0.6em 0 0.4em; }
.pala-word-zone h3 { font-size: 1.3em; margin: 0.6em 0 0.3em; }
.pala-word-zone h4 { font-size: 1.1em; margin: 0.5em 0 0.3em; }
.pala-word-zone ul, .pala-word-zone ol { margin: 0 0 0.9em; padding-left: 1.8em; }
.pala-word-zone blockquote {
  border-left: 3px solid #ccc;
  margin: 0.8em 0;
  padding: 0.4em 1em;
  color: #555;
  font-style: italic;
}
.pala-word-zone pre {
  background: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 0.88em;
  overflow-x: auto;
  margin: 0.8em 0;
}
.pala-word-zone a { color: #1a5fb4; }

/* Complex block placeholder */
.pala-word-placeholder {
  background: #f0f0f0;
  border: 2px dashed #ccc;
  border-radius: 4px;
  color: #888;
  font-size: 0.82em;
  padding: 14px 20px;
  max-width: 740px;
  margin: 6px auto;
  box-sizing: border-box;
  user-select: none;
  cursor: default;
}
.pala-word-placeholder em {
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* No-text hint */
.pala-word-no-text {
  text-align: center;
  color: #aaa;
  padding: 40px;
  font-size: 0.9em;
}

@media (max-width: 700px) {
  .pala-word-zone { padding: 24px 20px; }
  .pala-word-paper { padding: 16px 8px; }
}
