/* views.css — curriculum & gallery views */

/* ============================================================
   CURRICULUM VIEW
   ============================================================ */
.curr-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.curr-tab {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--green-border);
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: all 0.15s;
}
.curr-tab:hover { background: var(--green-light); }
.curr-tab.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }

.curr-book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.65rem;
}
.curr-book-item {
  background: #fff;
  border-radius: 8px;
  border: 1.5px solid var(--gray-border);
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.curr-book-item:hover { border-color: var(--green-border); }
.curr-book-item .topic-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--green-mid);
  flex-shrink: 0;
  margin-top: 4px;
}
.curr-book-item .cb-title { font-family: var(--font-serif); font-size: 0.85rem; font-weight: 600; color: var(--gray-dark); }
.curr-book-item .cb-author { font-size: 0.75rem; color: var(--gray-mid); margin-top: 2px; }
.curr-book-item .cb-topic { font-size: 0.72rem; color: var(--green-mid); margin-top: 3px; font-style: italic; }
.curr-book-item .cb-sing  { font-size: 0.68rem; color: var(--teal-mid); margin-top: 2px; }

/* ============================================================
   GALLERY VIEW
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.gallery-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  background: var(--green-light);
}
.gallery-item:hover {
  border-color: var(--green-mid);
  transform: scale(1.02);
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-item .gallery-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  color: #fff;
  font-size: 0.72rem;
  padding: 1.5rem 0.5rem 0.4rem;
  line-height: 1.3;
  font-family: var(--font-serif);
}
.gallery-no-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.4rem;
  opacity: 0.5;
}
.gallery-no-cover span:first-child { font-size: 2rem; }
.gallery-no-cover span:last-child  { font-size: 0.68rem; color: var(--green-dark); text-align: center; padding: 0 0.3rem; }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 600;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: min(90vw, 500px);
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-title {
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1rem;
  text-align: center;
  max-width: 400px;
}
.lightbox-close {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  width: 40px; height: 40px;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-nav {
  display: flex;
  gap: 0.5rem;
}
.lightbox-nav button {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  color: #fff;
  padding: 0.45rem 1rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

/* ============================================================
   IMAGE PICKER MODAL (admin)
   ============================================================ */
.img-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
}
.img-picker-item {
  aspect-ratio: 3/4;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.12s;
}
.img-picker-item:hover { border-color: var(--green-mid); }
.img-picker-item.selected { border-color: var(--green-dark); }
.img-picker-item img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   BULK IMPORT VIEW
   ============================================================ */
.import-zone {
  border: 2px dashed var(--gray-border);
  border-radius: 10px;
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
}
.import-zone:hover, .import-zone.drag-over {
  border-color: var(--green-mid);
  background: var(--green-light);
}
.import-zone .icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.import-zone p { font-size: 0.88rem; color: var(--gray-mid); }
.import-zone strong { color: var(--green-dark); }

.import-preview {
  margin-top: 1rem;
  overflow-x: auto;
  border-radius: 8px;
  border: 1.5px solid var(--gray-border);
  background: #fff;
}
.import-preview table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.import-preview th {
  background: var(--green-dark);
  color: #fff;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.import-preview td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: top;
}
.import-preview tr:nth-child(even) td { background: var(--gray-light); }
.import-preview tr.dup td { opacity: 0.5; }
.import-preview .dup-badge {
  font-size: 0.68rem;
  background: var(--amber-light);
  color: var(--amber-dark);
  border: 1px solid var(--amber-border);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
}

.import-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
}
.import-result {
  background: var(--teal-light);
  border: 1.5px solid var(--teal-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--teal-dark);
  margin-top: 0.75rem;
  display: none;
}
.import-result.visible { display: block; }

/* Template download link */
.template-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.83rem;
  color: var(--green-mid);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dashed var(--green-border);
}
.template-link:hover { color: var(--green-dark); }

/* Link import — error rows stay fully visible (unlike book import dup rows) */
#link-import-table tr.dup td { opacity: 1; background: #fff7f0; }
/* URL cells: truncate very long URLs gracefully */
.url-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }

/* ============================================================
   LINK INFO POPUP
   ============================================================ */
.link-info-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 700;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
}
.link-info-popup.open { display: flex; }

.lip-card {
  background: #fff;
  border: 1.5px solid var(--green-border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  padding: 1rem 1.25rem 1.1rem;
  max-width: 340px;
  width: 90%;
}
.lip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.lip-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--green-dark);
  flex: 1;
}
.lip-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-mid);
  line-height: 1;
  padding: 0 0.2rem;
  flex-shrink: 0;
}
.lip-close:hover { color: var(--gray-dark); }
.lip-desc {
  font-size: 0.85rem;
  color: var(--gray-dark);
  line-height: 1.55;
  margin: 0;
}

/* ── Please Note popup (pn-popup) ── */
.pn-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 700;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
}
.pn-popup.open { display: flex; }
.pn-card {
  background: #fff;
  border: 1.5px solid var(--teal-border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  padding: 1rem 1.25rem 1.1rem;
  max-width: 480px;
  width: 92%;
}
.pn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-border);
  padding-bottom: 0.55rem;
}
.pn-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--teal-dark);
  flex: 1;
}
.pn-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-mid);
  line-height: 1;
  padding: 0 0.2rem;
  flex-shrink: 0;
}
.pn-close:hover { color: var(--gray-dark); }
.pn-body {
  font-size: 0.88rem;
  color: var(--gray-dark);
  line-height: 1.6;
}
.pn-body ul { margin: 0.3rem 0 0.3rem 1.2rem; padding: 0; }
.pn-body li { margin-bottom: 0.2rem; }
.pn-body b, .pn-body strong { font-weight: 600; }

/* ── ℹ️ tag in book card ── */
.tag-pn-icon {
  background: var(--teal-light);
  color: var(--teal-dark);
  border: 1.5px solid var(--teal-border);
  border-radius: 20px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--font-body);
  line-height: 1.5;
  vertical-align: middle;
  display: inline-block;
}
.tag-pn-icon:hover { filter: brightness(0.93); }

/* ── Very important variant — white ! on red circle ── */
.tag-pn-icon.tag-pn-important {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  font-weight: 800;
  font-size: 1rem;
  width: 1.7em;
  height: 1.7em;
  min-width: unset;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.tag-pn-icon.tag-pn-important:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ── ℹ️ button in detail title ── */
.pn-detail-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  vertical-align: middle;
  margin-left: 0.3rem;
  padding: 0;
  line-height: 1;
  opacity: 0.75;
}
.pn-detail-btn:hover { opacity: 1; }

/* ── Important variant in detail title — white ! on red circle ── */
.pn-detail-btn--important {
  background: #dc2626;
  color: #fff;
  border-radius: 50%;
  width: 1.5em;
  height: 1.5em;
  font-size: 1.05rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  filter: none;
  line-height: 1;
  padding: 0;
}
.pn-detail-btn--important:hover {
  background: #b91c1c;
}

/* ── Delete notes button in edit form ── */
.btn-notes-delete {
  background: var(--coral-light, #fff0ed);
  color: var(--coral-dark, #b03020);
  border: 1.5px solid var(--coral-border, #f4c2b8);
  border-radius: 7px;
  padding: 0.4rem 0.9rem;
  font-size: 0.83rem;
  font-family: var(--font-body);
  cursor: pointer;
}
.btn-notes-delete:hover { filter: brightness(0.95); }

/* ── Link button wrapper (holds the <a> + optional ❓) ── */
.link-btn-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ── Suitability badge (detail page, multi-value) ── */
.suit-badge {
  display: inline-block;
  background: var(--green-light, #d8f3dc);
  color: var(--green-dark, #2d6a4f);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Text note chip (link type + note text, non-clickable) ── */
.link-note-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  color: #666;
  cursor: default;
  user-select: text;
}
.link-note-text {
  color: #888;
  font-style: italic;
}

/* ── ❓ info button beside a link ── */
.btn-link-info {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s;
  vertical-align: middle;
}
.btn-link-info:hover { opacity: 1; }

/* ── ❓ info button in the Link Title manager list ── */
.btn-info-lt {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0 0.15rem;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.btn-info-lt:hover   { opacity: 0.9; }
.btn-info-lt.has-desc { opacity: 0.85; } /* brighter when a description exists */

/* ============================================================
   ADMIN LOGIN MODAL
   ============================================================ */
.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  margin: 0 auto;
}
.admin-login-form input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--gray-border);
  border-radius: 8px;
  width: 100%;
}
.admin-login-form input:focus { border-color: var(--green-mid); outline: none; }
.login-error {
  color: #a32d2d;
  font-size: 0.82rem;
  text-align: center;
  display: none;
}
.login-error.visible { display: block; }

