/* Modal / Overlay Components */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay--active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  background-color: var(--paper-aged);
  padding: var(--space-xl);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay--active .modal {
  transform: scale(1);
}

.modal__header {
  margin-bottom: var(--space-lg);
}

.modal__title {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-lg);
  color: var(--ink-dark);
  margin: 0;
}

.modal__body {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  line-height: 1.8;
  color: var(--ink-dark);
  margin-bottom: var(--space-lg);
}

.modal__footer {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

/* Table of Contents Overlay */
.toc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  background-color: var(--paper-warm);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
  padding: var(--space-xl);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 1001;
  overflow-y: auto;
}

.toc-overlay--active {
  transform: translateX(0);
}

.toc-overlay__title {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-lg);
  color: var(--ink-dark);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--sepia-line);
  padding-bottom: var(--space-sm);
}

.toc-overlay__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-overlay__item {
  margin-bottom: var(--space-md);
}

.toc-overlay__link {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  color: var(--ink-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.toc-overlay__link:hover {
  border-bottom-color: var(--sepia-line);
}

.toc-overlay__link-text {
  flex: 1;
}

.toc-overlay__bookmark {
  width: 16px;
  height: 16px;
  margin-left: var(--space-sm);
  opacity: 0.8;
  flex-shrink: 0;
}

.toc-overlay__bookmark svg {
  width: 100%;
  height: 100%;
  stroke: var(--accent-sepia);
  fill: none;
  stroke-width: 2;
}

/* Encryption Modals */
.unlock-prompt,
.encryption-setup,
.share-modal,
.decrypt-memory-modal,
.reminder-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unlock-prompt.hidden,
.encryption-setup.hidden,
.decrypt-memory-modal.hidden,
.share-modal.hidden,
.reminder-modal.hidden {
  display: none;
}

.unlock-prompt__overlay,
.encryption-setup__overlay,
.share-modal__overlay,
.decrypt-memory-modal__overlay,
.reminder-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.unlock-prompt__modal,
.encryption-setup__modal,
.share-modal__modal,
.decrypt-memory-modal__modal,
.reminder-modal__modal {
  position: relative;
  background-color: var(--paper-aged);
  padding: var(--space-xl);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 500px;
  width: 90%;
  z-index: 2001;
}

.unlock-prompt__header,
.encryption-setup__header {
  margin-bottom: var(--space-lg);
  text-align: center;
}

.share-modal__header,
.decrypt-memory-modal__header,
.reminder-modal__header {
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.unlock-prompt__title,
.encryption-setup__title,
.share-modal__title,
.decrypt-memory-modal__title,
.reminder-modal__title {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-xl);
  color: var(--ink-dark);
  margin: 0 0 var(--space-sm) 0;
}

.unlock-prompt__description,
.encryption-setup__description,
.share-modal__description {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  color: var(--ink-medium);
  line-height: 1.6;
  margin: 0;
}

.share-modal__close,
.decrypt-memory-modal__close,
.reminder-modal__close {
  background: none;
  border: none;
  padding: var(--space-xs);
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.share-modal__close:hover,
.decrypt-memory-modal__close:hover,
.reminder-modal__close:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--ink-dark);
}

.share-modal__close svg,
.decrypt-memory-modal__close svg,
.reminder-modal__close svg {
  width: 20px;
  height: 20px;
}

.share-modal__body,
.decrypt-memory-modal__body,
.reminder-modal__body {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  line-height: 1.8;
  color: var(--ink-dark);
}

.share-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.share-url-container {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.share-url-input {
  flex: 1;
  padding: var(--space-md);
  font-size: var(--text-sm);
  font-family: monospace;
  background-color: var(--paper-warm);
  border: 1px solid var(--sepia-line);
  border-radius: 4px;
  color: var(--ink-dark);
}

.share-url-input:focus {
  outline: none;
  border-color: var(--accent-sepia);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.unlock-prompt__form,
.encryption-setup__form {
  margin-top: var(--space-lg);
}

.unlock-prompt__field,
.encryption-setup__field {
  margin-bottom: var(--space-lg);
}

.unlock-prompt__label,
.encryption-setup__label {
  display: block;
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  color: var(--ink-dark);
  margin-bottom: var(--space-sm);
}

.unlock-prompt__input,
.encryption-setup__input {
  width: 100%;
  padding: var(--space-md);
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  border: 1px solid var(--sepia-line);
  border-radius: 4px;
  background-color: var(--paper-warm);
  color: var(--ink-dark);
}

.unlock-prompt__input:focus,
.encryption-setup__input:focus {
  outline: none;
  border-color: var(--accent-sepia);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.encryption-setup__hint {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-sm);
  color: var(--ink-medium);
  margin-top: var(--space-sm);
  line-height: 1.5;
}

.unlock-prompt__error {
  background-color: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  padding: var(--space-md);
  border-radius: 4px;
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.unlock-prompt__error.hidden {
  display: none;
}

.unlock-prompt__actions,
.encryption-setup__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

/* Encrypted content placeholder */
.encrypted-placeholder {
  color: var(--ink-medium);
  font-style: italic;
  opacity: 0.7;
}

/* Reminder Modal Styles */
.reminder-modal__form {
  margin-top: var(--space-lg);
}

.reminder-modal__field {
  margin-bottom: var(--space-lg);
}

.reminder-modal__label {
  display: block;
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  color: var(--ink-dark);
  margin-bottom: var(--space-sm);
}

.reminder-modal__quick-actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.reminder-modal__quick-action {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--sepia-line);
  background-color: var(--paper-warm);
  color: var(--ink-dark);
  transition: all 0.2s ease;
}

.reminder-modal__quick-action:hover {
  background-color: rgba(139, 69, 19, 0.05);
  border-color: var(--accent-sepia);
}

.reminder-modal__quick-action--active {
  background-color: var(--accent-sepia);
  color: var(--paper-aged);
  border-color: var(--accent-sepia);
}

.reminder-modal__input {
  width: 100%;
  padding: var(--space-md);
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  border: 1px solid var(--sepia-line);
  border-radius: 4px;
  background-color: var(--paper-warm);
  color: var(--ink-dark);
}

.reminder-modal__input:focus {
  outline: none;
  border-color: var(--accent-sepia);
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.reminder-modal__hint {
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-sm);
  color: var(--ink-medium);
  margin-top: var(--space-sm);
  line-height: 1.5;
}

.reminder-modal__email-container {
  margin-bottom: var(--space-sm);
}

.reminder-modal__email-wrapper {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  align-items: center;
}

.reminder-modal__email-wrapper .reminder-modal__input {
  flex: 1;
}

.reminder-modal__email-wrapper .btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.reminder-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

.reminder-modal__existing {
  font-size: var(--text-sm);
}

.reminder-modal__existing-info {
  margin-top: var(--space-md);
}

.reminder-modal__existing-text {
  margin-bottom: var(--space-lg);
  color: var(--ink-dark);
  font-family: 'EB Garamond', 'Libre Baskerville', serif;
  font-size: var(--text-md);
  line-height: 1.6;
  padding: var(--space-md);
  background-color: var(--paper-warm);
  border: 1px solid var(--sepia-line);
  border-radius: 4px;
}

.reminder-modal__existing-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}
