/* layout.css — app shell: app bar, drawer, main grid, FAB, overlays. */

.wc-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
}

/* ---------- App bar ---------- */
.wc-appbar {
  height: var(--wc-appbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--wc-surface);
  border-bottom: 1px solid var(--wc-line-soft);
  z-index: 30;
}
.wc-appbar__brand {
  display: flex; align-items: center; gap: 6px;
  font-size: 20px; font-weight: 600; color: var(--wc-text-strong);
  padding-right: 8px; white-space: nowrap;
}
.wc-appbar__brand .wc-logo {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--wc-accent); color: #fff; font-weight: 700; font-size: 14px;
}
.wc-appbar__brand .wc-logo .material-symbols-rounded { font-size: 22px; }
.wc-appbar__title {
  font-size: 18px; font-weight: 500; color: var(--wc-text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; flex: 1 1 auto;
}
.wc-appbar__spacer { flex: 0 1 auto; min-width: 0; }

.wc-viewswitch {
  display: inline-flex; align-items: center;
  border: 1px solid var(--wc-line); border-radius: 999px; overflow: hidden;
  height: 38px;
}
.wc-viewswitch button {
  border: none; background: transparent; color: var(--wc-text-muted);
  padding: 0 14px; height: 100%; cursor: pointer; font-size: 13px; font-weight: 500;
}
.wc-viewswitch button[aria-pressed="true"] {
  background: var(--wc-accent-weak); color: var(--wc-accent);
}
.wc-viewswitch button:not(:last-child) { border-right: 1px solid var(--wc-line); }

/* Compact view switch (mobile menu) — labeled trigger, never just an icon */
.wc-viewmenu { position: relative; flex: 0 0 auto; }
.wc-viewmenu__trigger {
  display: inline-flex; align-items: center; gap: 5px;
  height: 44px; padding: 0 6px 0 10px;
  border: 1px solid var(--wc-line); border-radius: 999px;
  background: var(--wc-surface); color: var(--wc-text-strong);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.wc-viewmenu__trigger:active { background: var(--wc-surface-hover); }
.wc-viewmenu__trigger .material-symbols-rounded { font-size: 19px; color: var(--wc-text-muted); }
.wc-viewmenu__trigger .wc-viewmenu__chev { font-size: 18px; margin-left: -2px; }
.wc-viewmenu__pop {
  position: absolute; right: 0; top: 46px;
  background: var(--wc-surface); border: 1px solid var(--wc-line);
  border-radius: 14px; box-shadow: var(--wc-sh-3);
  padding: 6px; display: none; flex-direction: column; min-width: 184px; z-index: 50;
}
.wc-viewmenu__pop.open { display: flex; }
.wc-viewmenu__pop button {
  border: none; background: transparent; color: var(--wc-text);
  text-align: left; padding: 0 14px; min-height: 48px; border-radius: 10px; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; gap: 14px;
}
.wc-viewmenu__pop button:hover { background: var(--wc-surface-hover); }
.wc-viewmenu__pop button[aria-pressed="true"] { color: var(--wc-accent); font-weight: 600; background: var(--wc-accent-weak); }
.wc-viewmenu__pop button .material-symbols-rounded { font-size: 21px; }

.wc-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #8ab4f8);
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px;
  margin-left: 4px; flex: 0 0 auto; cursor: pointer; border: none;
}

/* ---------- Body: drawer + main ---------- */
.wc-body { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }

.wc-drawer {
  width: var(--wc-drawer-w);
  flex: 0 0 var(--wc-drawer-w);
  background: var(--wc-drawer-bg);
  border-right: 1px solid var(--wc-line-soft);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.2,0,0,1), width .22s ease, margin .22s ease;
}
.wc-drawer__scroll { overflow-y: auto; overflow-x: hidden; padding: 8px 8px 96px; flex: 1 1 auto; }

.wc-create {
  margin: 12px 8px 4px; align-self: flex-start;
  flex: 0 0 auto; box-sizing: border-box;
  height: 52px; min-height: 52px; padding: 0 22px 0 16px;
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--wc-line); border-radius: 16px;
  background: var(--wc-surface); color: var(--wc-text-strong);
  box-shadow: var(--wc-sh-1); cursor: pointer; font-size: 15px; font-weight: 500;
}
.wc-create:hover { box-shadow: var(--wc-sh-2); background: var(--wc-surface-hover); }
.wc-create .material-symbols-rounded { font-size: 24px; color: var(--wc-accent); }

.wc-main {
  flex: 1 1 auto; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--wc-bg);
  overflow: hidden;
}

/* Drawer collapsed (desktop) */
.wc-app[data-drawer="closed"] .wc-drawer { margin-left: calc(-1 * var(--wc-drawer-w)); }

/* Scrim for mobile drawer */
.wc-scrim {
  position: fixed; inset: 0; background: var(--wc-overlay);
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 40;
}

/* FAB (mobile create). Lifts above the iPhone home bar via safe-area inset. */
.wc-fab {
  position: fixed; right: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--wc-accent); color: #fff;
  border: none; box-shadow: var(--wc-sh-3);
  display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 70;
  transition: transform .12s ease, box-shadow .15s ease;
}
.wc-fab:active { transform: scale(.94); }
.wc-fab .material-symbols-rounded { font-size: 28px; }
/* Hide the FAB while any sheet is open so it never floats over the sheet. */
body.wc-sheet-open .wc-fab { display: none !important; }

/* ---------- Mobile subnav (date strip under the app bar) ---------- */
.wc-subnav { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 840px) {
  .wc-drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 45;
    width: min(var(--wc-drawer-w), 86vw);
    flex-basis: min(var(--wc-drawer-w), 86vw);
    box-shadow: var(--wc-sh-3);
    transform: translateX(-100%);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .wc-app[data-drawer="open"] .wc-drawer { transform: translateX(0); }
  .wc-app[data-drawer="open"] .wc-scrim { opacity: 1; pointer-events: auto; }
  .wc-app[data-drawer="closed"] .wc-drawer { margin-left: 0; }
  /* Last category items must clear the iPhone home bar. */
  .wc-drawer__scroll { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

  .wc-fab { display: flex; }
  .wc-desktop-only { display: none !important; }
  .wc-appbar__title { font-size: 18px; font-weight: 600; flex: 1 1 auto; min-width: 0; }
  .wc-appbar {
    gap: 2px; padding: 0 4px;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--wc-appbar-h) + env(safe-area-inset-top, 0px));
  }
  /* Four controls only: hamburger · title · search · view. Keep 44px targets. */
  .wc-appbar .wc-iconbtn { width: 44px; height: 44px; }

  /* Date-nav strip — thumb-reachable prev / Today / next under the bar. */
  .wc-subnav {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    flex: 0 0 auto; padding: 6px 8px;
    border-bottom: 1px solid var(--wc-line-soft); background: var(--wc-surface);
  }
  .wc-subnav .wc-iconbtn { width: 44px; height: 44px; }
  .wc-subnav__today {
    display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 18px;
    border: 1px solid var(--wc-line); border-radius: 999px;
    background: var(--wc-surface); color: var(--wc-text-strong);
    font-size: 14px; font-weight: 500; cursor: pointer;
  }
  .wc-subnav__today:active { background: var(--wc-surface-hover); }
  .wc-subnav__today .material-symbols-rounded { font-size: 20px; color: var(--wc-accent); }

  /* Theme toggle lives in the drawer on phone (set-once, not per-session). */
  .wc-drawer__theme {
    display: flex; align-items: center; gap: 12px;
    width: calc(100% - 16px); margin: 8px 8px 0; min-height: 48px; padding: 0 14px;
    border: 1px solid var(--wc-line-soft); border-radius: 12px;
    background: transparent; color: var(--wc-text); font-size: 14.5px; font-weight: 500; cursor: pointer;
  }
  .wc-drawer__theme:active { background: var(--wc-surface-hover); }
  .wc-drawer__theme .material-symbols-rounded { font-size: 22px; color: var(--wc-text-muted); }

  /* Mobile full-width search overlay inside the bar. */
  .wc-search--mobile {
    position: absolute; left: 8px; right: 8px;
    top: calc(8px + env(safe-area-inset-top, 0px));
    max-width: none; z-index: 31; gap: 8px;
    background: var(--wc-surface); box-shadow: var(--wc-sh-2);
  }
}
.wc-drawer__theme { display: none; }

@media (min-width: 841px) {
  .wc-mobile-only { display: none !important; }
  .wc-scrim { display: none; }
}

/* Search */
.wc-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--wc-surface-2); border-radius: 999px;
  height: 40px; padding: 0 14px; min-width: 0; max-width: 280px; flex: 1 1 180px;
}
.wc-search .material-symbols-rounded { font-size: 20px; color: var(--wc-text-muted); }
.wc-search input {
  border: none; background: transparent; outline: none; color: var(--wc-text);
  font-size: 14px; width: 100%; min-width: 0;
}
.wc-search input::placeholder { color: var(--wc-text-faint); }
.wc-searchresults { padding: 8px 0; }
