/* Pagina del Quaderno di viaggio: struttura dell'area di lavoro, comandi e
   regole di stampa. Il disegno del documento sta in guide-book-style.js. */

#guidePage {
  background: #e9e2d5;
  min-height: 100vh;
  padding: 0 0 60px;
}
#guidePage[hidden] { display: none !important; }

.gb-page-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}
.gb-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.gb-page-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #8a7f6a;
}
.gb-page-titles h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(26px, 6vw, 38px);
  color: #1c1a17;
}
.gb-page-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  background: #e9e2d5;
  border-bottom: 1px solid #d3c8b3;
}
.gb-page-toolbar .button { min-height: 44px; }
.gb-page-status {
  font-size: 13px;
  color: #5c5344;
  flex: 1 1 180px;
}
.gb-page-hint {
  margin: 8px 0 18px;
  font-size: 12.5px;
  color: #7a7161;
}
.gb-page-hint[hidden] { display: none; }

.gb-page-body { display: block; }

/* ── Scelta del luogo ────────────────────────────────────────── */
.gb-picker {
  background: #faf6ee;
  border: 1px solid #ddd2bd;
  padding: 22px 20px;
}
.gb-picker h2 {
  margin: 0 0 6px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 22px;
  color: #1c1a17;
}
.gb-picker-hint {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: #6d6455;
}
.gb-field { display: block; margin-bottom: 16px; }
.gb-field span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a7f6a;
  margin-bottom: 6px;
}
.gb-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 16px;
  color: #1c1a17;
  background: #fff;
  border: 1px solid #cfc3ac;
  border-radius: 0;
}
.gb-field input:focus { outline: 2px solid #a8451f; outline-offset: 1px; }
.gb-results { list-style: none; margin: 0; padding: 0; }
.gb-results li { border-top: 1px solid #e2d9c7; }
.gb-results li:first-child { border-top: 2px solid #1c1a17; }
.gb-results button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 12px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #1c1a17;
}
.gb-results button:hover, .gb-results button:focus-visible { background: #f2ebdf; }
.gb-results strong { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 17px; }
.gb-results span { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #7d735f; }
.gb-empty { padding: 16px 4px; font-size: 14px; color: #6d6455; }

/* ── Stati di attesa ed errore ───────────────────────────────── */
.gb-loading { padding: 30px 0; }
.gb-loading-line {
  display: block;
  height: 14px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #ded4c1 25%, #eee7d8 50%, #ded4c1 75%);
  background-size: 200% 100%;
  animation: gb-shimmer 1.4s linear infinite;
}
.gb-loading-line:nth-child(2) { width: 82%; }
.gb-loading-line:nth-child(3) { width: 68%; }
.gb-loading-line:nth-child(4) { width: 74%; }
@keyframes gb-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.gb-error {
  background: #faf6ee;
  border: 1px solid #ddd2bd;
  padding: 24px 20px;
  text-align: center;
}
.gb-error p { margin: 0 0 14px; color: #4a443c; }

/* ── I miei quaderni ─────────────────────────────────────────── */
.gb-library {
  background: #faf6ee;
  border: 1px solid #ddd2bd;
  padding: 22px 20px;
}
.gb-library-head { margin-bottom: 16px; }
.gb-library-head h2 {
  margin: 0 0 6px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 22px;
  color: #1c1a17;
}
.gb-library-head p { margin: 0; font-size: 13.5px; color: #6d6455; }
.gb-library-empty { margin: 0 0 18px; font-size: 14px; color: #6d6455; }
.gb-saved-list { list-style: none; margin: 0 0 18px; padding: 0; }
.gb-saved { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid #e2d9c7; }
.gb-saved:first-child { border-top: 2px solid #1c1a17; }
.gb-saved-main { display: grid; gap: 3px; }
.gb-saved-main strong {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
  color: #1c1a17;
}
.gb-saved-where { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #7d735f; }
.gb-saved-date { font-size: 12px; color: #8a7f6a; }
.gb-saved-actions, .gb-library-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gb-saved-actions .button, .gb-library-actions .button { min-height: 44px; }
.gb-page-toolbar [data-gb-save][data-saved="1"] {
  border-color: #28724e;
  color: #1f5c3f;
  background: #eaf4ee;
}

/* ── Il quaderno dentro l'app ────────────────────────────────── */
.gb-paper {
  border: 1px solid #ded4c1;
  box-shadow: 0 18px 40px rgba(28, 26, 23, 0.14);
}
.gb-paper .gb-sheet { padding-top: 22px; }

@media (max-width: 520px) {
  .gb-page-shell { padding: 16px 12px 32px; }
  .gb-page-head { flex-direction: column; align-items: flex-start; }
  .gb-page-toolbar { gap: 8px; }
  .gb-page-toolbar .button { flex: 1 1 auto; }
  .gb-saved-actions .button, .gb-library-actions .button { flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .gb-loading-line { animation: none; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  html, body { background: #fff !important; }
  body > .app-shell > *:not(#guidePage) { display: none !important; }
  #guidePage {
    display: block !important;
    position: static !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  .gb-page-shell { max-width: none; padding: 0; margin: 0; }
  .gb-page-head, .gb-page-toolbar, .gb-page-hint, .gb-loading, .gb-error, .gb-picker, .gb-library { display: none !important; }
  .gb-page-body { padding: 0 !important; }
  .gb-paper { border: 0 !important; box-shadow: none !important; }
}
