/* La casa di Maria e Giuseppe — "dolce vita siciliana":
   sabbia e crema, arancia, limone, terracotta, con un tocco di blu maiolica.
   Tema sempre chiaro e caldo, anche se il telefono dell'ospite è in modalità scura. */
:root {
  color-scheme: light;
  --bg: #fcf3e3;
  --card: #fffaf0;
  --text: #3b2a1e;
  --muted: #8b7361;
  --border: #f1dfc2;
  --field: #fffdf8;
  --accent: #d9622b;          /* arancia siciliana */
  --accent-2: #ec8a3a;        /* arancia chiara, per i gradienti */
  --accent-hover: #c0531f;
  --accent-soft: #fde7d2;
  --accent-text: #ffffff;
  --lemon: #f2c14e;           /* limone */
  --lemon-soft: #fff1c7;
  --ochre: #9a6a10;
  --sea: #2b6e96;             /* blu maiolica, solo come accento */
  --sea-soft: #e4eef3;
  --sun: #f2c14e;
  --danger: #b3261e;
  --warn: #a86a12;
  --ok: #2d7a57;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(120, 60, 20, .05), 0 10px 28px rgba(160, 80, 20, .09);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maiolica: repeating-linear-gradient(90deg,
    var(--accent) 0 16px, var(--lemon) 16px 32px, var(--sea) 32px 48px, var(--lemon) 48px 64px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% 420px, rgba(242, 193, 78, .16), transparent 70%),
    radial-gradient(900px 500px at 0% 900px, rgba(217, 98, 43, .08), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}
.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap.wide { max-width: 1100px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 2rem; line-height: 1.15; margin: .2em 0 .3em; }
h2 { font-size: 1.3rem; margin: 0; }
h3 { font-size: 1.15rem; margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
small.muted { font-size: .8rem; font-weight: 400; }

/* ---------- Copertina ---------- */
.hero {
  position: relative;
  height: clamp(280px, 46vh, 440px);
  overflow: hidden;
  color: #fff;
  background: #6f8fa8;
}
.hero img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 58%;
  filter: saturate(1.15) sepia(.14) brightness(1.04);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(70, 30, 8, .38) 0%, rgba(70, 30, 8, 0) 28%,
      rgba(217, 98, 43, .10) 55%, rgba(110, 40, 10, .66) 100%),
    linear-gradient(90deg, rgba(242, 193, 78, .14), rgba(217, 98, 43, .10));
}
.hero::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; z-index: 1;
  background: var(--maiolica);
}
.hero-inner {
  position: relative; z-index: 1;
  height: 100%; max-width: 720px; margin: 0 auto;
  padding: 14px 16px 76px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.hero h1 {
  font-size: clamp(2rem, 7vw, 3rem);
  margin: .1em 0 .15em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .35);
}
.eyebrow {
  margin: 0; display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 700;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--sun); border-radius: 2px; }
.place { margin: 0; opacity: .92; font-size: 1rem; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.langs { display: flex; gap: 2px; margin-left: auto; }
.langs button {
  border: 1px solid transparent; background: none; padding: 5px 9px;
  border-radius: 999px; cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .04em;
}
.langs button.on { background: var(--card); color: var(--text); border-color: var(--border); }
.hero .langs { background: rgba(20, 12, 8, .28); border-radius: 999px; padding: 3px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hero .langs button { color: rgba(255, 255, 255, .85); }
.hero .langs button.on { background: rgba(255, 255, 255, .95); color: #2b231e; border-color: transparent; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.card.compact { padding: 16px 22px; }

/* Riquadro soggiorno sovrapposto alla foto */
.guest .wrap { padding-top: 0; }
.stay-card {
  position: relative; z-index: 2;
  margin-top: -56px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  overflow: hidden; padding-top: 28px;
}
.stay-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: var(--maiolica);
}
.stay-card.loading { display: block; min-height: 110px; }
.stay-date { display: flex; flex-direction: column; }
.stay-date.end { text-align: right; }
.stay-date span { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.stay-date strong { font-family: var(--serif); font-size: 1.7rem; line-height: 1.15; font-weight: 600; }
.stay-date small { color: var(--muted); font-size: .82rem; text-transform: capitalize; }
.stay-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 70px; }
.stay-line { width: 100%; height: 2px; background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 10px); }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--lemon-soft); color: var(--ochre); font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.intro { color: var(--muted); margin: 18px 2px 6px; }

/* Titoli di sezione numerati */
.section {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.45rem; margin: 30px 0 6px;
}
.num {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-text);
  font: 700 .95rem var(--sans); box-shadow: 0 3px 8px rgba(217, 98, 43, .3);
}

.guest-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.guest-title { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--lemon-soft); color: var(--ochre); font: 700 .85rem var(--sans);
  border: 1px solid #f5dc93;
}
h4.sub {
  margin: 24px 0 12px; padding-top: 18px; border-top: 1px dashed var(--border);
  font: 700 .75rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--accent);
}

/* ---------- Campi ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; font-weight: 600; }
input, select, button { font: inherit; color: inherit; }
input, select {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field);
  width: 100%;
  min-height: 46px;
  font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: #d6c4ad; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invalid input, .invalid select { border-color: var(--danger); }
.err { color: var(--danger); font-size: .82rem; font-weight: 500; margin: 0; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; min-height: 46px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text);
  cursor: pointer; font-weight: 600; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: var(--accent); color: var(--accent-text);
}
.btn.primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border: 1.5px dashed var(--border); color: var(--accent); }
.btn.ghost:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.08rem; border-radius: 999px; box-shadow: 0 8px 22px rgba(217, 98, 43, .32); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .85rem; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.submit-row { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- Autocompletamento ---------- */
.ac { position: relative; }
.ac ul {
  position: absolute; z-index: 10; left: 0; right: 0; top: 100%;
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  max-height: 260px; overflow: auto; box-shadow: 0 12px 28px rgba(40, 20, 10, .16);
}
.ac li { padding: 9px 11px; border-radius: 7px; cursor: pointer; font-weight: 400; }
.ac li.active, .ac li:hover { background: var(--accent-soft); }
.ac li.none { color: var(--muted); cursor: default; background: none; }

/* ---------- Varie ---------- */
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; cursor: pointer; }
.span-all { grid-column: 1 / -1; }
.check input { width: 20px; min-height: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); box-shadow: none; }
.notice {
  padding: 12px 14px; border-radius: 10px; font-size: .92rem;
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--sun);
}
.done { text-align: center; padding: 34px 22px; }
.done .icon { font-size: 2.2rem; line-height: 1; margin-bottom: 8px; }
.done .icon.ok {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.9rem;
  background: var(--accent); color: var(--accent-text);
}
.done h2 { font-size: 1.8rem; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0 8px; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; }
.see-you { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--sea); margin: 14px 0 0; }

.foot { text-align: center; font-size: .82rem; color: var(--muted); padding: 0 0 36px; }
.foot p { padding: 0 16px; }

/* ---------- Decori in stile maiolica ---------- */
.section .deco { margin-left: auto; height: 52px; width: auto; flex: none; }
.tiles {
  height: 48px; margin: 8px 0 18px;
  background: url(/img/maioliche.svg) repeat-x center / 96px 48px;
  border-top: 2px solid var(--sea); border-bottom: 2px solid var(--sea);
}
.done { position: relative; padding-top: 48px; }
.done .deco-l { position: absolute; top: 12px; left: 12px; width: 78px; transform: rotate(-8deg); }
.done .deco-r { position: absolute; top: 10px; right: 14px; width: 52px; }
.foot p { margin: 4px 0; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.badge.pending { color: var(--muted); background: var(--bg); }
.badge.submitted { color: var(--warn); background: #fbefd9; }
.badge.sent { color: var(--ok); background: #dff0e6; }
.badge.fix { color: var(--danger); background: #fde4e1; border: 0; margin-top: 4px; cursor: pointer; font: inherit; font-size: .74rem; font-weight: 700; }
.doc-fix { background: var(--lemon-soft); border-radius: 10px; padding: 8px 10px; min-width: 260px; }
.doc-fix p { margin: 0 0 6px; font-size: .88rem; }
.doc-fix select { min-height: 36px; padding: 6px 8px; flex: 1; min-width: 180px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:hover { background: var(--bg); }
td input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); color: var(--text);
  width: min(960px, calc(100vw - 32px)); padding: 22px;
}
dialog::backdrop { background: rgba(25, 14, 8, .5); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px;
  font-size: .9rem; max-width: calc(100vw - 32px); box-shadow: var(--shadow); z-index: 50;
}

/* Area gestore */
.admin-hero {
  position: relative; overflow: hidden; color: #fff;
  border-radius: var(--radius); margin-top: 4px; min-height: 150px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 20px 22px; background: #6f8fa8 url(/img/terrazza.jpg) center 60% / cover;
}
.admin-hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(110, 40, 10, .72), rgba(217, 98, 43, .12));
}
.admin-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--maiolica);
}
.admin-hero > * { position: relative; }
.admin-hero h1 { margin: 0; }
.admin-hero .btn { background: rgba(255, 255, 255, .92); color: #2b231e; border-color: transparent; }

.hidden { display: none !important; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .card { padding: 18px; }
  .stay-date strong { font-size: 1.4rem; }
  .stay-mid { min-width: 56px; }
  .admin-hero { flex-direction: column; align-items: flex-start; }
}
