/* ============================================================
   Northshore F Shack — lakeside cottage theme
   ============================================================ */
:root {
  /* Warm paper + pine + lake palette */
  --bg: #f1ece0;
  --bg-tint: #e9e2d2;
  --card: #fffdf8;
  --ink: #26312e;
  --muted: #74807a;
  --line: #e4dccb;
  --line-soft: #efe9dc;

  --primary: #2f6b5c;      /* pine */
  --primary-dark: #245446;
  --primary-tint: #e7f0ec;
  --accent: #cf8a4c;       /* warm amber / canoe */
  --danger: #b4472e;
  --danger-tint: #f7e7e2;

  --shadow-sm: 0 1px 2px rgba(38, 49, 46, 0.06), 0 1px 3px rgba(38, 49, 46, 0.05);
  --shadow: 0 4px 14px rgba(38, 49, 46, 0.10);
  --shadow-lg: 0 18px 50px rgba(24, 40, 34, 0.28);
  --radius: 14px;
  --radius-sm: 9px;

  --font-body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win — otherwise .modal{display:flex} below
   would override it and leave dialogs stuck open on page load. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -260px, #dfeae4 0%, transparent 70%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ---- Buttons ---- */
button {
  font: inherit; font-weight: 700; cursor: pointer;
  border-radius: 999px; border: 1px solid transparent;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease, border-color .15s ease;
}
button:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; padding: 0.55rem 1.15rem; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); padding: 0.45rem 0.9rem; box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: #fff; border-color: #d8cfb9; }
.btn-danger { background: var(--danger); color: #fff; padding: 0.55rem 1.15rem; box-shadow: var(--shadow-sm); }
.btn-danger:hover { filter: brightness(0.94); }
button:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 253, 248, 0.85);
  backdrop-filter: saturate(1.4) blur(8px);
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--primary-dark); display: flex; align-items: center; gap: 0.5rem; }
.brand span { vertical-align: middle; }
.topbar-right { display: flex; align-items: center; gap: 0.55rem; }
#who { font-weight: 700; color: var(--muted); }

/* Icon-ish ghost buttons (bell) a touch rounder */
#notify-btn { padding: 0.45rem 0.7rem; font-size: 1rem; }

/* Faint cottage photo behind the whole calendar page. A heavy paper wash keeps the
   calendar readable; the photo stays fixed as the page scrolls. */
.app-body {
  background:
    linear-gradient(rgba(241, 236, 224, 0.44), rgba(241, 236, 224, 0.60)),
    url('/img/cottage.jpg') center top / cover no-repeat fixed;
  background-color: var(--bg);
}

.tabs {
  display: flex; align-items: center; gap: 0.4rem;
  max-width: 980px; margin: 1.15rem auto 0; padding: 0 1.15rem;
}
.tab {
  background: transparent; border: 1px solid transparent; padding: 0.5rem 1.05rem;
  color: var(--muted); font-weight: 700; border-radius: 999px;
}
.tab:hover { color: var(--ink); background: var(--bg-tint); }
.tab.active { color: #fff; background: var(--primary); box-shadow: var(--shadow-sm); }
.add-btn { margin-left: auto; }

main { max-width: 980px; margin: 1.25rem auto; padding: 0 1.15rem 3.5rem; }

/* ---- Calendar ---- */
.cal-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1rem; }
.cal-header h2 { margin: 0; font-size: 1.5rem; min-width: 13rem; text-align: center; color: var(--primary-dark); }
.cal-header .btn-ghost { width: 38px; height: 38px; padding: 0; font-size: 1.25rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.today-btn { margin-left: auto; width: auto !important; padding: 0 0.95rem !important; }

.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-row { margin-bottom: 6px; }
.weekday-row div { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.cell {
  position: relative; background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); min-height: 92px; padding: 5px 5px 4px; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .08s ease;
}
.cell:not(.empty):hover { box-shadow: var(--shadow); }
.cell.empty { background: transparent; border-color: transparent; box-shadow: none; }
.cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47, 107, 92, 0.35); }
.cell .daynum {
  font-size: 0.82rem; font-weight: 700; color: var(--muted);
  position: relative; z-index: 2; width: 1.55em; height: 1.55em;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cell.today .daynum { background: var(--primary); color: #fff; }

/* Booking bars stacked in a cell */
.bars { position: relative; z-index: 2; margin-top: 3px; display: flex; flex-direction: column; gap: 3px; }
.bar {
  font-size: 0.68rem; line-height: 1.5; font-weight: 700; color: #fff;
  padding: 1px 7px; border-radius: 3px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: pointer; text-shadow: 0 1px 1px rgba(0,0,0,0.18);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.10); transition: filter .12s ease;
}
.bar:hover { filter: brightness(1.08); }
.bar.mid { border-radius: 0; margin-left: -5px; margin-right: -5px; padding-left: 12px; }
.bar.start { border-top-left-radius: 999px; border-bottom-left-radius: 999px; margin-right: -5px; }
.bar.end { border-top-right-radius: 999px; border-bottom-right-radius: 999px; margin-left: -5px; padding-left: 12px; }
.bar.start.end { border-radius: 999px; margin: 0; padding-left: 7px; }

/* Turnover day: diagonal split of the cell background */
.cell.turnover::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(135deg, var(--depart-color) 0 49%, transparent 49% 51%, var(--arrive-color) 51% 100%);
  opacity: 0.26;
}
/* Check-out day (booking ends, nobody arriving): wedge in the departing colour on the left. */
.cell.checkout::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(135deg, var(--depart-color) 0 38%, transparent 38%);
  opacity: 0.20;
}
.turnover-badge, .checkout-badge {
  position: absolute; bottom: 4px; right: 5px; z-index: 2; font-size: 0.58rem; font-weight: 700;
  color: var(--ink); background: rgba(255,255,255,0.88); border-radius: 999px; padding: 1px 7px;
  box-shadow: var(--shadow-sm); text-transform: lowercase; letter-spacing: 0.02em; white-space: nowrap;
}

.cal-note {
  margin: 1.1rem 0 0; padding: 0.7rem 0.9rem; background: var(--primary-tint);
  border-radius: var(--radius-sm); color: var(--primary-dark); font-size: 0.85rem; line-height: 1.45;
}
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.legend .item {
  display: flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; font-weight: 700;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 0.3rem 0.75rem; box-shadow: var(--shadow-sm);
}
.legend .swatch { width: 13px; height: 13px; border-radius: 4px; }

/* ---- List view ---- */
#list-view h2, #calendar-view > .cal-header + * { }
#list-view h2 { color: var(--primary-dark); }
.booking-row {
  background: var(--card); border: 1px solid var(--line-soft); border-left: 6px solid var(--line);
  border-radius: var(--radius); padding: 0.9rem 1.15rem; margin-bottom: 0.7rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .08s ease;
}
.booking-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.booking-row .dates { font-weight: 700; }
.booking-row .who { font-size: 0.9rem; color: var(--muted); margin-top: 2px; }
.booking-row .meta { text-align: right; font-size: 0.8rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.empty-state {
  color: var(--muted); text-align: center; padding: 3rem 1rem;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---- Modals ---- */
.modal {
  position: fixed; inset: 0; background: rgba(24, 34, 30, 0.5);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 1rem; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 1.6rem 1.6rem 1.4rem; width: 100%; max-width: 440px;
  border: 1px solid var(--line-soft); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card h3 { margin: 0 0 0.4rem; font-size: 1.35rem; color: var(--primary-dark); }
.modal-card label { display: block; font-weight: 700; font-size: 0.82rem; margin: 0.85rem 0 0.3rem; color: var(--ink); }
.modal-card input[type=text], .modal-card input[type=date], .modal-card input[type=email], .modal-card textarea {
  width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-card input:focus, .modal-card textarea:focus, .login-card input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 0.55rem; margin-top: 1.4rem; }
.noon-note {
  background: var(--primary-tint); color: var(--primary-dark); border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; font-size: 0.85rem; font-weight: 600; margin: 0.2rem 0 0.4rem;
}
.radio { font-weight: 600 !important; display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0; cursor: pointer; }
.radio input { accent-color: var(--primary); }

.details { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.1rem; margin: 0.6rem 0; }
.details dt { font-weight: 700; color: var(--muted); font-size: 0.85rem; }
.details dd { margin: 0; font-weight: 600; }
.owner-chip { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: 8px; box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12); }

/* ---- Messages ---- */
.message { margin-top: 0.85rem; font-size: 0.9rem; font-weight: 600; }
.message.error { color: var(--danger); background: var(--danger-tint); padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); }
.message.success { color: var(--primary-dark); background: var(--primary-tint); padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); }

/* ---- Login page ---- */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.25rem;
  /* Top layer: subtle darkening for card contrast.
     Middle: the cottage photo (drop public/img/cottage.jpg to enable).
     Bottom: pine gradient — shows through if the photo is missing. */
  background:
    linear-gradient(165deg, rgba(22, 42, 36, 0.48), rgba(22, 42, 36, 0.22)),
    url('/img/cottage.jpg') center / cover no-repeat,
    linear-gradient(160deg, #8fb9c4 0%, #5f9a8b 55%, #3f7a68 100%);
  background-attachment: fixed, fixed, fixed;
}
.login-card {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 2.4rem 2.1rem; max-width: 400px; width: 100%; text-align: center;
  border: 1px solid rgba(255,255,255,0.6);
}
.login-logo {
  font-size: 2.6rem; width: 74px; height: 74px; margin: 0 auto 0.5rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-tint); border-radius: 20px;
}
.login-card h1 { margin: 0.4rem 0 0.5rem; font-size: 1.7rem; color: var(--primary-dark); }
.login-card form { text-align: left; margin-top: 1.3rem; }
.login-card label { display: block; font-weight: 700; font-size: 0.82rem; margin-bottom: 0.3rem; }
.login-card input { width: 100%; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: #fff; }
.login-card button { width: 100%; margin-top: 1.05rem; padding: 0.75rem; font-size: 1rem; }

@media (max-width: 560px) {
  .cell { min-height: 70px; }
  .bar { font-size: 0.6rem; }
  .cal-header h2 { min-width: auto; font-size: 1.2rem; }
  .brand span { display: none; }
  main { padding: 0 0.85rem 3rem; }
  .weekday-row, .calendar-grid { gap: 4px; }
}
