/* ============================================================
   madushka.com — Tour Itinerary & Package PDF Builder
   Left: glass form. Right: live A4 preview (always light /
   print-styled). Print styles output the document alone.
   ============================================================ */

.itb-container { width: min(1400px, 96%); }

.itb-layout {
  display: grid;
  grid-template-columns: minmax(360px, 520px) 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 1023px) {
  .itb-layout { grid-template-columns: 1fr; }
}

/* ---------- Form column ---------- */
.itb-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.itb-sec { border-radius: var(--radius-lg); overflow: hidden; }
.itb-sec > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
  user-select: none;
}
.itb-sec > summary::-webkit-details-marker { display: none; }
.itb-sec-num {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.itb-chev { width: 18px; height: 18px; margin-left: auto; color: var(--text-soft); transition: transform .25s; }
.itb-sec[open] .itb-chev { transform: rotate(180deg); }
.itb-sec-body { padding: 4px 18px 18px; border-top: 1px solid var(--divider); }

.itb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.itb-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.itb-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) {
  .itb-grid3, .itb-grid4 { grid-template-columns: 1fr 1fr; }
}

.itb-field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; min-width: 0; }
.itb-field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text-soft);
}
.itb-field input,
.itb-field select,
.itb-field textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--divider);
  background: var(--glass-fill-soft);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.itb-field textarea { resize: vertical; line-height: 1.5; }
.itb-field input:focus,
.itb-field select:focus,
.itb-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, .18);
}
html.dark .itb-field input,
html.dark .itb-field select,
html.dark .itb-field textarea { background: rgba(255, 255, 255, .05); }
html.dark .itb-field input::-webkit-calendar-picker-indicator { filter: invert(1); }

.itb-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 9px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.itb-check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; flex: none; }
.itb-toggle-row { margin-top: 14px; }

.itb-subblock {
  margin: 4px 0 10px;
  padding: 4px 14px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--accent-grad-soft);
}

.itb-sub-label {
  margin: 16px 0 2px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.itb-hint { font-size: 12.5px; color: var(--text-soft); margin: 6px 0; }

.itb-import-banner {
  display: block;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  border: 1px solid var(--glass-border);
  background: var(--accent-grad-soft);
}
.itb-import-banner[hidden] { display: none !important; }
.itb-import-banner a { color: var(--accent); font-weight: 700; }
.itb-book-cta {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.itb-book-cta p { margin: 0; font-size: 13.5px; color: var(--text-soft); max-width: 420px; }

.itb-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
}
.itb-add-btn:hover { transform: translateY(-1px); box-shadow: var(--glass-shadow); }
.itb-add-btn.itb-danger { color: #ff453a; border-color: rgba(255, 69, 58, .4); }

/* Repeatable blocks (hotels, days, custom lines) */
.itb-block {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--divider);
  background: var(--glass-fill-soft);
}
.itb-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.itb-block-head strong { font-size: 13.5px; font-weight: 800; color: var(--text); }
.itb-remove {
  border: none;
  background: transparent;
  color: #ff453a;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.itb-remove:hover { background: rgba(255, 69, 58, .12); }

.itb-meals { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.itb-meals .itb-check { margin: 0; font-size: 13px; }

.itb-custom-line { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.itb-custom-line input { flex: 1; }

.itb-logo-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.itb-logo-row img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--divider);
  background: #fff;
  padding: 4px;
}
.itb-logo-row img.itb-logo-none { opacity: .25; filter: grayscale(1); }
.itb-logo-actions { display: flex; flex-direction: column; gap: 6px; }

.itb-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px;
  flex-wrap: wrap;
}

/* ---------- Preview column ---------- */
.itb-preview-panel {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  min-width: 0;
}
@media (max-width: 1023px) {
  .itb-preview-panel { position: static; margin-top: 8px; }
}

.itb-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
}
.itb-toolbar .btn { padding: 10px 22px; font-size: 14px; }
.itb-toolbar-note { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }

.itb-doc-frame {
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  background: rgba(120, 130, 160, .12);
  padding: 18px;
  overflow: auto;
  max-height: calc(100vh - var(--nav-h) - 130px);
}
html.dark .itb-doc-frame { background: rgba(0, 0, 0, .3); }
@media (max-width: 1023px) {
  .itb-doc-frame { max-height: none; }
}

.itb-doc-scale { transform-origin: top left; }

/* ============================================================
   THE DOCUMENT — always light, print-friendly, A4 (794px @96dpi)
   ============================================================ */
.doc-page {
  width: 794px;
  min-height: 1123px;
  margin: 0 auto;
  background: #ffffff;
  color: #1d1d1f;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 40px 44px 48px;
  box-shadow: 0 10px 40px rgba(20, 30, 70, .25);
  box-sizing: border-box;
}

.doc-page * { box-sizing: border-box; }
.doc-page p { margin: 0; }

/* Header */
.doc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 3px solid #0a84ff;
}
.doc-header img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.doc-header .doc-co { flex: 1; min-width: 0; }
.doc-header .doc-co h1 { font-size: 21px; font-weight: 800; margin: 0; letter-spacing: -.02em; color: #1d1d1f; }
.doc-header .doc-co p { font-size: 11px; color: #6e6e73; margin-top: 1px; }
.doc-header .doc-meta { text-align: right; font-size: 11px; color: #6e6e73; flex: none; }
.doc-header .doc-meta strong { display: block; font-size: 12.5px; color: #0a84ff; font-weight: 800; }

/* Hero line */
.doc-hero { text-align: center; margin: 20px 0 6px; }
.doc-hero h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .01em;
  margin: 0;
  color: #0a84ff;
  text-transform: uppercase;
}
.doc-hero .doc-duration { font-size: 14px; font-weight: 700; color: #bf5af2; letter-spacing: .12em; text-transform: uppercase; margin-top: 2px; }
.doc-hero .doc-prepared { font-size: 11.5px; color: #6e6e73; margin-top: 6px; }

.doc-group-banner {
  margin: 12px 0 4px;
  padding: 9px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(10, 132, 255, .1), rgba(191, 90, 242, .1));
  border: 1px solid rgba(10, 132, 255, .3);
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #1d1d1f;
}
.doc-group-banner .doc-seats { color: #d70015; font-weight: 800; }

/* Section title */
.doc-sec { margin-top: 22px; page-break-inside: avoid; break-inside: avoid; }
.doc-sec.doc-sec-breakable { page-break-inside: auto; break-inside: auto; }
.doc-sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #0a84ff;
  margin-bottom: 8px;
  page-break-after: avoid;
  break-after: avoid;
}
.doc-sec-title::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(10, 132, 255, .45), rgba(191, 90, 242, .18)); border-radius: 2px; }

/* Flights */
.doc-flight {
  border: 1px solid #e2e5ef;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  page-break-inside: avoid;
  break-inside: avoid;
}
.doc-flight-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  background: #f2f5fd;
  font-weight: 700;
  font-size: 12px;
}
.doc-flight-head .doc-flight-dir { color: #bf5af2; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.doc-flight-body { padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.doc-flight-body .doc-kv { min-width: 150px; }
.doc-kv { font-size: 11.5px; }
.doc-kv b { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #6e6e73; }
.doc-transit {
  margin: 0 12px 10px;
  padding: 6px 10px;
  border-left: 3px solid #bf5af2;
  background: #faf5ff;
  font-size: 11px;
  color: #4b4b50;
  border-radius: 0 6px 6px 0;
}

/* Tables */
.doc-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.doc-table th {
  text-align: left;
  padding: 7px 10px;
  background: #0a84ff;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.doc-table th:first-child { border-radius: 6px 0 0 0; }
.doc-table th:last-child { border-radius: 0 6px 0 0; }
.doc-table td { padding: 7px 10px; border-bottom: 1px solid #e6e9f2; vertical-align: top; }
.doc-table tr:nth-child(even) td { background: #f7f9fe; }
.doc-table tr { page-break-inside: avoid; break-inside: avoid; }

/* Day blocks */
.doc-day {
  border: 1px solid #e2e5ef;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  page-break-inside: avoid;
  break-inside: avoid;
}
.doc-day-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #0a84ff, #bf5af2);
  color: #fff;
}
.doc-day-num {
  flex: none;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .22);
  padding: 3px 10px;
  border-radius: 999px;
}
.doc-day-title { font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; min-width: 0; }
.doc-day-meals { margin-left: auto; display: flex; gap: 4px; flex: none; }
.doc-meal-badge {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #0a84ff;
  font-size: 10px;
  font-weight: 800;
}
.doc-day-body { padding: 9px 12px; }
.doc-day-body .doc-places { font-size: 11.5px; color: #3a3a3e; white-space: pre-line; }
.doc-day-foot { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed #e2e5ef; }
.doc-day-flight {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f0f6ff;
  border: 1px solid #cfe3ff;
  font-size: 11px;
  color: #1d3a5f;
}
.doc-day-flight b { color: #0a84ff; }

/* Price summary */
.doc-price-total td {
  background: #eef6ff !important;
  font-weight: 800;
  font-size: 13px;
  color: #0a84ff;
  border-top: 2px solid #0a84ff;
}
.doc-num { text-align: right; white-space: nowrap; }

/* Included / Not included */
.doc-inc-grid { display: flex; gap: 14px; }
.doc-inc-col { flex: 1; border: 1px solid #e2e5ef; border-radius: 8px; padding: 10px 12px; min-width: 0; }
.doc-inc-col h4 { margin: 0 0 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.doc-inc-col.inc h4 { color: #1f9d55; }
.doc-inc-col.exc h4 { color: #d70015; }
.doc-inc-col ul { margin: 0; padding: 0; list-style: none; }
.doc-inc-col li { font-size: 11.5px; padding: 2.5px 0 2.5px 20px; position: relative; color: #3a3a3e; }
.doc-inc-col.inc li::before { content: "\2713"; position: absolute; left: 2px; color: #1f9d55; font-weight: 800; }
.doc-inc-col.exc li::before { content: "\2717"; position: absolute; left: 2px; color: #d70015; font-weight: 800; }

/* Notes / policy / bank */
.doc-note-body { font-size: 11.5px; color: #3a3a3e; white-space: pre-line; }
.doc-bank {
  border: 1.5px solid #0a84ff;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7faff;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
}
.doc-pay-terms { margin-top: 8px; font-size: 11.5px; font-weight: 700; color: #bf5af2; }

/* Footer / prepared by */
.doc-foot {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 2px solid #e2e5ef;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.doc-foot .doc-kv { min-width: 0; }
.doc-foot-right { text-align: right; }
.doc-validity {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #d70015;
}
.doc-contact-line {
  margin-top: 10px;
  text-align: center;
  font-size: 10.5px;
  color: #6e6e73;
}

.doc-empty-hint {
  margin-top: 60px;
  text-align: center;
  color: #a5a8b3;
  font-size: 13px;
}

/* ============================================================
   PDF EXPORT — full-screen "Preparing" overlay. Sits above the
   export stage (z-index 2147483000) so the user never sees the
   temporary clone being captured.
   ============================================================ */
.itb-export-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483200;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .96);
}
html.dark .itb-export-overlay { background: rgba(16, 18, 27, .96); }
.itb-export-msg {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #1d1d1f);
}
.itb-export-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(10, 132, 255, .25);
  border-top-color: #0a84ff;
  animation: itb-spin .8s linear infinite;
}
@keyframes itb-spin { to { transform: rotate(360deg); } }

/* ============================================================
   PRINT — only the document
   ============================================================ */
@media print {
  body { background: #fff !important; }
  .bg-scene, .navbar, .footer, .itb-form, .itb-toolbar, .section-head,
  .scroll-progress, .cp-overlay, main > section:first-child { display: none !important; }
  main { padding: 0 !important; }
  section { padding: 0 !important; }
  .itb-container { width: 100% !important; }
  .itb-layout { display: block !important; }
  .itb-preview-panel { position: static !important; }
  .itb-doc-frame { border: none !important; background: none !important; padding: 0 !important; max-height: none !important; overflow: visible !important; }
  .itb-doc-scale { transform: none !important; width: auto !important; height: auto !important; }
  .doc-page { width: auto !important; min-height: 0 !important; box-shadow: none !important; padding: 0 !important; }
}
