/* =========================================================
   station2Notebook.css
   "פנקס הסוחר" (תחנה 2), הודעת מעבר קצרה בין שלביה, ומגילת הפתיחה
   של "קולות מן השוק". לא נוגע בעיצוב תחנה 1/הסרגל העליון/תיק המסע.
   ========================================================= */

/* ===================== כפתור הפתיחה הצף ===================== */
/* גלוי רק כששלב תחנה 2 הרלוונטי מוצג כרגע - נשלט כולו כאן ב-CSS,
   בלי לגעת בלוגיקת המעברים של station2Journey.js/station2Guild.js. */

.notebook-toggle-btn {
  display: none;
  position: fixed;
  z-index: 850;
  left: clamp(10px, 1.6vw, 20px);
  bottom: clamp(10px, 1.6vh, 20px);
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: var(--font-heading);
  font-size: clamp(0.8rem, 0.95vw, 0.92rem);
  font-weight: 700;
  color: var(--color-gold);
  background: linear-gradient(160deg, #3a2c18 0%, #201709 100%);
  border: 1.5px solid rgba(216, 164, 91, 0.6);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.notebook-toggle-btn:hover,
.notebook-toggle-btn:focus-visible {
  border-color: var(--color-gold);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 14px rgba(232, 194, 122, 0.45);
  outline: none;
}

.notebook-toggle-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* ----- תג "רמז חדש" - מופיע מרגע שעמוד חשבון הסוחר נפתח, עד שנצפה ----- */

.notebook-toggle-badge[hidden] {
  display: none;
}

.notebook-toggle-badge {
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(232, 194, 122, 0.9);
  color: #241b10;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

/* ----- פעימה עדינה (מלווה את רמז 1 במנעול, מכוונת אל הפנקס) ----- */

.notebook-toggle-btn.notebook-toggle-pulse {
  animation: notebookTogglePulse 1000ms ease;
}

@keyframes notebookTogglePulse {
  0%,
  100% {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 0 rgba(232, 194, 122, 0);
  }
  40% {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 22px 6px rgba(232, 194, 122, 0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .notebook-toggle-btn.notebook-toggle-pulse {
    animation: none !important;
  }
}

body:has(#screen-station2-voices:not([hidden])) .notebook-toggle-btn,
body:has(#screen-station2-lock:not([hidden])) .notebook-toggle-btn,
body:has(#screen-station2-bundle:not([hidden])) .notebook-toggle-btn {
  display: flex;
}

/* ===================== הפנקס עצמו ===================== */

.merchant-notebook-overlay[hidden] {
  display: none;
}

.merchant-notebook-overlay:not([hidden]) {
  position: fixed;
  inset: 0;
  /* *** קריטי: חייב להיות נמוך מ-.modal-overlay/.seal-lightbox-overlay
     (z-index:1000) - אחרת חלונות מערכת קריטיים (למשל "אישור התחלה
     מחדש") שנפתחים מעל הפנקס הפתוח נחסמים ללחיצה, גם אם חזותית
     נראים "מעל". נבדק בפועל וזה בדיוק מה שקרה לפני התיקון. *** */
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
}

.merchant-notebook-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 3, 0.65);
}

.merchant-notebook-card {
  position: relative;
  width: min(560px, 90vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 26px 26px;
  border-radius: 10px;
  /* עור עתיק + דפי קלף + מסגרת ברונזה עדינה */
  background: linear-gradient(160deg, #5a4227 0%, #3c2c17 45%, #2a1f10 100%);
  border: 3px solid rgba(169, 102, 47, 0.65);
  outline: 1px solid rgba(232, 194, 122, 0.22);
  outline-offset: -9px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 2px 0 rgba(255, 255, 255, 0.05);
}

.merchant-notebook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.merchant-notebook-title {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--color-gold);
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.merchant-notebook-close {
  background: none;
  border: none;
  color: var(--color-parchment);
  font-size: 1.05rem;
  line-height: 1;
  padding: 6px;
  cursor: pointer;
}

.merchant-notebook-close:hover {
  color: var(--color-gold);
}

.merchant-notebook-rows,
.notebook-verse-order,
.notebook-count-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px 14px 16px;
  /* דפי קלף - רקע בהיר יחסית לעומת המסגרת, עם שורות חרוטות עדינות */
  background: repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.05) 0px,
      rgba(0, 0, 0, 0.05) 1px,
      transparent 1px,
      transparent 44px
    ),
    linear-gradient(160deg, #d8c396 0%, #c9b077 100%);
  border-radius: 6px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.35);
}

.merchant-notebook-rows {
  padding: 4px 4px 2px;
}

/* ===================== לשוניות: "סדר הפסוק" / "חשבון הסוחר" ===================== */

.merchant-notebook-tabs[hidden] {
  display: none;
}

.merchant-notebook-tabs {
  display: flex;
  gap: 6px;
}

.merchant-notebook-tab {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1vw, 0.94rem);
  font-weight: 700;
  color: var(--color-parchment-dim);
  background: rgba(0, 0, 0, 0.22);
  border: 1.5px solid rgba(90, 66, 39, 0.4);
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.merchant-notebook-tab.is-active {
  color: var(--color-gold);
  background: rgba(216, 164, 91, 0.22);
  border-color: rgba(216, 164, 91, 0.6);
}

.merchant-notebook-tab[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.notebook-tab-lock-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* הצוהר נעלם ברגע שהלשונית משוחררת (disabled מוסר ב-JS עם unlockCountTab). */
.merchant-notebook-tab:not([disabled]) .notebook-tab-lock-icon {
  display: none;
}

.notebook-tab-stamp[hidden] {
  display: none;
}

.notebook-tab-stamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6b1f1f 0%, #3d0f0f 75%);
  opacity: 0.85;
}

.notebook-tab-stamp.notebook-tab-stamp-in {
  animation: notebookStampIn 420ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
  .notebook-tab-stamp.notebook-tab-stamp-in {
    animation: none !important;
  }
}

/* ===================== שורה בודדת ===================== */

.notebook-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(90, 66, 39, 0.3);
}

.notebook-row:last-child {
  border-bottom: none;
}

.notebook-row-name {
  font-family: var(--font-heading);
  font-size: clamp(0.95rem, 1.2vw, 1.08rem);
  color: #2a1e10;
}

.notebook-row.is-locked .notebook-row-name {
  color: rgba(42, 30, 16, 0.4);
  font-style: italic;
}

.notebook-row.is-locked {
  opacity: 0.55;
}


/* ----- חותמת דיו קטנה, מוצגת עם אנימציה קצרה כשהשורה נחשפת ----- */

.notebook-row-stamp {
  position: absolute;
  left: 8px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%) scale(0);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6b1f1f 0%, #3d0f0f 75%);
  opacity: 0;
  pointer-events: none;
}

.notebook-row.is-unlocked .notebook-row-stamp {
  opacity: 0.85;
  transform: translateY(-50%) scale(1);
}

.notebook-row.notebook-row-stamping .notebook-row-stamp {
  animation: notebookStampIn 420ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes notebookStampIn {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(2.4) rotate(-12deg);
  }
  60% {
    opacity: 0.95;
    transform: translateY(-50%) scale(0.9) rotate(-4deg);
  }
  100% {
    opacity: 0.85;
    transform: translateY(-50%) scale(1) rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .notebook-row.notebook-row-stamping .notebook-row-stamp {
    animation: none !important;
  }
}

/* ===================== חידת "סדר הפסוק" (בתוך הפנקס) ===================== */

.notebook-verse-order[hidden] {
  display: none;
}

.notebook-verse-order {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.notebook-verse-instruction {
  margin: 0;
  text-align: center;
  font-family: var(--font-heading);
  color: #3a2a16;
  font-size: clamp(0.9rem, 1.1vw, 1rem);
  line-height: 1.55;
}

.notebook-verse-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.notebook-verse-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1.5px dashed rgba(90, 66, 39, 0.55);
  background: rgba(90, 66, 39, 0.08);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.notebook-verse-slot.is-filled {
  border-style: solid;
  border-color: rgba(90, 66, 39, 0.65);
  background: rgba(216, 164, 91, 0.18);
  cursor: default;
}

.notebook-verse-slot-number {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(90, 66, 39, 0.75);
  color: #e9dcb9;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
}

.notebook-verse-slot-text {
  font-family: var(--font-heading);
  font-size: clamp(0.9rem, 1.1vw, 1rem);
  color: #2a1e10;
}

.notebook-verse-slot.notebook-verse-lock-anim {
  animation: notebookVerseLockFlash 550ms ease;
}

@keyframes notebookVerseLockFlash {
  0% {
    box-shadow: 0 0 0 rgba(232, 194, 122, 0);
  }
  45% {
    box-shadow: 0 0 16px 4px rgba(232, 194, 122, 0.75);
  }
  100% {
    box-shadow: 0 0 0 rgba(232, 194, 122, 0);
  }
}

/* לאחר פתרון החידה - זוהר זהוב עדין על כל לוחיות הפסוק יחד. */
.notebook-verse-slots.is-solved .notebook-verse-slot-text {
  color: #6a441c;
  text-shadow: 0 0 8px rgba(232, 194, 122, 0.85);
}

@media (prefers-reduced-motion: reduce) {
  .notebook-verse-slot.notebook-verse-lock-anim {
    animation: none !important;
  }
}

.notebook-verse-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
}

.notebook-verse-plaque {
  padding: 8px 16px;
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 1.05vw, 0.96rem);
  color: #e9dcb9;
  background: linear-gradient(160deg, #4a3319 0%, #2c1f10 100%);
  border: 1.5px solid rgba(216, 164, 91, 0.6);
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.notebook-verse-plaque:focus-visible {
  outline: 2px solid rgba(232, 194, 122, 0.85);
  outline-offset: 3px;
}

.notebook-verse-plaque.is-selected {
  box-shadow: 0 0 12px rgba(232, 194, 122, 0.75);
  border-color: var(--color-gold);
}

.notebook-verse-plaque.is-dragging-placeholder {
  opacity: 0.28;
}

.notebook-verse-drag-clone {
  position: fixed;
  z-index: 3200;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 1.05vw, 0.96rem);
  color: #e9dcb9;
  background: linear-gradient(160deg, #4a3319 0%, #2c1f10 100%);
  border: 1.5px solid rgba(232, 194, 122, 0.75);
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.notebook-verse-feedback[hidden] {
  display: none;
}

.notebook-verse-feedback {
  margin: 0;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.85rem, 1.02vw, 0.94rem);
  color: #5a3d1c;
}

/* ===================== עמוד "חשבון הסוחר" (המפתח לקוד המנעול) ===================== */

.notebook-count-unlock-message[hidden] {
  display: none;
}

.notebook-count-unlock-message {
  margin: 0;
  text-align: center;
  font-family: var(--font-heading);
  color: #6a441c;
  font-size: clamp(0.85rem, 1.02vw, 0.96rem);
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(232, 194, 122, 0.35);
}

.notebook-count-poem {
  margin: 0;
  text-align: center;
  font-family: var(--font-heading);
  color: #2a1e10;
  font-size: clamp(0.88rem, 1.08vw, 1rem);
  line-height: 1.7;
}

.notebook-count-slots {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.notebook-count-slot {
  position: relative;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1.5px dashed rgba(90, 66, 39, 0.5);
  background: rgba(90, 66, 39, 0.08);
}

.notebook-count-slot-label {
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1vw, 0.92rem);
  color: #3a2a16;
}

/* רמז חזותי עדין: "+1" ליד ענף עץ עבות (ההדס) - בלי לחשוף ספרה. */
.notebook-count-plus-mark {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(232, 194, 122, 0.85);
  color: #2a1e10;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
}

/* חמש חריטות משותפות מתחת לשני המקומות האחרונים (ענף עץ עבות +
   ערבי נחל) - רומזות ששני המינים האלה יחד הם "חמישה", בלי לפרק
   את הכמות לכל מין בנפרד. */
.notebook-count-shared-notches {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: -4px;
}

.notebook-count-notch {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: rgba(90, 66, 39, 0.55);
}

/* ===================== קישור פתיחת הפנקס במסכי תחנה 2 ===================== */

.order-notebook-link,
.lock-notebook-link {
  padding: 6px 16px;
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 0.95vw, 0.9rem);
  color: var(--color-bronze-light);
  background: transparent;
  border: 1px solid rgba(216, 164, 91, 0.5);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.order-notebook-link:hover,
.order-notebook-link:focus-visible,
.lock-notebook-link:hover,
.lock-notebook-link:focus-visible {
  border-color: var(--color-gold);
  color: var(--color-gold);
  outline: none;
}

/* ===================== מגילת הפתיחה של "קולות מן השוק" ===================== */

.voices-intro-scroll[hidden] {
  display: none;
}

.voices-intro-scroll {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 28px 34px;
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(44, 36, 22, 0.96) 0%, rgba(20, 15, 9, 0.97) 100%);
  border: 2px solid rgba(216, 164, 91, 0.6);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.voices-intro-scroll p {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--color-gold);
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  line-height: 1.75;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ===================== הודעת מעבר קצרה בין שלבי תחנה 2 ===================== */

.station-transition-toast[hidden] {
  display: none;
}

.station-transition-toast {
  position: fixed;
  z-index: 950;
  left: 50%;
  top: clamp(78px, 11vh, 96px);
  transform: translateX(-50%) translateY(-6px);
  margin: 0;
  padding: 9px 26px;
  font-family: var(--font-heading);
  font-size: clamp(0.92rem, 1.15vw, 1.05rem);
  color: var(--color-gold);
  background: rgba(6, 5, 3, 0.78);
  border: 1px solid rgba(216, 164, 91, 0.55);
  border-radius: 8px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 400ms ease, transform 400ms ease;
  pointer-events: none;
}

.station-transition-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .station-transition-toast {
    transition: opacity 1ms linear !important;
  }
}
