/* ============================================================
   Blackburn Legacy — main.css
   Facebook 2024/2025 design system
   Primary blue:  #0866FF  (updated from #1877F2)
   Green:         #00A400  (Facebook's current green)
   Background:    #F0F2F5
   Card:          #FFFFFF
   Border:        #E4E6EB  (light) / #CED0D4 (input)
   Text primary:  #050505
   Text secondary:#65676B
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:          #0866FF;
  --blue-hover:    #0759E0;
  --blue-light:    #E7F3FF;
  --blue-mid:      #C2D8FC;
  --green:         #00A400;
  --green-hover:   #008A00;
  --green-light:   #E6F4E6;
  --red:           #E41B1B;
  --red-light:     #FFEBEB;
  --yellow:        #F5C518;
  --yellow-light:  #FFF8E1;
  --bg:            #F0F2F5;
  --card:          #FFFFFF;
  --border:        #E4E6EB;
  --border-input:  #CED0D4;
  --text-primary:  #050505;
  --text-secondary:#65676B;
  --text-muted:    #BCC0C4;
  --purple:        #8B4AC9;
  --purple-light:  #F3E5F5;
  --orange:        #E65100;
  --pink:          #E4405F;
  --green-dark:    #1A6B12;
  --green-border:  #A8DFA0;
  --red-dark:      #C0392B;
  --nav-height:    56px;
  --sidebar-width: 280px;
  --radius:        8px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.1);
  --shadow-md:     0 2px 8px rgba(0,0,0,.12);
  --shadow-lg:     0 4px 24px rgba(0,0,0,.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
h1 { font-size: 1.375rem; font-weight: 700; color: var(--text-primary); }
h2 { font-size: 1.25rem;  font-weight: 700; color: var(--text-primary); }
h3 { font-size: 1.0625rem;font-weight: 700; color: var(--text-primary); }

/* ── App Shell ────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-areas:
    "nav     nav"
    "sidebar main";
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--nav-height) 1fr;
  min-height: 100vh;
}

/* ── Top Navigation ───────────────────────────────────────── */
.top-nav {
  grid-area: nav;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9375rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.nav-tab-group {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 48px;
  border-radius: var(--radius);
  font-size: 1.375rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .1s, color .1s;
  position: relative;
  border-bottom: 3px solid transparent;
}
.nav-tab:hover {
  background: var(--bg);
  color: var(--blue);
  text-decoration: none;
}
.nav-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-icon-btn {
  width: 40px;
  height: 40px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background .1s;
  position: relative;
  cursor: pointer;
  border: none;
}
.nav-icon-btn:hover {
  background: var(--border);
  text-decoration: none;
  color: var(--text-primary);
}
.nav-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9375rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity .1s;
}
.nav-avatar:hover { opacity: .9; text-decoration: none; }
.nav-spacer { flex: 1; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  width: var(--sidebar-width);
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-nav { list-style: none; padding: 0 8px; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .1s;
}
.sidebar-nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar-nav a.active { background: var(--blue-light); color: var(--blue); }
.sidebar-nav .icon { font-size: 1.25rem; width: 28px; text-align: center; flex-shrink: 0; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  grid-area: main;
  padding: 16px;
  max-width: 900px;
  width: 100%;
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  background: var(--red);
  color: #fff;
  border-radius: 50px;
  font-size: .6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--card);
  line-height: 1;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .1s, opacity .1s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary  { background: var(--blue);  color: #fff; }
.btn-primary:hover  { background: var(--blue-hover); color: #fff; }

.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); color: #fff; }

.btn-danger   { background: var(--red);   color: #fff; }
.btn-danger:hover  { background: #c91515; color: #fff; }

.btn-ghost {
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border); color: var(--text-primary); }

.btn-blue-light { background: var(--blue-light); color: var(--blue); }
.btn-blue-light:hover { background: var(--blue-mid); color: var(--blue); }

.btn-sm { padding: 6px 12px; font-size: .8125rem; }
.btn-full { width: 100%; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  font-size: .9375rem;
  color: var(--text-primary);
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.4;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8,102,255,.18);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: .9375rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--green-light); color: #1A6B12; border: 1px solid #A8DFA0; }
.alert-error   { background: var(--red-light);   color: #8B0000; border: 1px solid #FFC2C2; }
.alert-warning { background: var(--yellow-light); color: #7C5C00; border: 1px solid #FFE082; }
.alert-info    { background: var(--blue-light);   color: #0042A8; border: 1px solid var(--blue-mid); }

/* ── Data tables ──────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #FAFBFC; }

/* ── Avatars ──────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-sm { width: 32px;  height: 32px;  font-size: .8125rem; }
.avatar-md { width: 40px;  height: 40px;  font-size: .9375rem; }
.avatar-lg { width: 56px;  height: 56px;  font-size: 1.25rem;  }
.avatar-xl { width: 80px;  height: 80px;  font-size: 1.75rem;  }

/* ── Role chips ───────────────────────────────────────────── */
.role-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: capitalize;
}
.role-admin  { background: #FFF0F0; color: #C62828; }
.role-editor { background: #F3E5F5; color: #6A1B9A; }
.role-adult  { background: var(--blue-light); color: var(--blue); }
.role-child  { background: var(--green-light); color: #1B5E20; }

/* ── Event badges ─────────────────────────────────────────── */
.event-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-birthday    { background: #FFF0E6; color: #E65100; }
.badge-anniversary { background: #F3E5F5; color: #6A1B9A; }
.badge-holiday     { background: var(--green-light); color: #1B5E20; }
.badge-custom      { background: var(--blue-light);  color: var(--blue); }

/* ── Stat cards (admin) ───────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.stat-icon   { font-size: 1.75rem; }
.stat-number { font-size: 1.875rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .8125rem; font-weight: 600; color: var(--text-secondary); }
.stat-card.blue   .stat-number { color: var(--blue);  }
.stat-card.green  .stat-number { color: var(--green); }
.stat-card.red    .stat-number { color: var(--red);   }
.stat-card.orange .stat-number { color: #E65100;      }
.stat-card.purple .stat-number { color: #6A1B9A;      }

/* ── Login page ───────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: 100%;
  max-width: 396px;
}
.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  font-size: 1.0625rem;
  color: var(--text-primary);
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 12px;
}
.login-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8,102,255,.18);
}
.login-btn {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .1s;
}
.login-btn:hover { background: var(--blue-hover); }

/* ── Event banner (today's events) ───────────────────────── */
.event-banner {
  background: var(--blue);
  color: #fff;
  padding: 8px 16px;
  font-size: .875rem;
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
}
.event-banner-inner { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.event-banner-item  { display: flex; align-items: center; gap: 6px; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .25s ease both; }

/* ── Scrollbar (Chrome) ───────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-input); }

/* ── Transitions & animations ─────────────────────────────── */
.sidebar-nav a      { transition: background .15s, color .15s, padding-left .15s; }
.btn                { transition: background .15s, opacity .15s, transform .1s, box-shadow .15s; }
.btn:active         { transform: scale(.97); }
.card               { transition: box-shadow .2s; }
.card:hover         { box-shadow: var(--shadow-md); }
.nav-icon-btn       { transition: background .15s, transform .1s; }
.nav-icon-btn:hover { transform: scale(1.08); }
.nav-avatar         { transition: opacity .15s, transform .1s; }
.nav-avatar:hover   { transform: scale(1.06); }

/* ── Focus rings (accessibility) ──────────────────────────── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}
.form-control:focus-visible { outline: none; }

/* ── Toast notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  background: #1a1a1a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: .9375rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  pointer-events: all;
  animation: toastIn .25s ease both;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: #00A400; }
.toast.error   { background: #E41B1B; }
@keyframes toastIn  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateY(8px); } }

/* ── Loading skeleton ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Mobile bottom nav ─────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 4px 0 max(4px, env(safe-area-inset-bottom));
}
.mobile-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .625rem;
  font-weight: 600;
  border-radius: 8px;
  transition: color .15s;
  min-width: 56px;
  border: none;
  background: none;
  cursor: pointer;
}
.mobile-nav-btn .mn-icon { font-size: 1.375rem; line-height: 1; }
.mobile-nav-btn:hover, .mobile-nav-btn.active { color: var(--blue); }
.mobile-nav-btn.active .mn-icon { transform: scale(1.1); }

/* ── Mobile drawer ─────────────────────────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150;
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--card);
  z-index: 151;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: var(--shadow-lg);
}
.drawer.open { transform: translateX(0); }

/* ── Improved empty states ─────────────────────────────────── */
.empty-state-card {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state-card .es-icon { font-size: 3.5rem; margin-bottom: 12px; display: block; }
.empty-state-card h3 { color: var(--text-primary); margin-bottom: 8px; font-size: 1.125rem; }
.empty-state-card p  { font-size: .9375rem; max-width: 320px; margin: 0 auto 20px; line-height: 1.6; }

/* ── Back-to-top button ────────────────────────────────────── */
#backToTop {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  z-index: 90;
  pointer-events: none;
}
#backToTop.visible { opacity: 1; transform: translateY(0); pointer-events: all; }

/* ── Tooltip ───────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 999;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Improved alert dismissal ──────────────────────────────── */
.alert { cursor: default; position: relative; padding-right: 36px; }
.alert-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  line-height: 1;
  padding: 4px;
}
.alert-close:hover { opacity: 1; }

/* ── Search highlight ──────────────────────────────────────── */
mark { background: #FFF9C4; border-radius: 2px; padding: 0 2px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell {
    grid-template-areas: "nav" "main";
    grid-template-columns: 1fr;
  }
  .sidebar { display: none !important; }
  .main-content { padding: 12px; padding-bottom: 80px; }
  .nav-tab-group { display: none; }
  .mobile-nav { display: block; }

  /* Stack grids on mobile */
  .form-grid2,
  .invite-grid { grid-template-columns: 1fr !important; }

  /* Shrink stat grids */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Full-width buttons on mobile */
  .btn-mobile-full { width: 100%; justify-content: center; }

  /* Larger tap targets */
  .nav-icon-btn { width: 44px; height: 44px; }
  .nav-avatar   { width: 44px; height: 44px; }

  /* Hide non-essential nav icons on very small screens */
  @media (max-width: 380px) {
    .nav-icon-btn:not(:last-of-type) { display: none; }
  }

  /* Recipe and poll cards full width */
  .recipe-grid { grid-template-columns: 1fr !important; }
}

@media (min-width: 769px) {
  .mobile-nav { display: none !important; }
  .drawer     { display: none !important; }
}

/* ── Button states ────────────────────────────────────────── */
.btn[disabled], .btn.loading {
  opacity: .6;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: 6px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form improvements ─────────────────────────────────────── */
.form-control {
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(8,102,255,.12);
}
.form-label {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: 5px;
  color: var(--text-primary);
}

/* ── Better card shadows on hover ─────────────────────────── */
.post-card     { transition: box-shadow .2s; }
.post-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }

/* ── Smoother modal ────────────────────────────────────────── */
.modal-overlay {
  animation: fadeIn .18s ease;
}
.modal {
  animation: slideUp .2s ease;
}
@keyframes fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp { from { opacity:0; transform:translateY(16px) } to { opacity:1; transform:translateY(0) } }

/* ── Better avatar ─────────────────────────────────────────── */
.avatar {
  font-weight: 700;
  letter-spacing: -.5px;
}

/* ── Notification badge pulse ──────────────────────────────── */
.badge {
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

/* ── Sidebar active indicator ──────────────────────────────── */
.sidebar-nav a.active {
  border-left: 3px solid var(--blue);
  padding-left: calc(12px - 3px);
}

/* ── Better table styles ───────────────────────────────────── */
table { border-collapse: collapse; width: 100%; }
th { background: var(--bg); font-weight: 700; font-size: .8125rem;
     text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary);
     padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .9375rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Improved photo grid ───────────────────────────────────── */
.photo-grid img {
  transition: transform .2s, opacity .2s;
}
.photo-grid img:hover {
  transform: scale(1.03);
  opacity: .92;
}

/* ── Chat bubble tail ──────────────────────────────────────── */
.chat-bubble {
  position: relative;
}

/* ── Online dot pulse ──────────────────────────────────────── */
.online-dot {
  animation: onlinePulse 2.5s ease infinite;
}
@keyframes onlinePulse {
  0%,100% { opacity:1; } 
  50% { opacity:.5; }
}

/* ── Skip to main content (accessibility) ─────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--blue);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 700;
  z-index: 10000;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ── Dark Mode ─────────────────────────────────────────────── */
htmlhtml[data-theme="dark"], htmlhtml[data-theme="dark"] :root {
  --bg:             #18191a;
  --card:           #242526;
  --border:         #3a3b3c;
  --border-input:   #4a4b4c;
  --text-primary:   #e4e6eb;
  --text-secondary: #b0b3b8;
  --blue-light:     #1a3a5c;
  --green-light:    #1a3a1a;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.5);
  --shadow-md:      0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.6);
}
html[data-theme="dark"]             { background: #18191a; color: #e4e6eb; }
html[data-theme="dark"] body        { background: var(--bg); color: var(--text-primary); }
html[data-theme="dark"] .top-nav    { background: #242526; border-color: var(--border); }
html[data-theme="dark"] .sidebar    { background: #242526; border-color: var(--border); }
html[data-theme="dark"] .side-card  { background: #242526; border-color: var(--border); }
html[data-theme="dark"] .post-card  { background: #242526; border-color: var(--border); }
html[data-theme="dark"] .modal      { background: #242526; }
html[data-theme="dark"] .modal-overlay .modal { background: #242526; }
html[data-theme="dark"] .form-control { background: #3a3b3c; border-color: var(--border-input); color: var(--text-primary); }
html[data-theme="dark"] .form-control:focus { border-color: var(--blue); }
html[data-theme="dark"] select.form-control option { background: #242526; }
html[data-theme="dark"] .btn-ghost  { color: var(--text-primary); border-color: var(--border); }
html[data-theme="dark"] .btn-ghost:hover { background: var(--border); }
html[data-theme="dark"] .alert-success { background: #1a3a1a; border-color: #2d5a2d; color: #6fcf6f; }
html[data-theme="dark"] .alert-error   { background: #3a1a1a; border-color: #5a2d2d; color: #cf6f6f; }
html[data-theme="dark"] .sidebar-nav a { color: var(--text-primary); }
html[data-theme="dark"] .sidebar-nav a:hover { background: var(--border); }
html[data-theme="dark"] .sidebar-nav a.active { background: var(--blue-light); color: #70a8ff; }
html[data-theme="dark"] .nav-tab    { color: var(--text-secondary); }
html[data-theme="dark"] .nav-tab:hover, html[data-theme="dark"] .nav-tab.active { color: #fff; background: rgba(255,255,255,.1); }
html[data-theme="dark"] table       { background: #242526; }
html[data-theme="dark"] th          { background: #1a1a1a; color: var(--text-secondary); }
html[data-theme="dark"] tr:hover td { background: #2a2b2c; }
html[data-theme="dark"] .cover-card { background: #1a1a2e; }
html[data-theme="dark"] .quick-item { background: #2a2b2c; color: var(--text-primary); }
html[data-theme="dark"] .quick-item:hover { background: #3a3b3c; }
html[data-theme="dark"] .anc-tree-wrap { background: #1a1a1a; }
html[data-theme="dark"] .anc-card   { color: var(--text-primary); }
html[data-theme="dark"] .anc-photo  { border-color: var(--border); }
html[data-theme="dark"] .chat-panel { background: #18191a; }
html[data-theme="dark"] .chat-bubble { background: #3a3b3c; border-color: var(--border); color: var(--text-primary); }
html[data-theme="dark"] .rooms-panel { background: #242526; border-color: var(--border); }
html[data-theme="dark"] .online-panel { background: #242526; border-color: var(--border); }
html[data-theme="dark"] .room-item.active { background: #1a3a5c; }
html[data-theme="dark"] #darkModeToggle { background: #3a3b3c; border-color: var(--border); color: var(--text-primary); }
html[data-theme="dark"] img { opacity: .92; }

/* ── Print ────────────────────────────────────────────────── */
@media print {
  .top-nav, .sidebar, .btn, form { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; max-width: 100%; }
}
