/* ============================================================
   ASoC Activity Engine — Custom Dark Theme
   Built on Bootstrap 5.3 dark mode (data-bs-theme="dark")
   ============================================================ */

/* --- Design tokens ---------------------------------------- */
:root {
  --sidebar-width: 256px;
  --navbar-h: 64px;

  --bg-app:      #0d1117;
  --bg-surface:  #161b22;
  --bg-elevated: #21262d;
  --border:      #30363d;

  --text-primary: #e6edf3;
  --text-muted:   #8b949e;

  --blue:         #58a6ff;
  --blue-subtle:  rgba(88, 166, 255, 0.1);
  --green:        #3fb950;
  --orange:       #d29922;
  --red:          #f85149;
}

/* Bootstrap overrides */
[data-bs-theme="dark"] {
  --bs-body-bg:       var(--bg-app);
  --bs-body-color:    var(--text-primary);
  --bs-border-color:  var(--border);
  --bs-card-bg:       var(--bg-surface);
}

/* ============================================================
   AUTH PAGES (login, register)
   ============================================================ */
.auth-body {
  background: var(--bg-app);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(ellipse at 15% 50%, rgba(88,166,255,.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(63,185,80,.04) 0%, transparent 55%);
}

.auth-container {
  width: 100%;
  max-width: 460px;
  padding: 1rem;
}

/* Wider container for registration */
.auth-container-wide {
  max-width: 600px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem 2.5rem;
}

@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1.25rem; }
}

.auth-brand { text-align: center; margin-bottom: 1.75rem; }

.auth-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--blue-subtle);
  border: 1px solid rgba(88,166,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--blue);
  margin: 0 auto .875rem;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: .25rem;
  letter-spacing: -.02em;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: .875rem;
  margin: 0;
}

.btn-auth { padding: .55rem; font-weight: 600; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-app);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  height: var(--navbar-h);
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.025em;
  flex-shrink: 0;
  box-sizing: border-box;
}
.sidebar-brand i { color: var(--blue); font-size: 1.3rem; }

.sidebar-nav { flex: 1; padding: .875rem .625rem; }

.sidebar-section-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: .4rem .625rem .2rem;
  margin: 0;
}

.sidebar-nav-list { list-style: none; padding: 0; margin: 0; }
.sidebar-nav-list li { margin-bottom: 2px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .45rem .625rem;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: color .12s, background .12s;
}
.sidebar-link:hover  { color: var(--text-primary); background: var(--bg-elevated); }
.sidebar-link.active { color: var(--blue); background: var(--blue-subtle); }
.sidebar-link.disabled { opacity: .45; cursor: default; pointer-events: none; }
.sidebar-link i { font-size: .9375rem; width: 1.1rem; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: .875rem .625rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: .625rem;
}

.sidebar-user-info { min-width: 0; }
.sidebar-username   { font-size: .875rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-role       { font-size: .7rem; color: var(--text-muted); }

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 999;
  cursor: pointer;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.top-navbar {
  height: var(--navbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sidebar-toggle {
  display: none;
  color: var(--text-muted);
  padding: .375rem;
  line-height: 1;
  text-decoration: none;
}

.navbar-page-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content { flex: 1; padding: 1.5rem; }


/* ============================================================
   AVATAR
   ============================================================ */
.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue-subtle);
  border: 1px solid rgba(88,166,255,.25);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .875rem;
  flex-shrink: 0;
}

.avatar-circle-sm {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .7rem;
  flex-shrink: 0;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.125rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.stat-card-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .125rem; }
.stat-card-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card-value.stat-placeholder { color: var(--text-muted); font-size: 1.25rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.card-header-custom {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: .875rem 1.25rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-custom {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: var(--border);
  font-size: .875rem;
}

.table-custom thead th {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .055em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: .625rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.table-custom tbody td {
  padding: .75rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.table-custom tbody tr:last-child td { border-bottom: none; }

.table-custom tbody tr:hover { background: rgba(255,255,255,.02); }

/* ============================================================
   STATUS DOTS
   ============================================================ */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.status-active   { background: var(--green);     box-shadow: 0 0 0 2px rgba(63,185,80,.2); }
.status-inactive { background: var(--text-muted); }

/* ============================================================
   INVITATION CODE DISPLAY
   ============================================================ */
.invitation-code {
  font-family: ui-monospace, 'Courier New', monospace;
  font-size: .78rem;
  background: var(--bg-elevated);
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  max-width: 180px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  cursor: default;
}

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.welcome-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.125rem 1.375rem;
}

/* ============================================================
   TASK PREVIEW CARD (on dashboard)
   ============================================================ */
.task-preview-card {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .875rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.task-preview-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.empty-state-icon { font-size: 2.75rem; color: var(--text-muted); opacity: .35; margin-bottom: .875rem; }
.empty-state-title { font-size: .9375rem; font-weight: 600; color: var(--text-primary); margin-bottom: .4rem; }
.empty-state-text  { font-size: .875rem; color: var(--text-muted); margin-bottom: 1.125rem; }

/* ============================================================
   VERSION BADGE
   ============================================================ */
.version-badge {
  font-size: .7rem;
  font-weight: 600;
  font-family: ui-monospace, 'Courier New', monospace;
  color: var(--text-muted);
  letter-spacing: .03em;
  opacity: .7;
}

/* ============================================================
   TOAST CONTAINER
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast-container .toast { pointer-events: all; min-width: 260px; }

/* ============================================================
   RESPONSIVE — mobile
   ============================================================ */
@media (max-width: 767.98px) {
  .sidebar          { transform: translateX(-100%); }
  .sidebar.open     { transform: translateX(0); }
  .main-wrapper     { margin-left: 0; }
  .sidebar-toggle   { display: block; }
  .page-content     { padding: 1rem; }
  .top-navbar       { padding: 0 1rem; }
  .auth-card        { padding: 1.5rem 1.25rem; }
}
