/* ──────────────────────────────────────────────────────────────────────────
   Book of Mirrors — Journal styles
   ────────────────────────────────────────────────────────────────────────── */

.journal-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 15, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Raleway', system-ui, sans-serif;
  color: #2a1f3d;
  animation: journalIn 0.22s ease-out;
}
.journal-modal.hide { display: none; }
@keyframes journalIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.journal-shell {
  background: linear-gradient(180deg, #fcf6ec 0%, #f1e6cc 100%);
  border: 1px solid #b89968;
  border-radius: 14px;
  width: min(960px, 100%);
  height: min(720px, 92vh);
  display: grid;
  grid-template-columns: 200px 1fr;
  position: relative;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  overflow: hidden;
}

.journal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
  color: #5b3e6e;
  cursor: pointer;
  z-index: 2;
  /* Keep above the horizontal nav bar on narrow viewports */
}
.journal-close:hover { color: #2a1f3d; }

@media (max-width: 700px) {
  .journal-close {
    top: 10px;
    right: 10px;
    font-size: 22px;
  }
}

.journal-sidebar {
  background: rgba(89, 60, 110, 0.12);
  border-right: 1px solid #cdb588;
  padding: 56px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journal-sidebar button {
  background: transparent;
  border: 0;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #4a3261;
  cursor: pointer;
  transition: background 120ms ease;
}
.journal-sidebar button:hover { background: rgba(89, 60, 110, 0.18); }
.journal-sidebar button.journal-side-active {
  background: #5b3e6e;
  color: #fbf3df;
}

.journal-main {
  padding: 28px 32px;
  overflow-y: auto;
  min-width: 0; /* prevent grid child from overflowing its column */
}

.journal-heading {
  font-family: 'Platypi', 'Raleway', serif;
  font-size: 28px;
  margin: 0 0 8px;
  color: #3a2752;
}
.journal-subheading {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 8px;
  color: #6a4f80;
}
.journal-lede {
  font-size: 14px;
  line-height: 1.5;
  color: #5a4670;
  margin: 0 0 20px;
}
.journal-empty {
  padding: 24px;
  text-align: center;
  color: #7a6685;
  font-style: italic;
  border: 1px dashed #c0a577;
  border-radius: 10px;
  margin: 12px 0;
}

.journal-btn {
  background: #efe1c3;
  border: 1px solid #b89968;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #3a2752;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.journal-btn:hover { background: #e3d2ad; }
.journal-btn:active { transform: translateY(1px); }
.journal-btn-primary {
  background: #5b3e6e;
  color: #fbf3df;
  border-color: #3f2a4d;
}
.journal-btn-primary:hover { background: #6e4d83; }
.journal-btn-danger {
  background: #b85450;
  color: #fff5e7;
  border-color: #7d3431;
}
.journal-btn-danger:hover { background: #c66662; }

.journal-link-btn {
  background: transparent;
  border: 0;
  color: #5b3e6e;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
.journal-link-btn:hover { text-decoration: underline; }

/* Home */
.journal-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.journal-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.journal-recent-item {
  padding: 10px 12px;
  border: 1px solid #d5bf90;
  background: rgba(255,255,255,0.4);
  border-radius: 8px;
  cursor: pointer;
}
.journal-recent-item:hover { background: rgba(255,255,255,0.7); }
.journal-recent-title { font-weight: 700; color: #2f1f44; }
.journal-recent-meta { font-size: 12px; color: #7a6685; margin-top: 2px; }
.journal-privacy-note {
  margin-top: 24px;
  font-size: 12px;
  color: #7a6685;
  font-style: italic;
}

/* Entries list */
.journal-entries-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.journal-search {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #b89968;
  border-radius: 8px;
  background: #fff8e8;
  font-size: 14px;
  margin-bottom: 12px;
}
.journal-entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.journal-entry-item {
  padding: 12px 14px;
  border: 1px solid #d5bf90;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
  cursor: pointer;
}
.journal-entry-item:hover { background: rgba(255,255,255,0.8); }
.journal-entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.journal-entry-title { font-weight: 700; color: #2f1f44; }
.journal-entry-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: #7a6685;
}
.journal-entry-date { color: #8a7995; }
.journal-tag {
  background: #e7d6b3;
  color: #4a3261;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.journal-tag-source { background: #cdb6df; }
.journal-entry-preview {
  font-size: 13px;
  color: #5a4670;
  margin-top: 6px;
  line-height: 1.4;
}

/* Editor */
.journal-editor { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.journal-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.journal-save-status {
  font-size: 12px;
  color: #7a6685;
  font-style: italic;
}
.journal-title-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid #b89968;
  border-radius: 8px;
  background: #fff8e8;
  color: #2a1f3d;
}
.journal-meta-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.journal-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6a4f80;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.journal-select {
  padding: 8px 10px;
  border: 1px solid #b89968;
  border-radius: 8px;
  background: #fff8e8;
  font-size: 14px;
  color: #2a1f3d;
}
.journal-meta-info {
  font-size: 12px;
  color: #7a6685;
  flex: 1;
  text-align: right;
  font-style: italic;
}
.journal-body {
  width: 100%;
  box-sizing: border-box;
  flex: 1;
  min-height: 240px;
  padding: 12px;
  border: 1px solid #b89968;
  border-radius: 8px;
  background: #fffcf2;
  font-family: 'Raleway', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #2a1f3d;
  resize: vertical;
}
.journal-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* Prompts */
.journal-prompt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.journal-prompt-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d5bf90;
  background: rgba(255,255,255,0.5);
  border-radius: 10px;
}
.journal-prompt-title {
  font-weight: 700;
  color: #2f1f44;
  margin-bottom: 6px;
}
.journal-prompt-questions {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #5a4670;
  line-height: 1.5;
}

/* ── Delete confirmation modal (journal) ── */
.journal-delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 15, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Raleway', system-ui, sans-serif;
  animation: journalIn 0.18s ease-out;
}
.journal-delete-overlay.hide { display: none; }
.journal-delete-modal {
  background: linear-gradient(180deg, #fcf6ec 0%, #f1e6cc 100%);
  border: 1px solid #b89968;
  border-radius: 12px;
  width: min(400px, 100%);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  color: #2a1f3d;
}
.journal-delete-title {
  font-family: 'Platypi', 'Raleway', serif;
  font-size: 18px;
  font-weight: 700;
  color: #3a2752;
  margin: 0 0 8px;
}
.journal-delete-msg {
  font-size: 14px;
  color: #5a4670;
  margin: 0 0 6px;
}
.journal-delete-sub {
  font-size: 12px;
  color: #8a7995;
  font-style: italic;
  margin: 0 0 20px;
}
.journal-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Save-from-item dialog */
.journal-from-item-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 15, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: 'Raleway', system-ui, sans-serif;
}
.journal-from-item-overlay.hide { display: none; }
.journal-from-item-modal {
  background: linear-gradient(180deg, #fcf6ec 0%, #f1e6cc 100%);
  border: 1px solid #b89968;
  border-radius: 12px;
  width: min(520px, 100%);
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  color: #2a1f3d;
}
.journal-from-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.journal-from-item-title {
  font-family: 'Platypi', 'Raleway', serif;
  font-size: 18px;
  font-weight: 700;
  color: #3a2752;
}
.journal-from-item-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: #5b3e6e;
  cursor: pointer;
}
.journal-from-item-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.journal-from-item-preview {
  min-height: 110px;
  background: #fffcf2;
  color: #2a1f3d;
}
.journal-from-item-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* Toast */
.journal-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 24px);
  background: #3a2752;
  color: #fbf3df;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 6100;
}
.journal-toast.journal-toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Save-to-Journal button inside the existing write modal */
.write-modal-btn-journal {
  background: #5b3e6e !important;
  color: #fbf3df !important;
  border-color: #3f2a4d !important;
}
.write-modal-btn-journal:hover { background: #6e4d83 !important; }

/* Mobile */
@media (max-width: 700px) {
  .journal-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100%;
    border-radius: 0;
  }
  .journal-sidebar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    padding: 8px;
    height: 52px;
    flex-shrink: 0;
    border-right: 0;
    border-bottom: 1px solid #cdb588;
  }
  .journal-sidebar button {
    white-space: nowrap;
    padding: 6px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }
  .journal-main { padding: 18px 16px; }
  .journal-modal { padding: 0; }
}
