/* ============================================================
   Member Study Library styles (studies.css)
   Parchment / dark navy / gold, Nunito. Mobile-first.
   ============================================================ */

.studies-overlay {
  position: fixed;
  inset: 0;
  z-index: 620;
  display: none;
  background: #0f1c30;
}
.studies-overlay.visible { display: block; }
body.studies-open { overflow: hidden; }

.studies-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.studies-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #16263f 0%, #0f1c30 100%);
  border-bottom: 1.5px solid rgba(201, 150, 59, 0.45);
}
.studies-topbar-title {
  flex: 1;
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #e8d9b5;
  letter-spacing: 0.4px;
}
.studies-back, .studies-close {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid rgba(201, 150, 59, 0.5);
  background: rgba(201, 150, 59, 0.10);
  color: #e8d9b5;
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
}
.studies-back:active, .studies-close:active { transform: scale(0.94); }

.studies-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 48px;
}

.studies-loading, .studies-empty {
  text-align: center;
  color: #b9c4d6;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  padding: 30px 16px;
  line-height: 1.5;
}

.studies-hero h2 {
  font-family: 'Nunito', sans-serif;
  color: #e8d9b5;
  font-size: 1.35rem;
  margin: 4px 0 6px;
}
.studies-hero p {
  color: #b9c4d6;
  font-size: 0.95rem;
  margin: 0 0 14px;
  line-height: 1.5;
}

/* ---------- list controls ---------- */
.studies-actionrow { margin-bottom: 12px; }
.studies-create-btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--color-gold, #c9963b);
  background: rgba(201, 150, 59, 0.20);
  color: #f7e9cf;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.studies-create-btn:hover { background: rgba(201, 150, 59, 0.30); }
.studies-create-plus { font-size: 1.25rem; line-height: 1; }

.studies-searchrow { margin-bottom: 12px; }
.studies-search {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(201, 150, 59, 0.5);
  background: #16263f;
  color: #f2ead8;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
}
.studies-search::placeholder { color: #8fa0b8; }

.studies-scopes {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}
.studies-scope {
  flex-shrink: 0;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1.5px solid rgba(201, 150, 59, 0.45);
  background: rgba(201, 150, 59, 0.08);
  color: #d8cba8;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.studies-scope.active {
  background: var(--color-gold, #c9963b);
  border-color: var(--color-gold, #c9963b);
  color: #1a2a44;
}

/* ---------- study cards ---------- */
.studies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.study-card {
  text-align: left;
  border-radius: 14px;
  border: 1.5px solid rgba(201, 150, 59, 0.35);
  background: linear-gradient(160deg, #1b2c49, #16253d);
  padding: 14px 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #f2ead8;
  font-family: 'Nunito', sans-serif;
}
.study-card:hover { border-color: rgba(201, 150, 59, 0.7); }
.study-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.study-card-fmt {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #c9963b;
}
.study-card-draft {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #1a2a44;
  background: #d9b877;
  border-radius: 6px;
  padding: 2px 7px;
}
.study-card-title { font-size: 1.05rem; font-weight: 800; color: #f4ead2; line-height: 1.25; }
.study-card-desc { font-size: 0.85rem; color: #b9c4d6; line-height: 1.4; }
.study-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #9fb0cc;
}
.study-card-scope { font-weight: 700; }

/* ---------- detail ---------- */
.study-detail-head { margin-bottom: 18px; }
.study-detail-fmt {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #c9963b;
  margin-bottom: 4px;
}
.study-detail-head h2 {
  font-family: 'Nunito', sans-serif;
  color: #f4ead2;
  font-size: 1.5rem;
  margin: 0 0 6px;
  line-height: 1.2;
}
.study-detail-desc { color: #c6d0e0; font-size: 0.95rem; margin: 0 0 10px; line-height: 1.5; }
.study-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: #9fb0cc;
  font-size: 0.85rem;
  font-weight: 600;
}
.study-detail-owneractions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.studies-btn {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid rgba(201, 150, 59, 0.6);
  background: rgba(201, 150, 59, 0.12);
  color: #f7e9cf;
}
.studies-btn:hover { background: rgba(201, 150, 59, 0.22); }
.studies-btn-gold { background: var(--color-gold, #c9963b); border-color: var(--color-gold, #c9963b); color: #1a2a44; }
.studies-btn-gold:hover { background: #d7a94f; }
.studies-btn-ghost { background: transparent; border-color: rgba(159, 176, 204, 0.45); color: #c9d4e5; }
.studies-btn-danger { background: transparent; border-color: rgba(224, 122, 122, 0.6); color: #f0a6a6; }
.studies-btn-danger:hover { background: rgba(224, 122, 122, 0.14); }

.study-section {
  border-radius: 14px;
  border: 1.5px solid rgba(201, 150, 59, 0.3);
  background: rgba(22, 38, 63, 0.6);
  padding: 16px;
  margin-bottom: 14px;
}
.study-section-num {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #c9963b;
  margin-bottom: 4px;
}
.study-section-title { font-family: 'Nunito', sans-serif; color: #f4ead2; font-size: 1.15rem; margin: 0 0 10px; }
.study-part { margin-bottom: 12px; }
.study-part-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #d8cba8;
  margin-bottom: 4px;
}
.study-ref { font-weight: 800; color: #e8d9b5; font-size: 0.98rem; }
.study-scripture {
  color: #d4dcea;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 4px;
  padding-left: 12px;
  border-left: 3px solid rgba(201, 150, 59, 0.5);
  font-style: italic;
}
.study-work { color: #cdd6e4; font-size: 0.92rem; line-height: 1.55; }
.study-questions { margin: 4px 0 0; padding-left: 20px; color: #d4dcea; }
.study-questions li { margin-bottom: 8px; line-height: 1.5; font-size: 0.93rem; }
.study-leader {
  background: rgba(201, 150, 59, 0.10);
  border: 1px solid rgba(201, 150, 59, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
}
.study-leader-body { color: #e3d7b8; font-size: 0.9rem; line-height: 1.55; }
.study-doc {
  background: rgba(127, 170, 220, 0.10);
  border: 1px solid rgba(127, 170, 220, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
}
.study-doc-icon { color: #c9963b; }
.study-doc-body { color: #d4dcea; font-size: 0.9rem; line-height: 1.6; }

/* ---------- authoring form ---------- */
.study-form { margin-bottom: 8px; }
.study-field { display: block; margin-bottom: 14px; }
.study-field-row { display: flex; gap: 12px; }
.study-field-row .study-field { flex: 1; }
.study-label {
  display: block;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: #d8cba8;
  margin-bottom: 6px;
}
.study-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.study-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1.5px solid rgba(201, 150, 59, 0.45);
  background: #16263f;
  color: #f2ead8;
  font-family: 'Nunito', sans-serif;
  font-size: 0.98rem;
}
.study-input:focus {
  outline: none;
  border-color: var(--color-gold, #c9963b);
  box-shadow: 0 0 0 3px rgba(201, 150, 59, 0.22);
}
.study-input::placeholder { color: #8194ad; }
.study-textarea { min-height: 82px; resize: vertical; line-height: 1.5; }

.study-section-edit {
  border-radius: 14px;
  border: 1.5px solid rgba(201, 150, 59, 0.3);
  background: rgba(22, 38, 63, 0.55);
  padding: 14px;
  margin-bottom: 14px;
}
.study-section-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.study-section-edit-num {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #c9963b;
}
.study-section-remove {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1.5px solid rgba(224, 122, 122, 0.5);
  background: transparent;
  color: #f0a6a6;
  cursor: pointer;
  font-size: 0.85rem;
}

.study-ai-btn {
  border-radius: 8px;
  border: 1.5px solid rgba(127, 170, 220, 0.5);
  background: rgba(127, 170, 220, 0.12);
  color: #cfe0f4;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 11px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.study-ai-btn:hover { background: rgba(127, 170, 220, 0.2); }
.study-ai-btn:disabled { opacity: 0.6; cursor: default; }
.study-ai-icon { color: #c9963b; }

.study-questions-edit { display: flex; flex-direction: column; gap: 8px; }
.study-question-row { display: flex; gap: 8px; align-items: center; }
.study-question-row .study-input { flex: 1; }
.study-question-remove {
  width: 34px; height: 40px;
  border-radius: 8px;
  border: 1.5px solid rgba(159, 176, 204, 0.35);
  background: transparent;
  color: #9fb0cc;
  cursor: pointer;
  flex-shrink: 0;
}
.study-add-question {
  margin-top: 8px;
  background: none;
  border: none;
  color: #c9963b;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 0;
}

.study-add-section { width: 100%; margin: 4px 0 16px; }
.study-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.study-save-hint { color: #9fb0cc; font-size: 0.82rem; }

@media (max-width: 520px) {
  .study-field-row { flex-direction: column; gap: 0; }
  .studies-grid { grid-template-columns: 1fr; }
}
