/* Lake Effect — shared stylesheet */

:root {
  /* Dune Grass palette (Country Chic Paint), glassmorphic surfaces over a
     fixed dusk-lake gradient hero (see body::before). */
  --bg: #e7e2d5;
  --text: #2b322f;
  --text-soft: #5d655f;
  --line: rgba(46, 52, 48, 0.14);
  --accent: #5c7b82;        /* nightfall */
  --accent-soft: #d6e2e2;
  --accent-text: #ffffff;
  --pine: #8fa69c;          /* dune grass */
  --pine-soft: #e4eae4;
  --sand: #dcc49e;          /* cheesecake */
  --danger: #a4442f;
  --danger-soft: #f3ddd7;
  --pending: #b07d2a;
  --pending-soft: #f4e8cf;
  --approved: #3e6b4f;
  --approved-soft: #dcebe1;
  --blackout: #5b5470;
  --blackout-soft: #e4e0ee;
  --radius: 18px;

  /* Glass surfaces: rgb triplet (no alpha) so components pick their own
     opacity, plus a light hairline border to catch the hero light. */
  --surface-rgb: 255, 255, 255;
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-shadow: 0 10px 34px rgba(24, 34, 29, 0.16);

  /* Fixed hero photo (dune grass at dusk) with a light tint wash so glass
     panels stay legible without hiding the image. Swap the url() to change
     the photo later — everything else keys off --hero-tint. */
  --hero-photo: url("../img/hero-dune-grass.jpg");
  --hero-tint: linear-gradient(180deg,
    rgba(48, 66, 71, 0.32) 0%, rgba(48, 66, 71, 0.06) 32%,
    rgba(231, 226, 213, 0.1) 65%, rgba(231, 226, 213, 0.55) 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b2220;
    --text: #e8e4d8;
    --text-soft: #9fa9a0;
    --line: rgba(232, 228, 216, 0.14);
    --accent: #8fb0b5;
    --accent-soft: #32474b;
    --accent-text: #10181a;
    --pine: #a9c0b4;
    --sand: #e3c99c;
    --danger: #d97e66;
    --danger-soft: #45291f;
    --pending: #d9a94e;
    --pending-soft: #40351c;
    --approved: #7db894;
    --approved-soft: #253c2e;
    --blackout: #a79fc4;
    --blackout-soft: #322e44;
    --surface-rgb: 20, 26, 24;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
    --hero-tint: linear-gradient(180deg,
      rgba(6, 10, 9, 0.55) 0%, rgba(6, 10, 9, 0.4) 45%, rgba(6, 10, 9, 0.7) 100%);
  }
}
:root[data-theme="dark"] {
  --bg: #1b2220;
  --text: #e8e4d8;
  --text-soft: #9fa9a0;
  --line: rgba(232, 228, 216, 0.14);
  --accent: #8fb0b5;
  --accent-soft: #32474b;
  --accent-text: #10181a;
  --pine: #a9c0b4;
  --sand: #e3c99c;
  --danger: #d97e66;
  --danger-soft: #45291f;
  --pending: #d9a94e;
  --pending-soft: #40351c;
  --approved: #7db894;
  --approved-soft: #253c2e;
  --blackout: #a79fc4;
  --blackout-soft: #322e44;
  --surface-rgb: 20, 26, 24;
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
  --hero-tint: linear-gradient(180deg,
    rgba(6, 10, 9, 0.55) 0%, rgba(6, 10, 9, 0.4) 45%, rgba(6, 10, 9, 0.7) 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.55;
  background: var(--bg);
}
/* Fixed hero scene behind everything — a pseudo-element (not
   background-attachment:fixed on body) for smoother mobile scrolling. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--hero-tint), var(--hero-photo);
  background-size: cover;
  background-position: center;
}

/* Hide page until auth guard resolves, to avoid a flash of protected content */
body.loading #nav, body.loading main { visibility: hidden; }

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; font-weight: 700; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

/* ---------- Navigation ---------- */

.site-header {
  background: rgba(var(--surface-rgb), 0.62);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--glass-border);
}
.site-header .inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent);
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
}
.brand .wave { color: var(--sand); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.site-nav a {
  text-decoration: none;
  color: var(--text-soft);
  background: rgba(var(--surface-rgb), 0.4);
  border: 1px solid var(--glass-border);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover { background: rgba(var(--surface-rgb), 0.75); color: var(--text); }
.site-nav a.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.theme-toggle {
  background: rgba(var(--surface-rgb), 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  line-height: 2rem;
  padding: 0;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-soft);
}
.theme-toggle:hover { background: rgba(var(--surface-rgb), 0.75); }

/* ---------- Cards, forms, buttons ---------- */

.card {
  background: rgba(var(--surface-rgb), 0.66);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0.75rem 0 0.25rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="url"], textarea, select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(var(--surface-rgb), 0.55);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 6px 16px rgba(24, 34, 29, 0.22);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.07); }
button:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
button.secondary, .btn.secondary {
  background: rgba(var(--surface-rgb), 0.5);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover { filter: none; background: rgba(var(--surface-rgb), 0.8); }
button.danger { background: var(--danger); color: #fff; }
button.small, .btn.small { padding: 0.32rem 0.7rem; font-size: 0.85rem; }

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > div { flex: 1 1 180px; }

.muted { color: var(--text-soft); font-size: 0.9rem; }
.error-msg { color: var(--danger); font-size: 0.9rem; margin-top: 0.5rem; min-height: 1.2em; }
.success-msg { color: var(--approved); font-size: 0.9rem; margin-top: 0.5rem; }

/* ---------- Badges ---------- */
/* Kept flat and clearly colored, not glassy — status meaning needs to stay
   legible at small sizes, which blur/translucency tends to muddy. */

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge.pending { background: var(--pending-soft); color: var(--pending); }
.badge.approved { background: var(--approved-soft); color: var(--approved); }
.badge.declined, .badge.cancelled, .badge.open { background: var(--danger-soft); color: var(--danger); }
.badge.blackout { background: var(--blackout-soft); color: var(--blackout); }
.badge.resolved { background: var(--approved-soft); color: var(--approved); }
.badge.admin { background: var(--accent-soft); color: var(--accent); }

/* ---------- Banner ---------- */

.banner {
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  background: rgba(var(--surface-rgb), 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

/* ---------- Calendar ---------- */

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.cal-toolbar h2 { margin: 0; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-dow {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-soft);
  padding: 0.25rem 0;
  text-transform: uppercase;
}
/* Plain (no backdrop-filter) on purpose — up to 42 of these render at once,
   and stacking blur that widely gets janky, especially on mobile. */
.cal-day {
  background: rgba(var(--surface-rgb), 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  min-height: 5.2rem;
  padding: 0.2rem 0.3rem;
  font-size: 0.8rem;
  position: relative;
  overflow: hidden;
}
.cal-day.other-month { opacity: 0.4; }
.cal-day.today { border: 2px solid var(--sand); }
.cal-day.free { cursor: pointer; }
.cal-day.free:hover { background: rgba(var(--surface-rgb), 0.85); }
.cal-day .num { font-weight: 600; color: var(--text-soft); }
.cal-stay {
  display: block;
  margin-top: 2px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-stay.approved { background: var(--approved-soft); color: var(--approved); }
.cal-stay.pending {
  background: repeating-linear-gradient(45deg, var(--pending-soft), var(--pending-soft) 5px, transparent 5px, transparent 9px);
  color: var(--pending);
  border: 1px dashed var(--pending);
}
.cal-stay.blackout { background: var(--blackout-soft); color: var(--blackout); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-soft);
}
.cal-legend .chip {
  display: inline-block;
  width: 0.85em; height: 0.85em;
  border-radius: 3px;
  margin-right: 0.3em;
  vertical-align: -0.08em;
}

/* ---------- Lists ---------- */

.item-list { list-style: none; padding: 0; margin: 0; }
.item-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.item-list li:last-child { border-bottom: none; }
.item-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.item-head .who { font-weight: 600; }
.item-head .when { color: var(--text-soft); font-size: 0.82rem; margin-left: auto; }
.item-actions { margin-top: 0.4rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---------- Managed content / markdown ---------- */

.md-body h1, .md-body h2, .md-body h3 { margin-top: 1.4em; }
.md-body ul, .md-body ol { padding-left: 1.4rem; }
.md-body hr { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.md-body code {
  background: rgba(var(--surface-rgb), 0.5);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.9em;
}

.editor-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .editor-grid { grid-template-columns: 1fr 1fr; } }
.editor-grid textarea { min-height: 20rem; font-family: Consolas, monospace; font-size: 0.85rem; }
.preview-pane {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.4);
  padding: 0.5rem 1rem;
  overflow: auto;
  max-height: 24rem;
}

/* ---------- Auth page ---------- */

.auth-wrap { max-width: 420px; margin: 3rem auto; padding: 0 1rem; }
.auth-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.62);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
}
.auth-hero h1 { color: var(--accent); margin: 0; text-align: center; font-size: 1.4rem; }
.tabs {
  display: flex;
  gap: 0.35rem;
  background: rgba(var(--surface-rgb), 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.3rem;
  margin-bottom: 1rem;
}
.tabs button {
  flex: 1;
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--text-soft);
  padding: 0.55rem;
  box-shadow: none;
}
.tabs button.active { background: var(--accent); color: var(--accent-text); }
.google-btn {
  width: 100%;
  background: rgba(var(--surface-rgb), 0.5);
  border: 1px solid var(--glass-border);
  color: var(--text);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.google-btn:hover { filter: none; background: rgba(var(--surface-rgb), 0.8); }
.divider {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--text-soft); font-size: 0.8rem; margin: 1rem 0;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.pending-screen { max-width: 480px; margin: 4rem auto; text-align: center; padding: 0 1rem; }

/* ---------- Tables (admin) ---------- */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); }
th { color: var(--text-soft); font-size: 0.8rem; text-transform: uppercase; }

/* ---------- Modal ---------- */

dialog {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: rgba(var(--surface-rgb), 0.85);
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 480px;
  width: calc(100% - 2rem);
  padding: 1.5rem;
}
dialog::backdrop { background: rgba(10, 16, 14, 0.4); }

@media (max-width: 640px) {
  .cal-day { min-height: 3.6rem; }
  .cal-stay { font-size: 0.6rem; }
}
