/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  --red:        #B5182B;
  --red-dark:   #8E1020;
  --yellow:     #F5C800;
  --wolf-gray:  #9B9B9B;
  --gray:       #5A5A5A;
  --gray-mid:   #808080;
  --gray-bg:    #F0F0F0;
  --off-white:  #F8F7F5;
  --black:      #1A1A1A;
  --text:       #2C2C2C;
  --text-light: #666;
  --border:     #E0E0E0;
  --shadow:     0 2px 12px rgba(0,0,0,0.10);
  --radius:     16px;
  --radius-sm:  10px;
  --radius-xs:  6px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Nunito Sans', sans-serif;
  background: var(--off-white);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  padding-top:    env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left:   env(safe-area-inset-left);
  padding-right:  env(safe-area-inset-right);
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, .font-nunito {
  font-family: 'Nunito', sans-serif;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
.filter-pills::-webkit-scrollbar { display: none; }

/* ── Screen Manager ─────────────────────────────────────────── */
.screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--off-white);
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* Push-nav screen sits above tab screens */
.push-screen {
  z-index: 10;
}

/* ── App Header ─────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(to right, #0d0d0d, #252525);
  padding: 16px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* Wolf logo: clips the black padding around the brand mark, zooms in on the wolf */
.app-header-logo {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}
.app-header-logo img {
  width: 135%;
  height: 135%;
  margin: -17.5%;
  display: block;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header-title {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 900;
  color: white;
  line-height: 1.2;
}

.app-header-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Initials avatar — always rightmost in header */
.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid var(--red-dark);
  color: white;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

/* Board-only icon button to the left of avatar */
.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-icon-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

/* Back button — used in all push-screen headers */
.app-back-btn {
  background: none;
  border: none;
  color: white;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1.2;
  flex-shrink: 0;
}
.app-back-btn:active { opacity: 0.75; }

/* Board-only action bar below screen header — houses create/compose button */
.screen-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.screen-action-label {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: auto;
}

.create-btn {
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  background: none;
  border: 1.5px solid var(--red);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  line-height: 1.4;
}

.create-btn:active {
  background: var(--red);
  color: white;
}

/* ── Bottom Navigation ──────────────────────────────────────── */
.bottom-nav {
  display: none; /* shown via JS after auth */
  background: white;
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px 4px;
  position: relative;
}

.nav-btn-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-btn-label {
  font-family: 'Nunito', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.nav-btn.active .nav-btn-label {
  color: var(--red);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--red);
  border-radius: 0 0 3px 3px;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  padding: 12px 20px;
  border-radius: 30px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: white;
  background: var(--black);
  z-index: 9999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  cursor: default;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error   { background: var(--red); }
.toast.toast-success { background: #2E7D32; }
.toast.toast-info    { background: var(--black); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet {
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.modal-title {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--black);
}

.modal-close-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -2px;
}

.modal-close-btn:active {
  background: var(--border);
}

.modal-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* ── Loader / Spinner ───────────────────────────────────────── */
.loader-wrap {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:active { background: var(--red-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

.btn-secondary:active { background: #fff0f2; }

.btn-danger {
  width: 100%;
  padding: 14px;
  background: transparent;
  color: #c0392b;
  border: 2px solid #f5c6cb;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

/* ── Chips ──────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.chip-red     { background: var(--red); color: white; }
.chip-outline { background: transparent; border: 1.5px solid var(--red); color: var(--red); }
.chip-green   { background: #edfff4; color: #1a7a3c; }
.chip-gray    { background: var(--gray-bg); color: var(--gray); border: 1.5px solid var(--border); }
.chip-amber   { background: #fff8ea; color: #8a6900; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--off-white);
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
  background: white;
}

.form-group textarea {
  resize: none;
  min-height: 100px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Filter Pills ───────────────────────────────────────────── */
.filter-pills {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}

.pill.active {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--black);
  margin-bottom: 6px;
}

.empty-state-sub {
  font-size: 13px;
  line-height: 1.5;
}

/* ── Section Header ─────────────────────────────────────────── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--black);
}

.see-all-btn {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  border: none;
  background: none;
  cursor: pointer;
}

/* ── PWA Install Banners ────────────────────────────────────── */
#pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a0508;
  color: white;
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 9999;
  align-items: center;
  gap: 14px;
  max-width: 360px;
  width: calc(100% - 32px);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#ios-install-banner {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a0508;
  color: white;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  z-index: 9999;
  max-width: 360px;
  width: calc(100% - 32px);
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Attachment rendering (shared: announcements + events) ─── */
.attachment-img-wrap { display: block; margin-top: 12px; }
.attachment-img {
  width: 100%; border-radius: var(--radius-sm); display: block;
  object-fit: cover; cursor: pointer;
}
.attachment-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 8px 16px; border-radius: 20px;
  background: var(--off-white); border: 1.5px solid var(--border);
  color: var(--black); font-size: 13px; font-weight: 700; text-decoration: none;
}
.attachment-link:active { background: #e8e8e8; }
