/* ============================================================
   WESB Tech Update 2026 — Attendance Tracker Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-2:    #263347;
  --border:       #334155;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --accent:       #3b82f6;
  --accent-hover: #2563eb;

  --pending-bg:   #334155;
  --pending-text: #cbd5e1;
  --pending-ring: #475569;

  --present-bg:   #14532d;
  --present-text: #86efac;
  --present-ring: #16a34a;

  --absent-bg:    #450a0a;
  --absent-text:  #fca5a5;
  --absent-ring:  #dc2626;

  --radius: 8px;
  --radius-lg: 12px;
}

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

body > .header,
body > .tabs,
body > .content,
body > #toast-container { flex-shrink: 0; }

body > .site-footer { margin-top: auto; }

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: relative;
  background: var(--surface) url('/assets/img/bg1.png') center/cover no-repeat;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(15,23,42,.92) 0%, rgba(15,23,42,.78) 60%, rgba(15,23,42,.55) 100%);
  z-index: 0;
}

.header > * { position: relative; z-index: 1; }

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.header-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.5));
}

.header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.header-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0;
}

.tab {
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.tab:hover { color: var(--text); background: var(--surface-2); }

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Main content ────────────────────────────────────────── */
.content {
  padding: 0 1.5rem 2rem;
}

/* ── Summary bar ─────────────────────────────────────────── */
.summary-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.summary-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.summary-stat strong { color: var(--text); }

.summary-dot.pending  { background: var(--pending-ring); }
.summary-dot.present  { background: var(--present-ring); }
.summary-dot.absent   { background: var(--absent-ring); }

/* ── Team card ───────────────────────────────────────────── */
.team-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.team-header {
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.team-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.team-short {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.team-count-badge {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s;
}

.team-count-badge.has-present {
  background: var(--present-bg);
  color: var(--present-text);
  border-color: var(--present-ring);
}

/* ── Person buttons ──────────────────────────────────────── */
.persons-list {
  padding: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.person-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--pending-ring);
  background: var(--pending-bg);
  color: var(--pending-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.1s, transform 0.1s, background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
  line-height: 1.2;
}

.person-btn:hover  { opacity: 0.85; }
.person-btn:active { transform: scale(0.96); }

.person-btn.loading {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}

.person-btn.present {
  background: var(--present-bg);
  color: var(--present-text);
  border-color: var(--present-ring);
}

.person-btn.absent {
  background: var(--absent-bg);
  color: var(--absent-text);
  border-color: var(--absent-ring);
}

.person-icon {
  font-size: 0.7rem;
  line-height: 1;
}

/* placeholder (no name) style — same colors, slightly muted */
.person-btn.placeholder {
  font-style: italic;
  opacity: 0.75;
}

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  animation: slideIn 0.2s ease;
  pointer-events: none;
  max-width: 260px;
}

.toast.error { border-color: var(--absent-ring); color: var(--absent-text); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Live indicator ──────────────────────────────────────── */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--present-ring);
  flex-shrink: 0;
  transition: background 0.4s;
}

.live-dot.active {
  animation: live-pulse 2s ease-in-out infinite;
}

.live-dot.error {
  background: var(--absent-ring);
  animation: none;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ── Site footer ─────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem 1.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer img {
  height: 24px;
  width: auto;
  object-fit: contain;
  opacity: .6;
  /* filter: brightness(0) invert(1); */
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .header { padding: 0.75rem 1rem; }
  .tabs   { padding: 0.75rem 1rem 0; }
  .content { padding: 0 1rem 2rem; }
  .team-grid { grid-template-columns: 1fr; }
  .summary-bar { gap: 0.75rem; }
}
