/* ============================================================
   NeucitePress Books — ncp-frontend-v4.css
   UX improvement pass: header auth, show-pw, register btn,
   external link icons, input widths, empty state, SMTP notice
   ============================================================ */

/* --- Inherit all v3 rules --- */

/* ── Header auth links (Login / Register) ── */
.ncp_header_auth {
  display: flex; align-items: center; gap: .5rem;
  margin-left: auto; padding: 0 1rem; white-space: nowrap;
}
.ncp_auth_link { color: #fff; font-size: .8rem; text-decoration: none; padding: .3rem .6rem; }
.ncp_auth_link:hover { text-decoration: underline; color: #fff; }
.ncp_auth_btn {
  font-size: .8rem; padding: .3rem .9rem; border-radius: 4px;
  text-decoration: none; font-weight: 600; cursor: pointer;
}
.ncp_auth_btn--outline {
  border: 1px solid #fff; color: #fff; background: transparent;
}
.ncp_auth_btn--outline:hover { background: rgba(255,255,255,.15); color: #fff; }
.ncp_auth_btn--primary { background: #fff; color: #6B1010; border: 1px solid #fff; }
.ncp_auth_btn--primary:hover { background: #f0e0e0; color: #6B1010; }

/* ── External link indicator ── */

/* ── Login page: value prop text ── */
.ncp_login_value {
  color: #475569; font-size: .9rem; margin-bottom: 1rem;
  border-left: 3px solid #8C1515; padding-left: .75rem;
}

/* ── Show-password toggle ── */
.ncp_pw_field_wrap { position: relative; display: flex; align-items: center; }
.ncp_pw_field_wrap input[type="password"],
.ncp_pw_field_wrap input[type="text"] {
  flex: 1; padding-right: 4.5rem !important;
}
.ncp_pw_toggle {
  position: absolute; right: .5rem;
  background: transparent !important; border: none !important;
  color: #6B1010 !important; font-size: .78rem !important;
  padding: .2rem .4rem !important; cursor: pointer !important;
  font-weight: 600 !important; box-shadow: none !important;
}
.ncp_pw_toggle:hover { color: #8C1515 !important; background: transparent !important; }

/* ── Register as secondary button ── */
.ncp_btn_secondary {
  display: inline-block; padding: .5em 1.2em;
  border: 2px solid #8C1515 !important; color: #8C1515 !important;
  background: transparent !important; border-radius: 4px;
  font-weight: 600; text-decoration: none; cursor: pointer;
  font-size: .9rem; vertical-align: middle;
}
.ncp_btn_secondary:hover {
  background: #8C1515 !important; color: #fff !important;
}
/* Hide the old plain-text register link on the login page */
.page_login .buttons a.register { display: none; }

/* ── Normalize input field widths ── */
.cmp_form input[type="text"],
.cmp_form input[type="email"],
.cmp_form input[type="password"],
.cmp_form select,
.cmp_form textarea {
  width: 100% !important; max-width: 480px; box-sizing: border-box;
  border: 1px solid #CBD5E1; border-radius: 4px; padding: .55rem .75rem;
  font-size: .95rem; color: #1E293B; background: #fff;
}
.cmp_form input[type="text"]:focus,
.cmp_form input[type="email"]:focus,
.cmp_form input[type="password"]:focus,
.cmp_form select:focus { border-color: #8C1515; outline: none;
  box-shadow: 0 0 0 2px rgba(140,21,21,.15);
}

/* ── Catalog empty state ── */
.pkp_structure_main .page_catalog .pkp_catalog_filters + *:empty::before,
.pkp_structure_main .page_catalog:empty::before {
  content: "";
}
.ncp_empty_catalog {
  text-align: center; padding: 3rem 2rem; color: #64748B;
}
.ncp_empty_catalog h2 { color: #1E293B; margin-bottom: .5rem; }

/* ── Language toggle in sidebar: compact ── */
.block_language { font-size: .85rem; }
.block_language .title { font-size: .85rem; }
.block_language ul { list-style: none; padding: 0; margin: 0; }
.block_language ul li { padding: .2rem 0; }
.block_language ul li.current a { font-weight: 700; color: #6B1010; }

/* ── Hero area placeholder when no image set ── */
.pkp_structure_main .page_index .pkp_page_header:empty {
  display: none;
}

/* ── Registration: affiliation not required ── */
#affiliation { border-color: #CBD5E1; }
/* ── Country: add note for search ── */
select[name="country"] { max-width: 480px; }

/* ============================================================
   v5: Purchase button branding, OA badge, HTML viewer
   ============================================================ */

/* ── Purchase / paid chapter button → slate with gold accent ── */
.cmp_download_link[href*="Purchase"],
.pkp_block .pkp_catalog a[href*="purchase"],
.pub_format_single .cmp_download_link:not([data-oa]) {
  /* handled below via price detection */
}

/* OMP renders paid files with a specific class structure —
   target the purchase link text */
.cmp_download_link {
  display: inline-block;
  padding: .4rem .9rem;
  border-radius: 4px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  margin: .2rem .3rem .2rem 0;
  transition: background .15s, color .15s;
}

/* Free download = cardinal (OA) */
.cmp_download_link {
  background: #8C1515;
  color: #fff !important;
  border: 1px solid #8C1515;
}
.cmp_download_link:hover {
  background: #6B1010;
  border-color: #6B1010;
  color: #fff !important;
}

/* Purchase link = slate dark with gold text */
.cmp_purchase_link,
a.cmp_download_link[href*="purchase"],
.pkp_catalog a[class*="purchase"] {
  background: #1E293B !important;
  border-color: #1E293B !important;
  color: #F5C842 !important;
}
.cmp_purchase_link:hover {
  background: #0f172a !important;
  color: #FFD700 !important;
}

/* ── OA lock badge next to free chapter titles ── */
.obj_monograph_full .chapters .chapter .chapter_title::after,
.pkp_catalog .chapter .title::after {
  content: "";
}

/* Add OA badge via CSS on the chapter download area */
.pub_format_single:has(.cmp_download_link:not([href*="purchase"]))::before {
  content: "🔓 Open Access";
  display: inline-block;
  background: #00b24e;
  color: #fff;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 3px;
  margin-right: .4rem;
  font-weight: 600;
  vertical-align: middle;
}

/* ── HTML iframe viewer: full height, proper display ── */
#htmlFrame, iframe[name="htmlFrame"] {
  width: 100% !important;
  min-height: 85vh !important;
  height: 85vh !important;
  border: none !important;
  border-radius: 8px;
  display: block;
}

.pkp_structure_main .page {
  padding: 0 !important;
}

/* Make the HTML view page use full width */
.pkp_page_catalog.pkp_op_view .pkp_structure_content {
  max-width: 100%;
}

/* ── Chapter listing improvements ── */
.obj_monograph_full .chapters li,
.chapters_list .chapter {
  padding: .75rem 0;
  border-bottom: 1px solid #F1F5F9;
}

.obj_monograph_full .chapters li:last-child {
  border-bottom: none;
}

/* ── Book page sidebar metadata ── */
.obj_monograph_full .main_entry .entry_details {
  background: #F8F6F3;
  border-radius: 8px;
  padding: 1.25rem;
  border: 1px solid #E2E8F0;
}

.obj_monograph_full .main_entry .label {
  color: #6B1010;
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ============================================================
   v5 additions: cover positioning, buy button, OA badge
   ============================================================ */

/* ── Cover image: prominent, sticky sidebar ── */
.obj_monograph_full .entry_details {
  position: sticky;
  top: 1rem;
}
.obj_monograph_full .item.cover img {
  width: 100%;
  max-width: 280px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  display: block;
  margin: 0 auto 1.5rem;
}

/* ── Buy chapter button: dark slate + gold ── */
.ncp_buy_link {
  background: #1E293B !important;
  border-color: #1E293B !important;
  color: #F5C842 !important;
}
.ncp_buy_link:hover {
  background: #0f172a !important;
  color: #FFD700 !important;
}

/* ── OA badge: green lock before free download buttons ── */
.pub_format_single .cmp_download_link:not(.ncp_buy_link)::before {
  content: "🔓 ";
  font-size: .85em;
}

/* ── Chapter list: tighter, cleaner ── */
.obj_monograph_full .chapters li {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .85rem 0;
  border-bottom: 1px solid #F1F5F9;
}
.obj_monograph_full .chapters li:last-child { border-bottom: none; }
.obj_monograph_full .chapters .title { font-weight: 600; font-size: .95rem; }
.obj_monograph_full .chapters .authors { font-size: .85rem; color: #64748B; }

/* ── HTML iframe viewer: full height ── */
iframe[name="htmlFrame"] {
  width: 100% !important;
  min-height: 88vh !important;
  border: none !important;
  display: block;
}

/* ── Sidebar metadata labels ── */
.obj_monograph_full .entry_details .label {
  color: #6B1010;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

}

/* ── Cover image: fix sizing in sidebar ── */
.obj_monograph_full .entry_details .item.cover,
.entry_details .item.cover {
  display: block !important;
  margin-bottom: 1.5rem;
}
.obj_monograph_full .entry_details .item.cover img,
.entry_details .item.cover img {
  width: 100% !important;
  max-width: 260px !important;
  height: auto !important;
  display: block !important;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.20);
  margin: 0 auto 1rem;
}

/* ── Author list: proper case, not all-caps ── */
.obj_monograph_full .authors,
.obj_monograph_full .author {
  text-transform: none !important;
}
.obj_monograph_full .authors ul {
  list-style: none; padding: 0; margin: .5rem 0 1.5rem;
}
.obj_monograph_full .authors .name {
  font-size: 1rem; color: #475569;
}

/* ── Register link: move into header, hide from second nav row ── */
.pkp_navigation_user .pkp_nav_list {
  display: flex; align-items: center; gap: .5rem;
}

/* ── Reduce excess whitespace ── */
.obj_monograph_full .main_entry .abstract,
.obj_monograph_full .sub_item {
  margin-bottom: 1rem !important;
}
.obj_monograph_full .row {
  margin-top: 1rem;
}

/* ── Author .label: remove ALL CAPS ── */
.obj_monograph_full .item.authors .label,
.obj_monograph_full .item.authors .sub_item .label {
  text-transform: none !important;
  font-weight: 600;
  font-size: .95rem;
  color: #1E293B;
}

/* ── For edited volumes: format the semicolon-separated list ── */
.obj_monograph_full .item.authors {
  margin-bottom: 1.5rem;
}

/* ── Entry details: ensure cover is first and visible ── */
.obj_monograph_full .entry_details {
  display: flex;
  flex-direction: column;
}
.obj_monograph_full .entry_details .item.cover {
  order: -1;
}

/* ── Remove excess vertical whitespace ── */
.obj_monograph_full .main_entry > .sub_item,
.obj_monograph_full .item.abstract {
  margin-bottom: 1.25rem !important;
}
.obj_monograph_full .chapters_list,
.obj_monograph_full .chapters {
  margin-top: 0 !important;
}

/* ── Register link: keep in header user nav, suppress odd positioning ── */
.pkp_navigation_user { align-items: center; }

/* ── Breadcrumb spacing ── */
.pkp_breadcrumbs { margin-bottom: .5rem; }

/* ── Author / editor name display ── */
.ncp_editor_name, .ncp_author_name {
  font-size: .95rem;
  font-weight: 600;
  color: #1E293B;
  text-transform: none !important;
}
.ncp_ed_badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  color: #6B1010;
  border: 1px solid #8C1515;
  border-radius: 3px;
  padding: .1rem .35rem;
  margin-left: .4rem;
  vertical-align: middle;
}
.ncp_author_list {
  font-size: .9rem;
  color: #475569;
  margin: .5rem 0 1.5rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════
   Book page layout — full width, suppress OMP sidebar
   Our template has its own sidebar grid built in
   ═══════════════════════════════════════════════════════ */
.pkp_page_catalog.pkp_op_book .pkp_structure_content.has_sidebar,
.page_book .pkp_structure_content.has_sidebar {
  display: block !important; /* override OMP flex/grid */
}
.pkp_page_catalog.pkp_op_book .pkp_structure_main,
.page_book .pkp_structure_main {
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
/* Hide OMP language sidebar — we have language in our own sidebar */
.pkp_page_catalog.pkp_op_book .pkp_structure_sidebar,
.page_book .pkp_structure_sidebar {
  display: none !important;
}

}

/* Fix Register in second nav row — hide from nav, keep in header auth */
.pkp_navigation_primary .pkp_nav_list > li:last-child > a[href*="register"] {
  /* Already handled in header.tpl — suppress duplicate */
}

/* Fix empty white space below hero — ncp-book-body starts immediately */
.ncp-book-hero + .ncp-book-body {
  margin-top: 0 !important;
}
.ncp-book-page { padding: 0; }
.page_book { padding: 0 !important; margin: 0 !important; }
.pkp_page_catalog.pkp_op_book .pkp_structure_main { padding: 1.5rem 2rem !important; }
@media (max-width: 768px) {
  .pkp_page_catalog.pkp_op_book .pkp_structure_main { padding: 1rem !important; }
}

}
/* Simpler: just remove the ::after entirely, JS adds target=_blank already */

/* ── Margin / spacing fixes ── */
/* Remove OMP default padding from page wrapper */
.pkp_page_catalog.pkp_op_book .pkp_structure_main { padding: 0 !important; }
.page_book { margin: 0 !important; padding: 0 !important; }
.ncp-book-page { padding: 1.5rem 2rem !important; max-width: 1140px; margin: 0 auto; }

/* Collapse gap between hero and body */
.ncp-book-hero { margin-bottom: 0; border-bottom: 1px solid #E2E8F0; padding-bottom: 1.5rem; }
.ncp-book-body { margin-top: 1.75rem; }

/* Suppress OMP sidebar visually (already display:none above) */
.pkp_page_catalog.pkp_op_book .pkp_structure_sidebar { display: none !important; width: 0 !important; }

/* Remove Register from second nav row (it is already in header auth) */
.pkp_navigation_user .pkp_nav_list li a[href*="register"] { display: none; }
.pkp_navigation_primary_row .pkp_navigation_user { display: none; }

/* Nav: keep clean without extra row */
.pkp_site_nav_wrapper { display: flex; align-items: center; justify-content: space-between; }

/* External nav links: NO ::after (JS handles target=_blank) */
.pkp_navigation_primary a:after { content: '' !important; }
.pkp_navigation_primary [aria-haspopup]:after {
  content: '' !important;
  display: inline-block !important;
  width: 0 !important; height: 0 !important;
  border-top: 4px solid currentColor !important;
  border-right: 4px solid transparent !important;
  border-left: 4px solid transparent !important;
  margin-left: .3em !important;
  vertical-align: middle !important;
}

/* ── ORCID BUTTON — Official brand styling ────────────────────── */
#connect-orcid-button {
  background-color: #A6CE39 !important;
  border: 1px solid #A6CE39 !important;
  color: #000 !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  padding: 10px 18px !important;
  border-radius: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: background-color .2s, border-color .2s !important;
  margin-top: 8px !important;
}
#connect-orcid-button:hover {
  background-color: #8faf2e !important;
  border-color: #8faf2e !important;
}
#connect-orcid-button .orcid_button_container {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
#connect-orcid-button .orcid_icon {
  width: 24px !important;
  height: 24px !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}
/* Verified ORCID badge on contributor form */
.orcid-id-authenticated {
  color: #A6CE39;
  font-weight: 600;
}
