/* ============================================================
   FEATURES.CSS
   Search · Bookmarks · History · Dark Mode · Toast
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   VERSE OF THE DAY (loading screen)
   ════════════════════════════════════════════════════════════ */
.loading-votd {
  margin-top: 28px;
  max-width: 340px;
  text-align: center;
  animation: fadeIn 0.8s ease 1.2s both;
}
.votd-label {
  font-family: var(--font-sc);
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.votd-ref {
  font-family: var(--font-sc);
  font-size: 0.72rem;
  color: var(--gold-light);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.votd-text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.75;
  color: rgba(212,176,150,0.75);
}
@keyframes fadeIn { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:none } }

/* ════════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ════════════════════════════════════════════════════════════ */
.install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, #1e1206, #2a1a08);
  border-top: 2px solid var(--gold);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 998;
  font-family: var(--font-sc);
  font-size: 0.75rem;
  color: var(--parchment-aged);
  letter-spacing: 0.1em;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.install-banner.show { transform: translateY(0); }

/* ════════════════════════════════════════════════════════════
   HEADER ACTIONS
   ════════════════════════════════════════════════════════════ */
.header-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}
.header-actions .btn-icon {
  font-size: 0.95rem;
  width: 32px; height: 32px;
}

@media (max-width: 480px) {
  .header-actions .btn-icon { width: 28px; height: 28px; font-size: 0.85rem; }
  .header-actions { gap: 3px; }
}

/* ════════════════════════════════════════════════════════════
   SEARCH MODAL
   ════════════════════════════════════════════════════════════ */
.search-box {
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.search-input-row {
  padding: 14px 20px 10px;
  border-bottom: 1px solid rgba(139,105,30,0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#search-input {
  width: 100%;
  background: rgba(255,255,255,0.5);
  border: 2px solid var(--border-color);
  color: var(--ink);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: var(--gold); }

.search-filters {
  display: flex;
  gap: 12px;
}
.search-filter-btn {
  font-family: var(--font-sc);
  font-size: 0.72rem;
  color: var(--ink-fade);
  letter-spacing: 0.1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.search-filter-btn input { accent-color: var(--gold); }

.search-status {
  padding: 8px 20px 4px;
  font-family: var(--font-sc);
  font-size: 0.72rem;
  color: var(--gold-light);
  letter-spacing: 0.1em;
  min-height: 24px;
}

.search-results-list {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0,0,0,0.1);
  max-height: 60vh;
}

.search-result-item {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(139,105,30,0.12);
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover { background: rgba(184,134,11,0.08); }

.result-ref {
  font-family: var(--font-sc);
  font-size: 0.68rem;
  color: var(--red-letter);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.result-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--ink);
}
.result-text mark {
  background: rgba(184,134,11,0.3);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 2px;
  font-style: inherit;
}

.search-empty {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-sc);
  color: var(--ink-light);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  opacity: 0.65;
  line-height: 2;
}

/* ════════════════════════════════════════════════════════════
   BOOKMARKS MODAL
   ════════════════════════════════════════════════════════════ */
.bookmarks-box {
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.bookmarks-list {
  overflow-y: auto;
  flex: 1;
  max-height: 70vh;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0,0,0,0.1);
  padding: 8px 0;
}

.bm-item {
  padding: 14px 22px;
  border-bottom: 1px solid rgba(139,105,30,0.15);
  transition: background 0.15s;
}
.bm-item:hover { background: rgba(184,134,11,0.06); }

.bm-ref {
  font-family: var(--font-sc);
  font-size: 0.75rem;
  color: var(--red-letter);
  letter-spacing: 0.12em;
  margin-bottom: 5px;
}
.bm-text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 8px;
}
.bm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bm-date {
  font-family: var(--font-sc);
  font-size: 0.62rem;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  opacity: 0.7;
}
.bm-goto {
  background: rgba(184,134,11,0.12);
  border: 1px solid rgba(184,134,11,0.35);
  color: var(--ink-fade);
  padding: 4px 10px;
  font-family: var(--font-sc);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-goto:hover { background: var(--gold); color: var(--ink); }
.bm-del {
  background: none;
  border: 1px solid rgba(139,26,26,0.3);
  color: var(--red-letter);
  width: 24px; height: 24px;
  border-radius: 3px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-del:hover { background: var(--red-letter); color: var(--parchment); }

.bm-empty {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-sc);
  color: var(--ink-light);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  opacity: 0.65;
  line-height: 2;
}

/* ════════════════════════════════════════════════════════════
   HISTORY MODAL
   ════════════════════════════════════════════════════════════ */
.history-box {
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.history-list {
  overflow-y: auto;
  flex: 1;
  max-height: 65vh;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0,0,0,0.1);
  padding: 6px 0;
}

.hist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 22px;
  border-bottom: 1px solid rgba(139,105,30,0.12);
  cursor: pointer;
  transition: background 0.15s;
}
.hist-item:hover { background: rgba(184,134,11,0.08); }

.hist-ref {
  font-family: var(--font-sc);
  font-size: 0.78rem;
  color: var(--ink);
  letter-spacing: 0.08em;
}
.hist-date {
  font-family: var(--font-sc);
  font-size: 0.62rem;
  color: var(--ink-light);
  letter-spacing: 0.06em;
  opacity: 0.65;
}

/* ════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ════════════════════════════════════════════════════════════ */
.app-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--leather);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  padding: 8px 22px;
  font-family: var(--font-sc);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  white-space: nowrap;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════════════
   DARK / NIGHT MODE
   ════════════════════════════════════════════════════════════ */
:root.dark-mode {
  --parchment:       #1a1208;
  --parchment-dark:  #120d05;
  --parchment-aged:  #2a1e0a;
  --ink:             #e8d5a8;
  --ink-fade:        #c4a870;
  --ink-light:       #8a7050;
  --red-letter:      #d4726a;
  --gold:            #c8960c;
  --gold-light:      #e0aa18;
  --gold-shine:      #f0c840;
  --border-color:    #6b5010;
}

:root.dark-mode body {
  background: #0a0603;
}

:root.dark-mode .page {
  background: radial-gradient(ellipse at center, #1e160a 0%, #120d05 100%);
  border-color: #3a2a10;
}

:root.dark-mode .page::after {
  background-image: repeating-linear-gradient(
    transparent, transparent 27px,
    rgba(80,50,20,0.12) 27px, rgba(80,50,20,0.12) 28px
  );
}

:root.dark-mode .modal-box {
  background: #1a1208;
  background-image: radial-gradient(ellipse at center, #1e160a 0%, #120d05 100%);
  border-color: var(--border-color);
}

:root.dark-mode #search-input,
:root.dark-mode .comment-form input,
:root.dark-mode .comment-form textarea {
  background: rgba(0,0,0,0.3);
  color: var(--ink);
  border-color: var(--border-color);
}

:root.dark-mode .comment-form input::placeholder,
:root.dark-mode .comment-form textarea::placeholder {
  color: rgba(200,160,60,0.35);
}

:root.dark-mode .sidebar {
  background: linear-gradient(180deg, #0e0a04 0%, #080603 100%);
}

:root.dark-mode .crossref-banner {
  background: linear-gradient(135deg, rgba(200,150,12,0.1), rgba(100,70,20,0.08));
  border-color: rgba(200,150,12,0.3);
}

:root.dark-mode .result-text mark {
  background: rgba(200,150,12,0.25);
  color: var(--ink);
}

:root.dark-mode .loading-shimmer {
  background: linear-gradient(
    90deg,
    rgba(80,50,20,0.15) 25%,
    rgba(80,50,20,0.28) 50%,
    rgba(80,50,20,0.15) 75%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 1.4s infinite;
}

:root.dark-mode .bm-item:hover,
:root.dark-mode .hist-item:hover,
:root.dark-mode .search-result-item:hover {
  background: rgba(200,150,12,0.07);
}

/* Smooth transition when switching modes */
body, .page, .modal-box, .sidebar, .app-header {
  transition: background 0.4s ease, background-color 0.4s ease, color 0.2s ease;
}

/* ════════════════════════════════════════════════════════════
   SEARCH MODAL
   ════════════════════════════════════════════════════════════ */
.search-box {
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.search-input-row {
  padding: 14px 20px 10px;
  border-bottom: 1px solid rgba(139,105,30,0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#search-input {
  width: 100%;
  background: rgba(255,255,255,0.5);
  border: 2px solid var(--border-color);
  color: var(--ink);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: var(--gold); }

.search-filters {
  display: flex;
  gap: 12px;
}
.search-filter-btn {
  font-family: var(--font-sc);
  font-size: 0.72rem;
  color: var(--ink-fade);
  letter-spacing: 0.1em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.search-filter-btn input { accent-color: var(--gold); }

.search-status {
  padding: 8px 20px 4px;
  font-family: var(--font-sc);
  font-size: 0.72rem;
  color: var(--gold-light);
  letter-spacing: 0.1em;
  min-height: 24px;
}

.search-results-list {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0,0,0,0.1);
  max-height: 60vh;
}

.search-result-item {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(139,105,30,0.12);
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover { background: rgba(184,134,11,0.08); }

.result-ref {
  font-family: var(--font-sc);
  font-size: 0.68rem;
  color: var(--red-letter);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.result-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--ink);
}
.result-text mark {
  background: rgba(184,134,11,0.3);
  color: var(--ink);
  border-radius: 2px;
  padding: 0 2px;
  font-style: inherit;
}

.search-empty {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-sc);
  color: var(--ink-light);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  opacity: 0.65;
  line-height: 2;
}

/* ════════════════════════════════════════════════════════════
   BOOKMARKS MODAL
   ════════════════════════════════════════════════════════════ */
.bookmarks-box {
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.bookmarks-list {
  overflow-y: auto;
  flex: 1;
  max-height: 70vh;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0,0,0,0.1);
  padding: 8px 0;
}

.bm-item {
  padding: 14px 22px;
  border-bottom: 1px solid rgba(139,105,30,0.15);
  transition: background 0.15s;
}
.bm-item:hover { background: rgba(184,134,11,0.06); }

.bm-ref {
  font-family: var(--font-sc);
  font-size: 0.75rem;
  color: var(--red-letter);
  letter-spacing: 0.12em;
  margin-bottom: 5px;
}
.bm-text {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--ink);
  margin-bottom: 8px;
}
.bm-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bm-date {
  font-family: var(--font-sc);
  font-size: 0.62rem;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  opacity: 0.7;
}
.bm-goto {
  background: rgba(184,134,11,0.12);
  border: 1px solid rgba(184,134,11,0.35);
  color: var(--ink-fade);
  padding: 4px 10px;
  font-family: var(--font-sc);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-goto:hover { background: var(--gold); color: var(--ink); }
.bm-del {
  background: none;
  border: 1px solid rgba(139,26,26,0.3);
  color: var(--red-letter);
  width: 24px; height: 24px;
  border-radius: 3px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-del:hover { background: var(--red-letter); color: var(--parchment); }

.bm-empty {
  text-align: center;
  padding: 40px 20px;
  font-family: var(--font-sc);
  color: var(--ink-light);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  opacity: 0.65;
  line-height: 2;
}

/* ════════════════════════════════════════════════════════════
   HISTORY MODAL
   ════════════════════════════════════════════════════════════ */
.history-box {
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.history-list {
  overflow-y: auto;
  flex: 1;
  max-height: 65vh;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0,0,0,0.1);
  padding: 6px 0;
}

.hist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 22px;
  border-bottom: 1px solid rgba(139,105,30,0.12);
  cursor: pointer;
  transition: background 0.15s;
}
.hist-item:hover { background: rgba(184,134,11,0.08); }

.hist-ref {
  font-family: var(--font-sc);
  font-size: 0.78rem;
  color: var(--ink);
  letter-spacing: 0.08em;
}
.hist-date {
  font-family: var(--font-sc);
  font-size: 0.62rem;
  color: var(--ink-light);
  letter-spacing: 0.06em;
  opacity: 0.65;
}

/* ════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ════════════════════════════════════════════════════════════ */
.app-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--leather);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  padding: 8px 22px;
  font-family: var(--font-sc);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  white-space: nowrap;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════════════
   DARK / NIGHT MODE
   ════════════════════════════════════════════════════════════ */
:root.dark-mode {
  --parchment:       #1a1208;
  --parchment-dark:  #120d05;
  --parchment-aged:  #2a1e0a;
  --ink:             #e8d5a8;
  --ink-fade:        #c4a870;
  --ink-light:       #8a7050;
  --red-letter:      #d4726a;
  --gold:            #c8960c;
  --gold-light:      #e0aa18;
  --gold-shine:      #f0c840;
  --border-color:    #6b5010;
}

:root.dark-mode body {
  background: #0a0603;
}

:root.dark-mode .page {
  background:
    radial-gradient(ellipse at center, #1e160a 0%, #120d05 100%);
  background-image:
    radial-gradient(circle at 8% 12%, rgba(80,50,20,0.15) 0%, transparent 25%),
    radial-gradient(circle at 92% 85%, rgba(80,50,20,0.12) 0%, transparent 20%),
    radial-gradient(ellipse at center, #1e160a 0%, #120d05 100%);
  border-color: #3a2a10;
}

:root.dark-mode .page::after {
  background-image: repeating-linear-gradient(
    transparent, transparent 27px,
    rgba(80,50,20,0.12) 27px, rgba(80,50,20,0.12) 28px
  );
}

:root.dark-mode .modal-box {
  background: #1a1208;
  background-image: radial-gradient(ellipse at center, #1e160a 0%, #120d05 100%);
  border-color: var(--border-color);
}

:root.dark-mode #search-input {
  background: rgba(0,0,0,0.3);
  color: var(--ink);
  border-color: var(--border-color);
}

:root.dark-mode .comment-form input,
:root.dark-mode .comment-form textarea {
  background: rgba(0,0,0,0.3);
  color: var(--ink);
  border-color: var(--border-color);
}

:root.dark-mode .comment-form input::placeholder,
:root.dark-mode .comment-form textarea::placeholder {
  color: rgba(200,160,60,0.35);
}

:root.dark-mode .sidebar {
  background: linear-gradient(180deg, #0e0a04 0%, #080603 100%);
}

:root.dark-mode .crossref-banner {
  background: linear-gradient(135deg, rgba(200,150,12,0.1), rgba(100,70,20,0.08));
  border-color: rgba(200,150,12,0.3);
}

:root.dark-mode .apoc-page-banner {
  background: rgba(100,26,26,0.12);
  border-color: rgba(100,26,26,0.3);
}

:root.dark-mode .verse-block:hover {
  background: rgba(200,150,12,0.08);
}

:root.dark-mode .result-text mark {
  background: rgba(200,150,12,0.25);
  color: var(--ink);
}

:root.dark-mode .loading-shimmer {
  background: linear-gradient(
    90deg,
    rgba(80,50,20,0.15) 25%,
    rgba(80,50,20,0.28) 50%,
    rgba(80,50,20,0.15) 75%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 1.4s infinite;
}

:root.dark-mode .bm-item:hover,
:root.dark-mode .hist-item:hover,
:root.dark-mode .search-result-item:hover {
  background: rgba(200,150,12,0.07);
}

/* Smooth transition when switching modes */
body, .page, .modal-box, .sidebar, .app-header {
  transition: background 0.4s ease, background-color 0.4s ease, color 0.2s ease;
}
