
/* TE RefWiki Citations - scoped styles only */
.te-refwiki-sup { line-height: 0; vertical-align: super; font-size: .75em; }
.te-refwiki-marker {
  text-decoration: none;
  font-weight: 700;
  font-family: "Times New Roman", Times, serif;
  position: relative;
  cursor: pointer;
  user-select: none;
  background: rgba(201,162,39,.24);
  border-bottom: 2px solid rgba(201,162,39,.35);
  border-radius: 3px;
  padding: 0 1px;
}
.te-refwiki-marker:hover { text-decoration: underline; }



/* Editor-visible placeholder marker: show [a]/[1] even before front-end rendering */
.te-refwiki-cite{
  position: relative;
  display: inline;
  vertical-align: super;
  font-size: .75em;
  line-height: 0;
  font-family: "Times New Roman", Times, serif;
  font-weight: 700;
  color: var(--te-refwiki-gold, #c9a227);
  user-select: none;
  cursor: pointer;
}
.te-refwiki-cite::before{ content: "[" attr(data-label) "]"; }
/* Tooltip (Wikipedia-ish) */
.te-refwiki-marker::after,
.te-refwiki-marker::before { pointer-events: none; opacity: 0; transition: opacity .12s ease, transform .12s ease; }
.te-refwiki-marker::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 140%;
  transform: translateX(-50%) translateY(6px);
  width: min(420px, 70vw);
  max-height: 220px;
  overflow: hidden;
  padding: 10px 12px;
  background: #fff;
  color: #1f2328;
  border: 1px solid rgba(31,35,40,.18);
  box-shadow: 0 14px 40px rgba(0,0,0,.18);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  z-index: 999999;
  white-space: normal;
}
.te-refwiki-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 132%;
  transform: translateX(-50%) translateY(6px);
  border: 8px solid transparent;
  border-top-color: rgba(31,35,40,.18);
  z-index: 999998;
}

/* Desktop hover */
@media (hover:hover) and (pointer:fine) {
  .te-refwiki-marker:hover::after,
  .te-refwiki-marker:hover::before { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Mobile long-press: JS will add .te-refwiki-tooltip-open */
.te-refwiki-marker.te-refwiki-tooltip-open::after,
.te-refwiki-marker.te-refwiki-tooltip-open::before { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Bottom lists */
.te-refwiki-bottom { margin-top: 26px; padding-top: 14px; border-top: 1px solid rgba(0,0,0,.12); }
.te-refwiki-heading {
  font-family: Cinzel, serif;
  font-weight: 700;
  margin: 18px 0 10px;
  font-size: 20px;
}
.te-refwiki-list { margin: 0 0 16px 20px; padding: 0; }
.te-refwiki-item { margin: 8px 0; font-family: "Times New Roman", Times, serif; font-size: 16px; line-height: 1.5; }
.te-refwiki-item-label { font-weight: 700; margin-right: 8px; }
.te-refwiki-item-body i { font-style: italic; }

.te-refwiki-occ-wrap{font-family: "Times New Roman", Times, serif;font-size:13px;margin-right:8px;opacity:.9;white-space:nowrap}
.te-refwiki-occ-link{color:inherit;text-decoration:none;border-bottom:1px dotted rgba(0,0,0,.35);padding:0 1px}
.te-refwiki-occ-link:hover{text-decoration:underline}
.te-refwiki-occ-sep{opacity:.6}

/* Bibliography boxed list (4:5-ish visual, vertical scrolling) */
.te-refwiki-bibbox{border:1px solid rgba(0,0,0,.10);border-radius:14px;padding:10px 12px;background:rgba(0,0,0,.02);max-height:var(--te-refwiki-bib-h,420px);overflow-y:auto;overflow-x:hidden}
.te-refwiki-fnbox{border:1px solid rgba(0,0,0,.10);border-radius:14px;padding:10px 12px;background:rgba(0,0,0,.02);max-height:var(--te-refwiki-fn-h,280px);overflow-y:auto;overflow-x:hidden}
.te-refwiki-bibsubheading{font-family:Cinzel,serif;font-weight:800;font-size:14px;margin:10px 0 6px;opacity:.92}
.te-refwiki-bibgroup:first-child .te-refwiki-bibsubheading{margin-top:0}
.te-refwiki-bottom .te-refwiki-list-ref{margin-bottom:8px}
@media (max-width: 782px){.te-refwiki-bibbox{max-height:var(--te-refwiki-bib-h-m,320px)}.te-refwiki-fnbox{max-height:var(--te-refwiki-fn-h-m,240px)}}

/* Right-side UI wrapper */
.te-refwiki-ui { position: fixed; right: 0; top: 28%; z-index: 999999; pointer-events: none; }
.te-refwiki-ui * { box-sizing: border-box; }
.te-refwiki-tab {
  pointer-events: auto;
  width: 44px;
  height: 160px;
  border: 0;
  border-radius: 12px 0 0 12px;
  background: rgba(17,17,17,.78);
  color: #fff;
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  /* Some themes force overflow:hidden on buttons; keep text visible */
  overflow: visible !important;
  /* keep the tab visible even with heavy themes/shadows */
  z-index: 1000001;
}
.te-refwiki-tab-text {
  display: inline-block;
  /* Rotate like Wikipedia-style vertical tab, keep fully inside the button */
  transform: rotate(-90deg);
  transform-origin: center;
  font-family: Cinzel, serif;
  font-weight: 700;
  letter-spacing: .08em;
  font-size: 14px;
  white-space: nowrap;
  /* Nudge text inward so it doesn't clip on the screen edge */
  position: relative;
  /* Move further to the LEFT so text sits flush inside the tab (user request) */
  left: -18px;
  /* Ensure the label never disappears due to theme button text styles */
  color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.te-refwiki-panel {
  pointer-events: auto;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 35vw;
  min-width: 320px;
  max-width: 620px;
  background: #fff;
  border-left: 1px solid rgba(0,0,0,.12);
  box-shadow: -18px 0 50px rgba(0,0,0,.20);
  transform: translateX(105%);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
  z-index: 1000002;
}
.te-refwiki-panel-header {
  /* tighter like Wikipedia */
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  /* gold title bar only (user request) */
  background: linear-gradient(90deg, rgba(216,178,92,1), rgba(201,162,39,1), rgba(176,132,23,1));
  color: #111;
}
.te-refwiki-panel-headgrid{width:100%;display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:10px}
.te-refwiki-panel-logo img{display:block;height:28px;max-width:220px;object-fit:contain}
.te-refwiki-panel-title {
  font-family: Cinzel, serif;
  font-weight: 800;
  letter-spacing: .05em;
  font-size: 18px;
}
.te-refwiki-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  color: inherit;
}
.te-refwiki-panel-body { padding: 10px 12px 12px; overflow: auto; }
.te-refwiki-section { margin-bottom: 10px; }
.te-refwiki-section-title {
  font-family: Cinzel, serif;
  font-weight: 800;
  font-size: 16px;
  margin: 6px 0 8px;
}
.te-refwiki-panel-list { margin-left: 18px; }

/* Tighter spacing inside the panel (closer to Wikipedia feel) */
.te-refwiki-panel .te-refwiki-item { margin: 6px 0; line-height: 1.42; }
.te-refwiki-panel .te-refwiki-list { margin-bottom: 10px; }

/* Reference row with fixed thumb + horizontal scroll text */
.te-refwiki-list-ref .te-refwiki-refrow{display:flex;gap:10px;align-items:stretch}
.te-refwiki-list-ref .te-refwiki-refthumb{flex:0 0 auto;width:72px;aspect-ratio:4/5;border-radius:12px;border:1px solid rgba(0,0,0,.12);overflow:hidden;background:rgba(0,0,0,.04);display:flex;align-items:center;justify-content:center}
.te-refwiki-refthumb{cursor:pointer}
.te-refwiki-occ-wrap{font-family:"Times New Roman",Times,serif;font-size:12px;color:rgba(0,0,0,.65)}
.te-refwiki-occ-link{text-decoration:none;border-bottom:1px dotted rgba(0,0,0,.35);margin:0 1px}
.te-refwiki-occ-link:hover{text-decoration:underline}
.te-refwiki-occ-sep{margin:0 1px;color:rgba(0,0,0,.45)}

/* Bottom bibliography box (4:5-ish) */
.te-refwiki-bibbox{max-height:var(--te-refwiki-bib-h,420px);overflow-y:auto;border:1px solid rgba(0,0,0,.12);border-radius:14px;padding:8px 10px;background:rgba(0,0,0,.02)}
.te-refwiki-bibsubheading{font-family:Cinzel,serif;font-weight:800;font-size:14px;letter-spacing:.03em;margin:10px 0 6px;color:rgba(0,0,0,.8)}

@media (max-width: 782px){
  .te-refwiki-bibbox{max-height:var(--te-refwiki-bib-h-m,320px)}
  .te-refwiki-panel-logo img{height:24px;max-width:160px}
}

/* Info modal (cover click) */
.te-refwiki-modal{position:fixed;inset:0;z-index:999999;display:none;align-items:center;justify-content:center;padding:14px}
.te-refwiki-modal.is-open{display:flex}
.te-refwiki-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.55)}
.te-refwiki-modal-card{position:relative;z-index:1;width:min(860px,96vw);max-height:90vh;overflow:hidden;border-radius:18px;background:var(--te-refwiki-bg,#fff);box-shadow:0 18px 60px rgba(0,0,0,.35)}
.te-refwiki-modal-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border-bottom:1px solid rgba(0,0,0,.10);background:linear-gradient(90deg, rgba(216,178,92,1), rgba(201,162,39,1), rgba(176,132,23,1))}
.te-refwiki-modal-title{font-family:Cinzel,serif;font-weight:900;letter-spacing:.04em}
.te-refwiki-modal-close{border:0;background:transparent;font-size:28px;line-height:1;cursor:pointer}
.te-refwiki-modal-body{display:flex;gap:12px;padding:12px;overflow:auto;max-height:calc(90vh - 52px)}
.te-refwiki-modal-left{flex:0 0 140px}
.te-refwiki-modal-left img{width:140px;aspect-ratio:4/5;border-radius:16px;border:1px solid rgba(0,0,0,.12);object-fit:cover}
.te-refwiki-modal-right{flex:1 1 auto;min-width:0}
.te-refwiki-modal-tabs{display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap}
.te-refwiki-modal-tab{border:1px solid rgba(0,0,0,.12);background:rgba(0,0,0,.03);padding:6px 10px;border-radius:999px;cursor:pointer;font-weight:800;font-family:Cinzel,serif}
.te-refwiki-modal-tab.is-active{background:rgba(201,162,39,.25);border-color:rgba(201,162,39,.55)}
.te-refwiki-info-grid{display:grid;grid-template-columns:minmax(150px,240px) 1fr;gap:10px 12px}
.te-refwiki-info-label{font-weight:900;font-family:Cinzel,serif;font-size:12px;letter-spacing:.03em;color:rgba(0,0,0,.72)}
.te-refwiki-info-value{font-family:"Times New Roman",Times,serif;font-size:14px;line-height:1.45;overflow-wrap:anywhere}
.te-refwiki-used-list a{text-decoration:none}
.te-refwiki-used-list li{margin:6px 0}
.te-refwiki-list-ref .te-refwiki-refthumb img{width:100%;height:100%;object-fit:cover;display:block}
.te-refwiki-list-ref .te-refwiki-refthumb-ph{font-size:22px;opacity:.8}
.te-refwiki-list-ref .te-refwiki-reftext{flex:1 1 auto;min-width:0}
.te-refwiki-list-ref .te-refwiki-refscroll{max-height:calc(5 * 1.42em);overflow-x:auto;overflow-y:hidden;padding-right:6px}
.te-refwiki-list-ref .te-refwiki-refscroll::-webkit-scrollbar{height:6px}
.te-refwiki-list-ref .te-refwiki-refscroll::-webkit-scrollbar-thumb{background:rgba(0,0,0,.25);border-radius:6px}
/* Panel: teks referensi dibuat bisa geser horizontal tanpa mengubah layout cover */
.te-refwiki-panel .te-refwiki-list-ref .te-refwiki-item-body{display:inline-block;min-width:max-content}

/* Daftar pustaka (bawah): harus mengalir ke bawah (wrap), bukan memanjang horizontal */
.te-refwiki-bottom .te-refwiki-list-ref .te-refwiki-item-body{display:block;min-width:0;white-space:normal}
.te-refwiki-bottom .te-refwiki-reftext{overflow-x:hidden}
.te-refwiki-bottom .te-refwiki-list-ref .te-refwiki-refscroll{max-height:none;overflow:visible;padding-right:0}

/* Highlight stabilo */
.te-refwiki-item.te-refwiki-highlight {
  background: rgba(201,162,39,.55);
  box-shadow: inset 0 0 0 9999px rgba(201,162,39,.45);
  border-radius: 10px;
  padding: 10px 10px;

/* Highlight target paragraf saat klik 1,2,3 */
.te-refwiki-target-highlight{background:rgba(201,162,39,.28);border-radius:10px;box-shadow:inset 0 0 0 9999px rgba(201,162,39,.18);transition:background .15s ease}
}

/* Backdrop */
.te-refwiki-backdrop{display:none;pointer-events:auto;position:fixed;inset:0;background:rgba(0,0,0,.28);opacity:0;visibility:hidden;transition:opacity .16s ease,visibility .16s ease;z-index:1000000}

/* Open state toggled by JS on .te-refwiki-ui */
.te-refwiki-ui.te-refwiki-open .te-refwiki-panel { transform: translateX(0); }
.te-refwiki-ui.te-refwiki-open .te-refwiki-backdrop{display:none;pointer-events:auto;position:fixed;inset:0;background:rgba(0,0,0,.28);opacity:0;visibility:hidden;transition:opacity .16s ease,visibility .16s ease;z-index:1000000}

/* Reference info modal (cover click) */
.te-refwiki-infomodal-back{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:1000004;display:none;align-items:center;justify-content:center;padding:14px}
.te-refwiki-infomodal{width:min(720px,96vw);max-height:88vh;overflow:hidden;background:#fff;border-radius:18px;box-shadow:0 30px 90px rgba(0,0,0,.35);display:flex;flex-direction:column}
.te-refwiki-infomodal-head{padding:12px 14px;border-bottom:1px solid rgba(255,255,255,.10);background:#111;color:#fff}
.te-refwiki-infomodal-headgrid{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:10px}
.te-refwiki-infomodal-title{font-family:Cinzel,serif;font-weight:800;font-size:16px;color:#fff}
.te-refwiki-infomodal-brand img{height:28px;width:auto;display:block;opacity:.95}
.te-refwiki-infomodal-close{border:0;background:transparent;font-size:26px;line-height:1;cursor:pointer;padding:0 6px;color:#fff}
.te-refwiki-infomodal-tabs{display:flex;gap:8px;padding:0 14px 10px}
.te-refwiki-infomodal-tab{all:unset;box-sizing:border-box;border:1px solid rgba(0,0,0,.16);background:#fff;border-radius:10px;padding:6px 10px;font-family:Cinzel,serif;font-weight:700;font-size:12px;cursor:pointer;color:#111;display:inline-flex;align-items:center;justify-content:center;line-height:1}
.te-refwiki-infomodal-tab.is-active{background:linear-gradient(90deg, rgba(216,178,92,1), rgba(201,162,39,1), rgba(176,132,23,1));border-color:rgba(0,0,0,.12);color:#111}
.te-refwiki-infomodal-body{padding:12px 14px;overflow:auto}
.te-refwiki-info-media{display:flex;gap:10px;align-items:stretch;margin:2px 0 12px}
.te-refwiki-info-cover{flex:0 0 160px;aspect-ratio:4/5;border-radius:14px;overflow:hidden;background:#f2f2f2;border:1px solid rgba(0,0,0,.12)}
.te-refwiki-info-cover img{width:100%;height:100%;object-fit:cover;display:block}
.te-refwiki-info-author{flex:0 0 120px;aspect-ratio:1/1;border-radius:14px;overflow:hidden;background:#f2f2f2;border:1px solid rgba(0,0,0,.12)}
.te-refwiki-info-author img{width:100%;height:100%;object-fit:cover;display:block}
@media (max-width:520px){.te-refwiki-info-cover{flex-basis:140px}.te-refwiki-info-author{flex-basis:96px}}
.te-refwiki-info-grid{display:grid;grid-template-columns:1fr;gap:10px}
.te-refwiki-info-row{display:grid;grid-template-columns:160px 1fr;gap:10px;align-items:start}
.te-refwiki-info-k{font-weight:800;font-family:Cinzel,serif;font-size:12px;opacity:.85}
.te-refwiki-info-v{font-family:"Times New Roman",Times,serif;font-size:15px;line-height:1.5;overflow-wrap:anywhere}
@media (max-width: 520px){.te-refwiki-info-row{grid-template-columns:1fr}.te-refwiki-info-k{margin-bottom:-6px}}
.te-refwiki-usedhint{font-family:Cinzel,serif;font-size:12px;font-weight:800;opacity:.8;margin:0 0 6px}
.te-refwiki-usedul{margin:0;padding-left:18px}
.te-refwiki-usedul li{margin:6px 0;font-family:"Times New Roman",Times,serif}
.te-refwiki-usedul a{text-decoration:none}
.te-refwiki-infomodal-back.te-refwiki-open{display:flex}

/* WP Dark Mode compatibility: keep our modal readable and prevent overlay artifacts */
html.wp-dark-mode-active .te-refwiki-infomodal-back,
html.wp-dark-mode-active .te-refwiki-infomodal,
html.wp-dark-mode-active .te-refwiki-infomodal *{
  filter:none!important;
  mix-blend-mode:normal!important;
}

/* Mobile panel width 75% with left gap for closing */
@media (max-width: 780px) {
  .te-refwiki-panel { width: 75vw; min-width: unset; max-width: unset; }
  .te-refwiki-ui { top: 24%; }
  /* smaller tab on mobile */
  .te-refwiki-tab { height: 76px; width: 24px; border-radius: 10px 0 0 10px; }
  .te-refwiki-tab-text { font-size: 9px; transform: rotate(-90deg); left: -16px; color: #fff !important; opacity: 1 !important; visibility: visible !important; }
  .te-refwiki-item { font-size: 15px; }
}

/* Desktop: move the tab to the right-bottom (but not too low) */
@media (min-width: 781px) {
  .te-refwiki-ui { top: auto; bottom: 120px; }
  /* allow scrolling the page even when panel is open (no scroll-blocking overlay on desktop) */
  .te-refwiki-backdrop{display:none;pointer-events:auto;position:fixed;inset:0;background:rgba(0,0,0,.28);opacity:0;visibility:hidden;transition:opacity .16s ease,visibility .16s ease;z-index:1000000}
}

/* Editor modal tweaks (only inside wp-admin) */
body.wp-admin .te-refwiki-admin-note {
  font-family: "Times New Roman", Times, serif;
  font-size: 13px;
  opacity: .8;
}

/* Gutenberg Modal: keep it visible + scrollable, and avoid conflicts with front-end modal class names */
body.wp-admin .components-modal__frame.te-refwiki-editor-modal{
  width:min(920px,96vw);
  max-height:88vh;
}
body.wp-admin .components-modal__frame.te-refwiki-editor-modal .components-modal__content{
  max-height:calc(88vh - 110px);
  overflow:auto;
}
body.wp-admin .components-modal__frame.te-refwiki-editor-modal .te-refwiki-pane{
  max-height:calc(88vh - 170px);
  overflow:auto;
  padding-right:2px;
}
@media(max-width:780px){
  body.wp-admin .components-modal__frame.te-refwiki-editor-modal{max-height:84vh;}
  body.wp-admin .components-modal__frame.te-refwiki-editor-modal .components-modal__content{max-height:calc(84vh - 110px);}
  body.wp-admin .components-modal__frame.te-refwiki-editor-modal .te-refwiki-pane{max-height:calc(84vh - 170px);}
}

.te-refwiki-empty{font-family:"Times New Roman",Times,serif;opacity:.85;padding:8px 10px;border:1px dashed rgba(0,0,0,.18);border-radius:12px;background:rgba(0,0,0,.02)}

/* Editor helper: highlight selected citation marker */
.te-refwiki-cite.is-selected{ outline:2px solid var(--te-refwiki-gold,#d4af37); outline-offset:2px; border-radius:6px; }


/* Jump highlight */
.te-refwiki-highlight{outline:2px solid var(--te-refwiki-gold,#c9a227);outline-offset:4px;border-radius:6px;}


/* Used in articles list (with thumbnails) */
.te-refwiki-usedul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;}
.te-refwiki-usedul li a{display:flex;align-items:center;gap:10px;text-decoration:none;}
.te-refwiki-usedthumb{width:36px;height:36px;border-radius:8px;flex:0 0 36px;background-size:cover;background-position:center;background-color:rgba(255,255,255,.08);box-shadow:0 0 0 1px rgba(255,255,255,.08) inset;}
.te-refwiki-usedthumb.is-empty{background-image:linear-gradient(135deg,rgba(255,255,255,.08),rgba(0,0,0,.08));}
.te-refwiki-usedtitle{display:inline-block;line-height:1.2;}
