/*
  Adapted for Forest HUB from CalendarGenerator by Franco Mossotto.
  Source: https://github.com/fmossott/CalendarGenerator
  Original work licensed under Apache-2.0.
*/
:root {
  --page-width: 210mm;
  --page-height: 297mm;
  --page-bleed-area: 3mm;
  --page-tot-width: calc(var(--page-width) + (2 * var(--page-bleed-area)));
  --page-tot-height: calc(var(--page-height) + (2 * var(--page-bleed-area)));
  --page-margin: calc(var(--page-bleed-area) + 10mm);
  --img-height: calc((var(--page-height) - 50mm) * 0.4);
  --day-height: calc((var(--page-height) - 183mm) / 6);
  --bg: #071319;
  --bg-glow: rgba(38, 114, 143, 0.28);
  --panel: rgba(9, 24, 31, 0.84);
  --panel-border: rgba(173, 216, 230, 0.18);
  --text: #eff7fb;
  --muted: #9cb6c2;
  --accent: #7ee0d7;
  --accent-strong: #d9a441;
  --surface: #ffffff;
  --ink: #111827;
  --ink-muted: #4b5563;
  --holiday: #2f7dc0;
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-glow), transparent 38%),
    linear-gradient(180deg, #061016 0%, #08161d 45%, #050d12 100%);
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(126, 224, 215, 0.25);
  background: rgba(10, 28, 36, 0.7);
}

.back-link:hover {
  background: rgba(14, 41, 51, 0.92);
}

.topbar-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 780px;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 1;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

.subtitle,
.panel-copy,
.hint-list p,
.image-inputs-header p,
.status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.app-layout {
  display: grid;
  gap: 24px;
  align-items: start;
}

@media (min-width: 1180px) {
  .app-layout {
    grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  }
}

.controls-panel,
.preview-header {
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.controls-panel {
  padding: 22px;
}

.preview-header {
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.controls-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field span {
  color: var(--text);
  font-weight: 600;
}

.field.compact span {
  font-size: 12px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 12, 16, 0.78);
  color: var(--text);
  padding: 11px 13px;
}

input::placeholder {
  color: rgba(156, 182, 194, 0.68);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 14px;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #69d3c7, #d9a441);
  color: #102028;
}

button.secondary {
  background: rgba(5, 15, 20, 0.84);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
}

button:hover {
  transform: translateY(-1px);
}

.hint-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 13px;
}

.image-inputs {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
}

.image-inputs-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.image-input-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 52vh;
  overflow: auto;
  padding-right: 4px;
}

.image-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(3, 11, 15, 0.8);
}

.preview-panel {
  min-width: 0;
}

.status {
  max-width: 420px;
  text-align: right;
}

.status.info {
  color: var(--muted);
}

.status.success {
  color: #9ff5b9;
}

.status.warning {
  color: #ffd483;
}

.calendar-pages {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.calendar-page {
  width: var(--page-tot-width);
  min-height: var(--page-tot-height);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  overflow: hidden;
}

.page-border {
  width: 100%;
  min-height: 100%;
  padding: var(--page-margin);
  padding-top: calc(var(--page-margin) + 2mm);
}

.calendar-page.cover-page {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 30%),
    linear-gradient(145deg, #123746 0%, #235870 100%);
}

.cover-page .picture {
  height: calc(var(--img-height) + 12mm);
  max-height: calc(var(--img-height) + 12mm);
}

.cover-banner {
  margin-top: 28mm;
  background: rgba(240, 246, 249, 0.88);
  padding: 10mm 12mm;
}

.cover-kicker {
  margin: 0 0 4mm;
  color: #0f3443;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: calc(var(--page-height) * 0.012);
  font-weight: 700;
}

.cover-title {
  margin: 0;
  color: #0c2331;
  font-size: calc(var(--page-height) * 0.05);
  font-weight: 800;
}

.cover-year {
  margin: 4mm 0 0;
  color: #0c2331;
  font-size: calc(var(--page-height) * 0.08);
  font-weight: 800;
  line-height: 1;
}

.image-container {
  width: 100%;
}

.picture {
  display: block;
  width: 100%;
  height: var(--img-height);
  max-height: var(--img-height);
  object-fit: cover;
  background: #dbe7ee;
}

.description {
  margin: 3mm 0 0;
  text-align: right;
  color: var(--ink-muted);
  font-family: "Georgia", "Times New Roman", serif;
  font-size: calc(var(--page-height) * 0.013);
  min-height: 6mm;
}

.month-row {
  display: flex;
  gap: 10mm;
  align-items: stretch;
  margin: 7mm 0 5mm;
}

.month-box {
  flex: 0 0 40%;
  padding: 4mm 0 4mm var(--page-margin);
  margin-left: calc(0mm - var(--page-margin));
  background: #bcc7cf;
}

.month-box h3,
.month-box p {
  margin: 0;
}

.month-title {
  font-size: calc(var(--page-height) * 0.031);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.month-year {
  margin-top: 2mm;
  font-size: calc(var(--page-height) * 0.042);
  line-height: 1;
  font-weight: 800;
}

.notes-lines {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5mm;
}

.notes-lines span {
  display: block;
  border-top: 1px solid rgba(17, 24, 39, 0.45);
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.calendar-table th,
.calendar-table td {
  border: 1px solid #000;
  width: calc(100% / 7);
}

.calendar-table th {
  border-top: 0;
  border-left: 0;
  border-right: 0;
  padding: 0 0 2mm;
  text-align: left;
  font-size: calc(var(--page-height) * 0.014);
  font-weight: 700;
}

.calendar-table td {
  padding: 3px;
  height: var(--day-height);
  vertical-align: top;
}

.day-cell-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: calc(var(--day-height) - 4px);
  overflow: hidden;
}

.day-number {
  font-size: calc(var(--page-height) * 0.015);
  font-weight: 800;
}

.holiday-name {
  font-size: calc(var(--page-height) * 0.008);
  line-height: 1.2;
}

.other-month {
  opacity: 0.38;
}

.free-day {
  color: var(--holiday);
}

.empty-caption {
  color: transparent;
}

@media (max-width: 1179px) {
  .preview-header {
    flex-direction: column;
  }

  .status {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px 14px 36px;
  }

  .controls-grid,
  .image-row {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .calendar-pages {
    padding-bottom: 18px;
  }
}

@page {
  size: var(--page-tot-width) var(--page-tot-height);
  margin: 0;
}

@media print {
  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .app-shell {
    width: auto;
    padding: 0;
    margin: 0;
  }

  .calendar-pages {
    display: block;
    overflow: visible;
  }

  .calendar-page {
    border-radius: 0;
    box-shadow: none;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .calendar-page.break-after {
    page-break-after: always;
    break-after: page;
  }
}
