/* RG Events — schedule page. Header reuses ONLY the top band of the Días
   que Cuentan calendar (top.png / top-sil / top-frame at the site root),
   recolorable via /calendar-colors.css (--brand-blue). Below it, flat cards. */

:root {
  --brand-blue: #1e6ee0; /* overridden at runtime from the sheet's Config.Color */
  --text: #1c2434;
  --muted: #6b7686;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: #eef2f8;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 430px;
  margin: 0 auto;
  padding: 0 0 60px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- header: just the calendar top band ---------- */

.calendar-top {
  width: 100%;
  aspect-ratio: 1289 / 430;
  background: url('/top.png?v=2') center bottom / 100% auto no-repeat;
  position: relative;
  filter: drop-shadow(0 8px 18px rgba(6, 26, 82, 0.22));
  margin-bottom: 10px;
  flex: none;
}

.calendar-title {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 6%;
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* Header icon group: star (only-mine) + eye-slash (hide-finished) + qr-share.
   Toggles show their state with color: muted when off, brand color when on. */
.header-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ico {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: #9aa4b2;                 /* off / muted */
  -webkit-tap-highlight-color: transparent;
}
.ico:active { transform: scale(.92); }
#tg-star.on { color: #f5b301; }   /* only-mine active → gold star */
#tg-done.on { color: #1c1c1c; }   /* hide-finished active → black eye */
/* QR is an action, not a toggle — dual black/white duotone. */
#qr-btn {
  color: #1c1c1c;
  --fa-primary-color: #1c1c1c;
  --fa-secondary-color: #ffffff;
  --fa-secondary-opacity: 1;
}

/* ---------- content below the band: flat, like plain cards ---------- */

.content {
  padding: 0 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
#schedule { flex: 1; }

.event-meta { text-align: center; color: var(--text); margin: 2px 0 10px; }
.event-meta .dates { font-weight: 600; }
.event-meta .venue { font-size: .85rem; color: var(--muted); }
.event-meta img.logo { max-width: 60%; max-height: 80px; margin: 6px auto; display: block; border-radius: 8px; }

.announce {
  background: #fff7d6;
  border-left: 4px solid #e6a700;
  color: #5a4500;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 10px;
  font-size: .9rem;
}

/* ---------- schedule ---------- */

.day-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 6px 12px;
  border-radius: 8px;
  margin: 14px 0 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
}

.ev {
  background: var(--card);
  border-radius: 12px;
  padding: 9px 11px;
  margin: 7px 0;
  box-shadow: 0 1px 4px rgba(6, 26, 82, .12);
  cursor: pointer;
}
.ev.done { opacity: .55; }
.ev .row1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ev .time { font-weight: 700; color: var(--brand-blue); white-space: nowrap; }
.ev .room { margin-left: auto; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.ev .star {
  background: none; border: none; font-size: 1.05rem; cursor: pointer;
  padding: 0 4px 0 0; filter: grayscale(1) opacity(.45);
}
.ev.starred .star { filter: none; }
.ev .name { font-weight: 600; margin: 2px 0 0; }
.ev .desc { display: none; margin: 6px 0 0; font-size: .88rem; color: var(--muted); white-space: pre-wrap; }
.ev.open .desc { display: block; }

.updated { text-align: center; font-size: .75rem; color: var(--muted); margin: 12px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* ---------- admin FAB: the ONE edit button ---------- */

#fab-edit {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--brand-blue);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(6, 26, 82, .35);
  display: none;
}
body.is-admin #fab-edit { display: block; }

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 20, 40, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.overlay.show { display: flex; }

.sheet {
  background: #fff;
  width: 100%;
  max-width: 430px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 16px 16px 20px;
}
.sheet h3 { margin: 0 0 10px; display: flex; align-items: center; }
.sheet h3 .close { margin-left: auto; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }

.qr-box { text-align: center; }
.qr-box svg, .qr-box img { max-width: 240px; width: 100%; height: auto; }
.qr-box .link { font-size: .75rem; color: var(--muted); word-break: break-all; margin: 8px 0; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  background: var(--brand-blue);
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  margin: 4px 4px 0 0;
}
.btn.soft { background: #e8eef8; color: var(--brand-blue); }
.btn.danger { background: #d64545; }
.btn.wide { width: 100%; margin: 8px 0 0; }

/* admin edit screen */
.adm-day { font-weight: 700; color: var(--brand-blue); letter-spacing: .06em; margin: 14px 0 4px; }
.adm-ev {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-bottom: 1px solid #eef1f6;
  font-size: .9rem;
  background: #fff;
}
.adm-ev .grip {
  cursor: grab;
  color: #aab3c2;
  font-size: 1.1rem;
  padding: 0 2px;
  touch-action: none; /* let Sortable own the touch gesture */
  user-select: none;
}
.adm-ev .t { color: var(--muted); white-space: nowrap; }
.adm-ev .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-ev button { background: none; border: none; font-size: 1.05rem; cursor: pointer; padding: 2px 6px; }
.sortable-ghost { opacity: .35; background: #e8eef8; }
.sortable-chosen { box-shadow: 0 4px 12px rgba(6, 26, 82, .18); border-radius: 8px; }

.adm-admin { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: .9rem; }
.adm-admin .who { flex: 1; }
.adm-admin .sub { font-size: .72rem; color: var(--muted); }

/* event form */
.form label { display: block; font-size: .8rem; color: var(--muted); margin: 10px 0 3px; }
.form input, .form textarea, .form select {
  width: 100%;
  border: 1px solid #d5dbe6;
  border-radius: 9px;
  padding: 9px 10px;
  font-size: .95rem;
  font-family: inherit;
  background: #fff;
}
.form textarea { min-height: 70px; resize: vertical; }
.form .two { display: flex; gap: 10px; }
.form .two > div { flex: 1; }
.hint { font-size: .75rem; color: var(--muted); margin: 4px 0; }

/* setup guide (create a gathering) */
.steps { margin: 0 0 12px; padding-left: 20px; font-size: .9rem; }
.steps li { margin: 8px 0; }
.steps .btn { margin-top: 6px; }

.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-row img { max-height: 54px; max-width: 110px; border-radius: 8px; border: 1px solid #e2e7f0; }
.logo-row input[type="file"] { flex: 1; min-width: 0; border: none; padding: 6px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  background: #222c3d;
  color: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: .85rem;
  z-index: 90;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }
