/* css/styles.css */

body {
  margin: 0;
  font-family: sans-serif;
  background: #f2f2f2;
  color: #222;
}

.container {
  max-width: 600px;
  margin: 40px auto;
  background: rgba(255, 255, 255, 0.85);
  padding: 20px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

h1, h2 {
  text-align: center;
  color: #111;
}

.prompt-section,
.entry-section,
.past-entries {
  margin-bottom: 30px;
}

.prompt-text {
  font-style: italic;
  font-size: 1.2em;
  margin: 10px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

textarea#journalEntry {
  width: 100%;
  height: 150px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  resize: vertical;
  background: rgba(255, 255, 255, 0.95);
}

button {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  margin-top: 10px;
}

button:hover {
  background: rgba(0, 0, 0, 0.8);
}

ul#entryList {
  list-style-type: none;
  padding-left: 0;
}

ul#entryList li {
  background: rgba(0, 0, 0, 0.05);
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95em;
}

.button-link {
  background: rgba(0, 0, 0, 0.4);
  color: white;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: pointer;
}

.button-link:hover {
  background: rgba(0, 0, 0, 0.6);
}

#charCount {
  font-size: 0.85em;
  text-align: right;
  margin-top: 4px;
  color: rgba(0, 0, 0, 0.6);
}

.entry-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}


.entry-summary {
  word-break: break-word;
}

.button-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 100%;              /* ✅ Make it full width */
  box-sizing: border-box;   /* ✅ Ensure padding/margins don’t affect width */
}

.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6); /* Darker translucent background */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}

.modalBox {
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 1rem;
  border-radius: 8px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
  font-size: 1rem;
}

.modalOverlay.hidden {
  display: none;
}





.close-button {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5em;
  background: transparent;
  border: none;
  color: white; /* White close icon */
  cursor: pointer;
}


#modalPrompt {
  font-weight: bold;
  font-size: 1.1em;
  margin-bottom: 1em;
  color: #ccc;
  white-space: pre-wrap;
}

#modalResponse {
  white-space: pre-wrap;
  line-height: 1.6;
}

#allEntriesList {
  text-align: left;
  padding-left: 1.2em;
  margin-top: 1em;

  /* Remove scroll behavior */
  max-height: none;
  overflow-y: visible;
}


.modal-link {
  display: inline-block;
  margin-top: 1em;
  font-size: 0.95em;
  color: black;
  text-decoration: underline;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.modal-link:hover,
.modal-link:focus {
  opacity: 0.8;
}

#welcomeModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

#welcomeModal.hidden {
  display: none;
}

#welcomeModal .modalBox {
  background: #111;
  color: white;
  padding: 2em 3em;
  border-radius: 8px;
  max-width: 600px;
  text-align: left;
  line-height: 1.6;
}

#welcomeModal h2,
#welcomeModal h3 {
  margin-top: 0;
}

#welcomeModal ul {
  padding-left: 1.2em;
  margin-top: 0.5em;
}

#welcomeModal button {
  margin-top: 1.5em;
  padding: 10px 20px;
  background: white;
  color: black;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
}

.prompt-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prompt-text {
  flex: 1;
  font-size: 1.1rem;
}

.refresh-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  margin: 0;
  line-height: 1;
  color: #555;
}

.refresh-button:hover {
  color: #007acc;
}

#relevantEntriesList {
  text-align: left;
  padding-left: 1.2em;
  margin-top: 1em;
  max-height: none;
  overflow: visible;
}


#followUpEntrySection {
  margin-top: 2em;
}

#followUpEntry {
  width: 100%;
  height: 100px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  resize: vertical;
  background: rgba(255, 255, 255, 0.95);
}

#followUpCharCount {
  font-size: 0.85em;
  text-align: right;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.6);
}

#relevanceFilterOptions {
  margin: 1em 0;
  font-size: 0.85em;
  color: #ccc;
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* ✅ Center the row */
  gap: 1.2em;              /* ✅ Even spacing */
  text-align: center;
}

#relevanceFilterOptions label {
  white-space: nowrap;     /* ✅ Prevent label wrapping */
  display: flex;
  align-items: center;
}

#relevanceFilterOptions input[type="radio"] {
  margin-right: 0.4em;
}


.modalBox h2 {
  color: white;
}

#entrySearchSection {
  margin-bottom: 1em;
  font-size: 0.9em;
}

#entrySearchInput {
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  margin-bottom: 0.5em;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 1em;
}

#entrySearchMode {
  display: flex;
  gap: 1em;
  justify-content: center;
  margin-bottom: 1em;
}

#entrySearchMode label {
  white-space: nowrap;
}

#entrySearchButton {
  display: block;
  margin: 0.5em auto 1em;
  padding: 8px 16px;
  font-size: 1em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  cursor: pointer;
}

#entrySearchButton:hover {
  background: rgba(0, 0, 0, 0.85);
}

#entrySearchButton,
#clearSearchButton {
  display: block;
  margin: 1em auto;
  padding: 10px 20px;
  font-size: 1em;
  font-weight: bold;
  background: #666666;  /* Medium gray */
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease;
}

#entrySearchButton:hover {
  background: #444444;  /* Darker gray on hover */
}

.secondary-button {
  background-color: #ddd;
  color: #333;
  border: 1px solid #ccc;
  padding: 0.5em 1em;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.secondary-button:hover {
  background-color: #ccc;
}

#entryModal {
  z-index: 2000; /* Make sure it's higher than any other modal */
}

#entryModal .modalBox {
  background-color: #fff;       /* white background */
  color: #111;                  /* dark text */
  border: 1px solid #ccc;
}

#entryModal .modal-prompt {
  color: #555;                  /* slightly lighter for prompt */
  font-style: italic;
  margin-bottom: 1em;
}

#entryModal .modal-response {
  color: #111;                  /* main entry text */
  white-space: pre-wrap;
}

#allEntriesList,
#relevantEntriesList,
#entryList {
  list-style-type: none;
  padding-left: 0; /* Optional: aligns content flush with edge */
  margin: 0;
}

.search-button-row {
  display: flex;
  gap: 0.5em;
  margin-top: 0.5em;
}

.search-button-row {
  display: flex;
  gap: 0.5em;
  margin-top: 0.5em;
}

.search-button-row button {
  flex: 1 1 0;
  min-width: 0; /* prevents overflow */
}

#relevantEntriesModal {
  overflow: hidden; /* Prevent overlay from scrolling */
}

#relevantEntriesModal .modalBox {
  max-height: 80vh;
  overflow-y: auto;
}

#relevantEntriesModal {
  overflow: hidden; /* Prevent modal overlay scroll */
}


.related-entry-preview {
  margin-bottom: 0.75em;
}
.related-entry-preview strong {
  color: #333;
}

.related-entries.hidden {
  display: none;
}

.modal-date {
  font-weight: bold;
  font-size: 1em;
  margin: 0;
  color: #333;
}

.modal-prompt {
  font-style: italic;
  color: #555;
  margin: 0.25em 0 0 0;  /* just a little space after date */
}

.modal-response {
  font-style: normal;
  color: #111;
  white-space: pre-wrap;
  line-height: 1.5;
  margin: 0.5em 0 0 0;  /* slight gap after prompt */
}

.related-entries {
  margin-top: 1em;
  padding-top: 0.75em;
  border-top: 1px solid #ccc;
  font-size: 0.9em;
  color: #555;
}

.modalOverlay {
  align-items: flex-start;
  padding-top: 2vh;
  padding-bottom: 2vh;
}


.modalBox {
  width: 100%;
  max-width: 600px;
}



.modalOverlay .entry-modal-box {
  background-color: #fff;
  color: #111;
  border: 1px solid #ccc;
}


.modal-date,
.modal-prompt,
.modal-response {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}


.modalBox.entry-modal-box {
  background-color: #fff;
  color: #111;
  border: 1px solid #ccc;
}

.modalBox .related-entries {
  margin-top: 1em;
  padding-top: 0.75em;
  border-top: 1px solid #ccc;
  font-size: 0.9em;
  color: #555;
}

.related-entry-preview {
  margin-bottom: 0.75em;
}



/* Collapse newlines to spaces only in the ORIGINAL entry modal */
#entryModal .modal-response { white-space: normal; }




.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* inline link look */
.relevant-entry-preview .read-more-link {
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9em;
}

/* nice keyboard focus */
.relevant-entry-preview .read-more-link:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Inline "… read more" link styling */
.relevant-entry-preview a.read-more-link,
#modal-root .relevant-entry-preview a.read-more-link {
  color: #6b7280;            /* gray-500-ish */
  text-decoration: underline;
}

.relevant-entry-preview a.read-more-link:hover,
.relevant-entry-preview a.read-more-link:focus,
#modal-root .relevant-entry-preview a.read-more-link:hover,
#modal-root .relevant-entry-preview a.read-more-link:focus {
  color: #374151;            /* darker on hover/focus for contrast */
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.relevant-entry-preview a.read-more-link:visited,
#modal-root .relevant-entry-preview a.read-more-link:visited {
  color: #6b7280;            /* keep visited state gray, not purple */
}

/* Inline "… read more" link: gray, no underline */
.relevant-entry-preview a.read-more-link,
#modal-root .relevant-entry-preview a.read-more-link {
  color: #6b7280;
  text-decoration: none;
  cursor: pointer;
}

/* Hover/focus: darker gray, still no underline; keep focus ring for a11y */
.relevant-entry-preview a.read-more-link:hover,
.relevant-entry-preview a.read-more-link:focus,
#modal-root .relevant-entry-preview a.read-more-link:hover,
#modal-root .relevant-entry-preview a.read-more-link:focus {
  color: #374151;
  text-decoration: none;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Visited stays gray, not purple */
.relevant-entry-preview a.read-more-link:visited,
#modal-root .relevant-entry-preview a.read-more-link:visited {
  color: #6b7280;
  text-decoration: none;
}

/* Gray, no-underline "… read more" links in ALL related-entry contexts */
.related-entries a.read-more-link,
.relevant-entry-preview a.read-more-link,
#modal-root .related-entries a.read-more-link,
#modal-root .relevant-entry-preview a.read-more-link {
  color: #6b7280;         /* gray */
  text-decoration: none;
  cursor: pointer;
}

.related-entries a.read-more-link:hover,
.related-entries a.read-more-link:focus,
.relevant-entry-preview a.read-more-link:hover,
.relevant-entry-preview a.read-more-link:focus,
#modal-root .related-entries a.read-more-link:hover,
#modal-root .related-entries a.read-more-link:focus,
#modal-root .relevant-entry-preview a.read-more-link:hover,
#modal-root .relevant-entry-preview a.read-more-link:focus {
  color: #374151;         /* darker on hover/focus */
  text-decoration: none;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.related-entries a.read-more-link:visited,
.relevant-entry-preview a.read-more-link:visited,
#modal-root .related-entries a.read-more-link:visited,
#modal-root .relevant-entry-preview a.read-more-link:visited {
  color: #6b7280;         /* keep visited gray */
  text-decoration: none;
}

/* Light gray, no-underline for read-more links in the Past Entries/Search modal */
#allEntriesList a.read-more-link,
#allEntriesModal a.read-more-link {
  color: #9CA3AF;          /* light gray */
  text-decoration: none;
  cursor: pointer;
}

#allEntriesList a.read-more-link:hover,
#allEntriesList a.read-more-link:focus,
#allEntriesModal a.read-more-link:hover,
#allEntriesModal a.read-more-link:focus {
  color: #6B7280;          /* a bit darker on hover/focus */
  text-decoration: none;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

#allEntriesList a.read-more-link:visited,
#allEntriesModal a.read-more-link:visited {
  color: #9CA3AF;          /* keep visited state light gray */
  text-decoration: none;
}

/* Keep modal layout tidy */
#relevantEntriesModal .modalBox {
  box-sizing: border-box;
}

/* Make the follow-up composer fit the frame exactly */
#relevantEntriesModal #followUpEntry {
  box-sizing: border-box;   /* include padding + border in the width */
  width: 100%;
  max-width: 100%;
  display: block;
  margin: 0;                /* avoid default margins causing overflow */
  /* optional niceties */
  resize: vertical;
}

/* If your submit row sits beside it, ensure it doesn't push width */
#relevantEntriesModal .follow-up-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Guard against long unbroken text pushing the modal wider */
#relevantEntriesModal .modal-response,
#relevantEntriesModal .related-entry-preview {
  overflow-wrap: anywhere;
  word-break: break-word;
}

