/* CLIEAIR Case Digest + Vault Search styles */

/* ----- Search ----- */
.ds-search-host {
  margin: 2rem auto 1rem;
  max-width: 56rem;
  padding: 1.1rem 1.25rem;
  background: rgba(13, 27, 42, 0.55);
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 12px;
}
.ds-search-host__head { margin-bottom: 0.65rem; }
.ds-search-host__title { margin: 0 0 0.2rem; font-size: 1.15rem; color: #f0e6d2; font-weight: 600; }
.ds-search-host__sub   { margin: 0; font-size: 0.85rem; color: #a9b6cb; font-style: italic; line-height: 1.5; }

.ds-search-host__input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: #0a1422;
  color: #f0e6d2;
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.ds-search-host__input:focus { border-color: #c9a227; box-shadow: 0 0 0 2px rgba(201,162,39,0.18); }

.ds-search-results { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.65rem; }
.ds-search__loading,
.ds-search__empty,
.ds-search__err { margin: 0; padding: 0.65rem 0.8rem; color: #a9b6cb; font-style: italic; font-size: 0.88rem; }
.ds-search__err  { color: #c9a227; }

.ds-search__card {
  background: #0d1b2a;
  border-radius: 8px;
  border-left: 3px solid #c9a227;
  padding: 0.7rem 0.9rem;
}
.ds-search__card-title { margin: 0 0 0.25rem; font-size: 0.92rem; color: #f0e6d2; font-weight: 600; }
.ds-search__card-excerpt { margin: 0 0 0.35rem; font-size: 0.86rem; line-height: 1.5; color: #d9d3c4; white-space: pre-wrap; }
.ds-search__card-meta { display: flex; gap: 0.5rem; align-items: center; font-size: 0.75rem; color: #8a9bb0; }
.ds-search__score { font-family: ui-monospace, monospace; }
.ds-search__open  { color: #c9a227; text-decoration: none; border-bottom: 1px dotted rgba(201,162,39,0.45); }

/* ----- Digest button ----- */
.ds-digest-bar {
  margin: 1.5rem auto;
  max-width: 56rem;
  padding: 1.1rem 1.25rem;
  background: rgba(13, 27, 42, 0.55);
  border: 1px solid rgba(201, 162, 39, 0.28);
  border-radius: 12px;
  text-align: center;
}
.ds-digest-bar__head { margin-bottom: 0.85rem; }
.ds-digest-bar__title { margin: 0 0 0.3rem; font-size: 1.2rem; color: #f0e6d2; font-weight: 600; }
.ds-digest-bar__sub   { margin: 0; font-size: 0.92rem; color: #a9b6cb; font-style: italic; line-height: 1.55; }
.ds-digest-bar__btn {
  display: inline-block;
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(180deg, #c9a227 0%, #a9871f 100%);
  color: #0d1b2a;
  border: 0;
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.ds-digest-bar__btn:hover { filter: brightness(1.06); }
.ds-digest-bar__btn:focus { outline: 2px solid #f0e6d2; outline-offset: 2px; }

/* ----- Modal ----- */
body.ds-modal-open { overflow: hidden; }

.ds-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9990;
}

.ds-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(54rem, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #0d1b2a;
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  z-index: 9999;
  overflow: hidden;
}

.ds-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(201,162,39,0.2);
}
.ds-modal__title { margin: 0; font-size: 1.05rem; color: #f0e6d2; }
.ds-modal__close {
  background: transparent;
  color: #c9a227;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.3rem;
}
.ds-modal__close:focus { outline: 2px solid #c9a227; }

.ds-modal__body {
  padding: 1rem 1.1rem 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ds-busy { text-align: center; padding: 2rem 1rem; }
.ds-busy__spinner {
  width: 36px; height: 36px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 3px solid rgba(201, 162, 39, 0.22);
  border-top-color: #c9a227;
  animation: ds-spin 1.1s linear infinite;
}
.ds-busy__msg { margin: 0 0 0.4rem; color: #f0e6d2; font-weight: 600; }
.ds-busy__sub { margin: 0; color: #a9b6cb; font-style: italic; font-size: 0.9rem; line-height: 1.5; }

@keyframes ds-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ds-busy__spinner { animation: none; border-top-color: rgba(201,162,39,0.22); }
}

.ds-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.15);
}
.ds-stat {
  font-size: 0.78rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(201,162,39,0.3);
  background: rgba(201,162,39,0.06);
  color: #c9a227;
  font-family: ui-monospace, monospace;
}

.ds-modal__editor {
  width: 100%;
  min-height: 22rem;
  background: #0a1422;
  color: #f0e6d2;
  border: 1px solid rgba(201,162,39,0.22);
  border-radius: 6px;
  padding: 0.8rem 0.9rem;
  font-family: ui-monospace, SFMono-Regular, "Menlo", monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  resize: vertical;
}
.ds-modal__editor:focus { outline: 2px solid #c9a227; }

.ds-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  border-top: 1px solid rgba(201,162,39,0.18);
  padding-top: 0.7rem;
}

.ds-modal__hash {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: #c9a227;
  background: rgba(201, 162, 39, 0.06);
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  margin-right: auto;
}

.ds-modal__btn {
  padding: 0.5rem 0.95rem;
  background: rgba(201, 162, 39, 0.1);
  color: #c9a227;
  border: 1px solid rgba(201, 162, 39, 0.4);
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.ds-modal__btn:hover { background: rgba(201, 162, 39, 0.18); }
.ds-modal__btn:focus { outline: 2px solid #f0e6d2; }
.ds-modal__btn--primary {
  background: linear-gradient(180deg, #c9a227 0%, #a9871f 100%);
  color: #0d1b2a;
  border-color: transparent;
}
.ds-modal__btn--primary:hover { filter: brightness(1.06); }

.ds-modal__disclaimer {
  margin: 0;
  font-size: 0.78rem;
  color: #758496;
  font-style: italic;
}

.ds-error { text-align: center; padding: 1.5rem 0.75rem; }
.ds-error__msg { margin: 0 0 0.4rem; color: #c9a227; font-weight: 600; }
.ds-error__sub { margin: 0 0 1rem; color: #a9b6cb; font-style: italic; font-size: 0.88rem; }

@media (max-width: 600px) {
  .ds-modal { width: 98vw; max-height: 96vh; }
}
