/* === Button === */
.holocron-btn {
  appearance: none;
  border: 1px solid rgba(120, 220, 255, 0.55);
  color: rgba(190, 245, 255, 0.9);
  background: rgba(10, 25, 35, 0.35);
  padding: 10px 16px;
  border-radius: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.2) inset,
    0 0 24px rgba(70, 200, 255, 0.08);
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}

.holocron-btn:hover {
  background: rgba(10, 25, 35, 0.5);
  box-shadow: 0 0 30px rgba(70, 200, 255, 0.14);
}

.holocron-btn:active {
  transform: translateY(1px);
}

/* === Modal === */
.holocron-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.holocron-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.holocron-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(2px);
}

.holocron-modal__panel {
  position: relative;
  width: min(980px, calc(100vw - 28px));
  height: min(680px, calc(100vh - 28px));
  margin: auto;           /* centrage vertical + horizontal */
  border: 1px solid rgba(120, 220, 255, 0.35);
  background: radial-gradient(1200px 600px at 30% 20%, rgba(40, 160, 200, 0.10), transparent 60%),
              linear-gradient(180deg, rgba(8, 18, 26, 0.92), rgba(8, 14, 20, 0.92));
  box-shadow: 0 18px 60px rgba(0,0,0,0.55), 0 0 40px rgba(70, 200, 255, 0.12);
  border-radius: 10px;
  overflow: hidden;
}

/* Scanlines / noise */
.holocron-modal__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 6px
    );
  mix-blend-mode: overlay;
  opacity: 0.35;
}

.holocron-modal__topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(120, 220, 255, 0.18);
}

.holocron-modal__title {
  color: rgba(190, 245, 255, 0.9);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 12px;
}

.holocron-icon-btn {
  appearance: none;
  border: 1px solid rgba(120, 220, 255, 0.25);
  background: rgba(10, 25, 35, 0.25);
  color: rgba(190, 245, 255, 0.9);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.holocron-modal__content {
  position: relative;
  height: calc(100% - 57px);
}

.holocron-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100%;
}

/* === Sidebar list === */
.holocron-side {
  border-right: 1px solid rgba(120, 220, 255, 0.12);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.holocron-side__header {
  display: flex;
  justify-content: flex-end;
}

.holocron-side__list {
  overflow: auto;
  padding-right: 4px;
}

.holocron-item {
  border: 1px solid rgba(120, 220, 255, 0.18);
  background: rgba(10, 25, 35, 0.22);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.holocron-item:hover {
  background: rgba(10, 25, 35, 0.35);
  border-color: rgba(120, 220, 255, 0.32);
}

.holocron-item.is-active {
  border-color: rgba(120, 220, 255, 0.55);
  box-shadow: 0 0 22px rgba(70, 200, 255, 0.12);
}

.holocron-item__title {
  color: rgba(210, 250, 255, 0.92);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.holocron-item__meta {
  color: rgba(190, 245, 255, 0.55);
  font-size: 11px;
}

/* === Main === */
.holocron-main {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.holocron-main__header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.holocron-main__header .holocron-input {
  flex: 1;
  min-width: 120px;
}

.holocron-main__actions {
  display: flex;
  gap: 8px;
}

.holocron-input {
  width: 100%;
  border: 1px solid rgba(120, 220, 255, 0.20);
  background: rgba(10, 25, 35, 0.25);
  color: rgba(220, 255, 255, 0.92);
  padding: 10px 10px;
  border-radius: 10px;
  outline: none;
}

.holocron-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.holocron-textarea {
  width: 100%;
  height: 100%;
  resize: none;
  border: 1px solid rgba(120, 220, 255, 0.20);
  border-radius: 10px;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.03), transparent 40%),
    repeating-linear-gradient(to bottom, rgba(120,220,255,0.07) 0px, rgba(120,220,255,0.07) 1px, transparent 1px, transparent 26px),
    rgba(10, 25, 35, 0.22);
  color: rgba(230, 255, 255, 0.92);
  padding: 12px;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 26px; /* aligne sur les "lignes" */
}

.holocron-action-btn,
.holocron-danger-btn {
  appearance: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 11px;
}

.holocron-action-btn {
  border: 1px solid rgba(120, 220, 255, 0.25);
  background: rgba(10, 25, 35, 0.25);
  color: rgba(210, 250, 255, 0.9);
}

.holocron-danger-btn {
  border: 1px solid rgba(255, 120, 120, 0.25);
  background: rgba(40, 10, 10, 0.25);
  color: rgba(255, 200, 200, 0.92);
}

.holocron-muted {
  color: rgba(190, 245, 255, 0.55);
  font-size: 12px;
}

.holocron-status {
  min-height: 18px;
  color: rgba(190, 245, 255, 0.65);
  font-size: 12px;
}

.holocron-footnote {
  color: rgba(190, 245, 255, 0.45);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* === Embed mode (dans une popup externe / hp_modal) === */
.holocron-notes-embed{
  width: 100%;
  height: 100%;
}
.holocron-notes-embed .holocron-grid{
  height: 100%;
  min-height: 520px; /* évite l'écrasement dans les colonnes Gutenberg */
}
@media (max-width: 860px){
  .holocron-notes-embed .holocron-grid{
    grid-template-columns: 1fr;
  }
  .holocron-notes-embed .holocron-side{
    max-height: 220px;
  }
}

/* =========================================================
   Gutenberg — boutons centrés en bas + boot impérial en cascade
   (CSS only, compatible Holocron / Holovid / futur bouton)
   ========================================================= */

/* Wrapper Holocron : bouton (⚠️ PAS en embed) */
.wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed){
  display:flex;
  justify-content:center;
  align-items:flex-end;
  height:100%;
  min-height:120px;
}
.wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed) .holocron-btn{
  margin-bottom:8px;
}

/* Délais par colonne Gutenberg (ordre gauche → droite) */
.wp-block-columns > .wp-block-column:nth-child(1) { --imp-delay: 120ms; }
.wp-block-columns > .wp-block-column:nth-child(2) { --imp-delay: 520ms; }
.wp-block-columns > .wp-block-column:nth-child(3) { --imp-delay: 920ms; }

/* Neutralise l'ancien boot Holocron */
.holocron-notes-wrapper .holocron-btn {
  animation: none;
  opacity: 1;
  transform: none;
  filter: none;
}

/* Boot impérial commun
   - Holocron : .holocron-btn
   - Holovid  : .hv-trigger
   - 3e plugin: ajouter sa classe ici
*/
.wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed) .holocron-btn,
.wp-block-columns .hv-trigger,
.wp-block-columns .fdci-btn {
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  filter: blur(0.6px);
  animation: impBoot 700ms ease-out var(--imp-delay, 400ms) forwards;
  will-change: opacity, transform, filter;
}

/* Scanline impériale */
.wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed) .holocron-btn::after,
.wp-block-columns .hv-trigger::after,
.wp-block-columns .fdci-btn::after {
  content: "";
  position: absolute;
  left: -15%;
  top: -40%;
  width: 130%;
  height: 55%;
  background: linear-gradient(
    to bottom,
    rgba(120, 220, 255, 0) 0%,
    rgba(120, 220, 255, 0.18) 45%,
    rgba(120, 220, 255, 0.06) 55%,
    rgba(120, 220, 255, 0) 100%
  );
  transform: rotate(-8deg) translateY(-40px);
  opacity: 0;
  pointer-events: none;
  animation: impScan 900ms ease-out calc(var(--imp-delay, 400ms) + 120ms) forwards;
}

/* Keyframes */
@keyframes impBoot {
  0%   { opacity: 0;   transform: translateY(10px); filter: blur(1px); }
  60%  { opacity: .85; transform: translateY(2px);  filter: blur(.2px); }
  100% { opacity: 1;   transform: translateY(0);    filter: blur(0); }
}

@keyframes impScan {
  0%   { opacity: 0;   transform: rotate(-8deg) translateY(-55px); }
  20%  { opacity: .9; }
  100% { opacity: 0;   transform: rotate(-8deg) translateY(80px); }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  .wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed) .holocron-btn,
  .wp-block-columns .hv-trigger,
  .wp-block-columns .fdci-btn {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed) .holocron-btn::after,
  .wp-block-columns .hv-trigger::after,
  .wp-block-columns .fdci-btn::after {
    animation: none !important;
    opacity: 0 !important;
  }
}

/* === Alignement bouton Code d'identité dans colonnes Gutenberg === */
.wp-block-columns .fdci-btn {
  display: block;
  margin: 0 auto 8px;
}


/* =====================================================
   ALIGNEMENT BOUTONS — fix précis
   Le .wp-block-columns parent doit avoir align-items:flex-end
   pour que tous les boutons soient au même niveau bas.
   On cible via les enfants connus.
   ===================================================== */

/* Force toutes les colonnes contenant nos boutons à s'aligner en bas */
.wp-block-columns:has(> .wp-block-column .holocron-btn,
                      > .wp-block-column .fdci-btn,
                      > .wp-block-column .hv-trigger) {
  align-items: flex-end !important;
}

/* Supprime le min-height du wrapper qui créait le décalage */
.wp-block-columns .holocron-notes-wrapper:not(.holocron-notes-embed) {
  min-height: 0 !important;
  height: auto !important;
  display: flex;
  justify-content: center;
}

/* Les boutons s'alignent tous à la même baseline */
.wp-block-columns .holocron-btn,
.wp-block-columns .fdci-btn,
.wp-block-columns .hv-trigger {
  min-width: 160px;
  text-align: center;
}
