/* ─────────────────────────────────────────
   CSS Custom Properties
───────────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 0px;
  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;
  --sidebar-active-bg: #1e40af;
  --sidebar-active-text: #fff;
  --topbar-height: 60px;
  --topbar-bg: #fff;
  --topbar-border: #e2e8f0;
  --accent: #1e40af;
  --accent-light: #dbeafe;
  --body-bg: #f8fafc;
  --card-bg: #fff;
  --card-border: #e2e8f0;
  --text-primary: #0f172a;
  --text-muted: #64748b;
}

[data-bs-theme="dark"] {
  --sidebar-bg: #0d1117;
  --sidebar-border: #21262d;
  --topbar-bg: #161b22;
  --topbar-border: #21262d;
  --body-bg: #0d1117;
  --card-bg: #161b22;
  --card-border: #21262d;
  --text-primary: #e6edf3;
  --text-muted: #8b949e;
  --accent-light: #1c3a6e;
  --bg-secondary: #21262d;
}

/* ─────────────────────────────────────────
   Base
───────────────────────────────────────── */
body {
  background-color: var(--body-bg);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ─────────────────────────────────────────
   Sidebar
───────────────────────────────────────── */
#wrapper {
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  min-height: 100vh;
  transition: width 0.25s ease, min-width 0.25s ease;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

#sidebar.collapsed {
  width: 0;
  min-width: 0;
}

.sidebar-brand {
  color: #fff !important;
  white-space: nowrap;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  min-width: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-logo-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.sidebar-divider {
  border-color: var(--sidebar-border);
  margin: 0.25rem 0;
}

.sidebar-link {
  color: var(--sidebar-text) !important;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover:not(.disabled) {
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--sidebar-text-hover) !important;
}

.sidebar-link.active {
  background-color: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  font-weight: 600;
}

.sidebar-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar-footer {
  background-color: rgba(0, 0, 0, 0.2);
}

.sidebar-logout {
  color: var(--sidebar-text) !important;
  transition: color 0.15s;
}

.sidebar-logout:hover {
  color: #ef4444 !important;
}

/* ─────────────────────────────────────────
   Top Bar
───────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 99;
}

.sidebar-toggle {
  color: var(--text-muted) !important;
  transition: color 0.15s;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px !important;
}

@media (max-width: 768px) {
  .sidebar-toggle {
    /* Full topbar height tap target on mobile */
    min-height: var(--topbar-height);
    padding: 0 14px !important;
    margin-left: -12px; /* pull flush with topbar edge */
  }
}

.sidebar-toggle:hover {
  color: var(--accent) !important;
}

/* ─────────────────────────────────────────
   Page Content
───────────────────────────────────────── */
#page-content {
  min-width: 0;
  background-color: var(--body-bg);
}

main {
  padding-top: 1.5rem;
}

/* ─────────────────────────────────────────
   Avatar
───────────────────────────────────────── */
.avatar-sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
}

.avatar-md {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  overflow: hidden;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  min-width: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  overflow: hidden;
}

/* ─────────────────────────────────────────
   Avatar upload overlay
───────────────────────────────────────── */
.avatar-upload-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background 0.15s, transform 0.1s;
  border: 2px solid var(--card-bg);
}

.avatar-upload-btn:hover {
  background: #1e3a8a;
  transform: scale(1.1);
}

/* ─────────────────────────────────────────
   Stat Cards
───────────────────────────────────────── */
.stat-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ─────────────────────────────────────────
   Content Cards
───────────────────────────────────────── */
.content-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  overflow: hidden;
}

.content-card .card-header-custom {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─────────────────────────────────────────
   Auth Layout
───────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.auth-alerts {
  width: 100%;
  max-width: 460px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.auth-card-header {
  background: var(--accent);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  color: #fff;
}

.auth-card-header .auth-logo {
  width: 64px;
  height: 64px;
  background: transparent;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.auth-card-body {
  padding: 1.75rem 2rem 2rem;
}

.auth-card-body .form-label {
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.auth-card-body .form-control,
.auth-card-body .form-select {
  border-radius: 8px;
  font-size: 0.92rem;
  border-color: var(--card-border);
  padding: 0.55rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-card-body .form-control:focus,
.auth-card-body .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

.auth-card-body .btn-primary {
  background-color: var(--accent);
  border-color: var(--accent);
  border-radius: 8px;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: background-color 0.15s, transform 0.1s;
}

.auth-card-body .btn-primary:hover {
  background-color: #1e3a8a;
  border-color: #1e3a8a;
}

.auth-card-body .btn-primary:active {
  transform: scale(0.98);
}

.auth-footer-link {
  color: var(--text-muted);
  font-size: 0.87rem;
  text-align: center;
  margin-top: 1.25rem;
}

.auth-footer-link a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.auth-footer-link a:hover {
  text-decoration: underline;
}

/* ─────────────────────────────────────────
   Form Row Divider
───────────────────────────────────────── */
.form-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  margin-top: 1.25rem;
}

/* ─────────────────────────────────────────
   Responsive
───────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: 0;
    width: 0;
    min-width: 0;
  }

  #sidebar.mobile-open {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  #page-content {
    width: 100%;
  }
}

/* ─────────────────────────────────────────
   Utilities
───────────────────────────────────────── */
.icon-action-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.badge-role {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3em 0.65em;
  border-radius: 6px;
  text-transform: capitalize;
}

.text-accent { color: var(--accent); }
.bg-accent-light { background-color: var(--accent-light); }

/* ─────────────────────────────────────────
   Employee cards
───────────────────────────────────────── */
.employee-card {
  transition: box-shadow 0.2s, transform 0.15s;
}

.employee-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.emp-name:hover {
  color: var(--accent) !important;
}

.report-card {
  transition: background 0.15s;
}

.report-card:hover {
  background: var(--body-bg);
}

/* ─────────────────────────────────────────
   Recognition
───────────────────────────────────────── */
.recognition-card {
  transition: box-shadow 0.2s;
}

.recognition-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.recognition-spotlight {
  background: var(--body-bg);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.recognition-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35em 0.75em;
  border-radius: 20px;
  white-space: nowrap;
}

.recognition-badge-sm {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25em 0.6em;
  border-radius: 20px;
  white-space: nowrap;
}

.recognition-react-btn {
  border: 1px solid var(--card-border);
  border-radius: 20px;
  color: var(--text-muted);
  background: transparent;
  font-size: 0.82rem;
  padding: 0.25rem 0.75rem;
  transition: all 0.15s;
}

.recognition-react-btn:hover {
  border-color: #e11d48;
  color: #e11d48;
  background: #fce7f3;
}

.recognition-react-btn.reacted {
  border-color: #e11d48;
  color: #e11d48;
  background: #fce7f3;
}

@media print {
  #sidebar, .topbar, .no-print { display: none !important; }
  #page-content { width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .content-card { break-inside: avoid; }
}

/* ─────────────────────────────────────────
   Agenda Note Colors
───────────────────────────────────────── */
.agenda-note-card {
  border: 1px solid var(--card-border);
}

.note-color-default { background: var(--bg-secondary, #f3f4f6); }
.note-color-yellow  { background: #fef9c3; }
.note-color-blue    { background: #dbeafe; }
.note-color-green   { background: #dcfce7; }
.note-color-pink    { background: #fce7f3; }
.note-color-purple  { background: #ede9fe; }

[data-bs-theme="dark"] .note-color-yellow  { background: #713f12; }
[data-bs-theme="dark"] .note-color-blue    { background: #1e3a5f; }
[data-bs-theme="dark"] .note-color-green   { background: #14532d; }
[data-bs-theme="dark"] .note-color-pink    { background: #881337; }
[data-bs-theme="dark"] .note-color-purple  { background: #4c1d95; }

/* Scripture card dark mode */
[data-bs-theme="dark"] .scripture-card {
  background: linear-gradient(135deg, #1e1508 0%, #211a0a 100%) !important;
  border-color: #3d2e10 !important;
}
[data-bs-theme="dark"] .scripture-card .scripture-icon {
  background: #2d2006 !important;
  color: #d97706 !important;
}
[data-bs-theme="dark"] .scripture-card .scripture-label { color: #d97706 !important; }
[data-bs-theme="dark"] .scripture-card .scripture-text  { color: #c9b99a !important; }
[data-bs-theme="dark"] .scripture-card .scripture-cite  { color: #b45309 !important; }

/* Table head subtle — replaces table-light so it respects dark mode */
.thead-subtle { background: var(--bg-secondary); }
