/* ============================================================================
   Chamanke Workspace — Authentication UI styles (Phase 4b)
   Uses the app's existing design tokens (styles.css :root + [data-theme=dark])
   so the login screen, user menu and Users screen follow light/dark themes.
   ============================================================================ */

/* ---- Shared overlay ------------------------------------------------------- */
.auth-overlay {
  position: fixed; inset: 0; z-index: 100000;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}

/* Login fully covers the app with a branded backdrop (app must not show through). */
#authLoginOverlay { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }

/* ---- Login card ----------------------------------------------------------- */
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--bg-card, #fff);
  color: var(--text-primary, #1e293b);
  border: 1px solid var(--border-primary, #e2e8f0);
  border-radius: 14px;
  padding: 28px 26px 26px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-logo { height: 48px; width: auto; margin-bottom: 10px; object-fit: contain; }
.auth-title { font-size: 1.25rem; font-weight: 800; color: var(--text-primary, #1e293b); }
.auth-sub { font-size: 0.85rem; color: var(--text-tertiary, #94a3b8); margin-top: 2px; }

.auth-label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary, #475569); margin-top: 14px;
}
.auth-input {
  display: block; width: 100%; margin-top: 6px; box-sizing: border-box;
  padding: 10px 12px; font-size: 0.95rem;
  background: var(--bg-input, #fff); color: var(--text-primary, #1e293b);
  border: 1px solid var(--border-input, #cbd5e1); border-radius: 8px;
  font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--accent, #e52121); box-shadow: 0 0 0 3px var(--accent-light, rgba(229,33,33,0.12)); }

.auth-error { color: var(--accent, #e52121); font-size: 0.8rem; min-height: 1em; margin-top: 10px; }

.auth-btn {
  width: 100%; margin-top: 16px; padding: 11px 14px;
  background: var(--accent, #e52121); color: #fff;
  border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.auth-btn:hover { background: var(--accent-hover, #cc1b1b); }
.auth-btn:disabled { opacity: 0.6; cursor: default; }

/* ---- User menu chip (bottom-left, over the sidebar) ----------------------- */
.auth-chip {
  position: fixed; left: 14px; bottom: 14px; z-index: 9000;
  display: flex; align-items: center; gap: 9px;
  max-width: 230px; padding: 7px 9px;
  background: var(--bg-sidebar, #1e293b); color: var(--text-sidebar, #cbd5e1);
  border: 1px solid var(--border-sidebar, rgba(255,255,255,0.08)); border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}
.auth-chip-avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent, #e52121); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
}
.auth-chip-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.auth-chip-name { font-size: 0.82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-chip-role { font-size: 0.68rem; color: var(--text-sidebar, #cbd5e1); opacity: 0.8; }
.auth-chip-btn {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border: none; cursor: pointer; font-size: 0.9rem; line-height: 1;
}
.auth-chip-btn:hover { background: rgba(255, 255, 255, 0.18); }
.auth-chip-id { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 0; margin: 0; background: transparent; border: none; cursor: pointer; color: inherit; text-align: left; font-family: inherit; }
.auth-chip-id:hover .auth-chip-name { text-decoration: underline; }
.auth-chip-avatar { overflow: hidden; }
.auth-chip-avatar img, .auth-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

/* ---- Users admin screen --------------------------------------------------- */
.auth-users-card {
  width: 100%; max-width: 760px; max-height: 86vh; overflow: auto;
  background: var(--bg-modal, #fff); color: var(--text-primary, #1e293b);
  border: 1px solid var(--border-primary, #e2e8f0); border-radius: 14px;
  padding: 22px 24px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}
.auth-users-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.auth-users-head h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }

.auth-users-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.auth-users-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary, #94a3b8); padding: 6px 10px; border-bottom: 1px solid var(--border-primary, #e2e8f0); }
.auth-users-table td { padding: 9px 10px; border-bottom: 1px solid var(--border-primary, #e2e8f0); vertical-align: middle; }
.auth-access { color: var(--text-secondary, #475569); font-size: 0.8rem; }
.auth-mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 0.82rem; }

.auth-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.auth-badge-admin { background: var(--accent-light, rgba(229,33,33,0.1)); color: var(--accent, #e52121); }
.auth-badge-on { background: rgba(16, 185, 129, 0.14); color: #059669; }
.auth-badge-off { background: rgba(148, 163, 184, 0.18); color: var(--text-tertiary, #94a3b8); }

.auth-btn-sm { padding: 7px 13px; background: var(--accent, #e52121); color: #fff; border: none; border-radius: 7px; font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.auth-btn-sm:hover { background: var(--accent-hover, #cc1b1b); }
.auth-btn-sm:disabled { opacity: 0.6; cursor: default; }
.auth-btn-ghost { background: transparent; color: var(--text-secondary, #475569); border: 1px solid var(--border-input, #cbd5e1); }
.auth-btn-ghost:hover { background: var(--bg-card-hover, #f1f5f9); }

.auth-muted { color: var(--text-tertiary, #94a3b8); font-size: 0.86rem; padding: 16px 4px; }

/* ---- User editor form ----------------------------------------------------- */
.auth-user-form { margin-top: 4px; }
.auth-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; align-items: end; }
.auth-form-grid .auth-label { margin-top: 0; }
.auth-check { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary, #475569); }
.auth-check input { width: 16px; height: 16px; }

.auth-perm-block { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border-primary, #e2e8f0); border-radius: 10px; background: var(--bg-card-hover, #f1f5f9); }
.auth-perm-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary, #94a3b8); margin-bottom: 10px; }
.auth-perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 0.88rem; color: var(--text-primary, #1e293b); }
.auth-perm-row .auth-perm { width: 150px; margin-top: 0; flex: 0 0 auto; }

.auth-user-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- My Profile ----------------------------------------------------------- */
.auth-profile-card {
  width: 100%; max-width: 460px; max-height: 86vh; overflow: auto;
  background: var(--bg-modal, #fff); color: var(--text-primary, #1e293b);
  border: 1px solid var(--border-primary, #e2e8f0); border-radius: 14px;
  padding: 22px 24px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}
.auth-profile-top { display: flex; align-items: center; gap: 18px; margin: 6px 0 4px; }
.auth-profile-pic {
  flex: 0 0 auto; width: 88px; height: 88px; border-radius: 50%; overflow: hidden;
  background: var(--accent, #e52121); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700; border: 2px solid var(--border-primary, #e2e8f0);
}
.auth-profile-pic img { width: 100%; height: 100%; object-fit: cover; }
.auth-profile-picbtns { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.auth-file-label { cursor: pointer; }

@media (max-width: 560px) { .auth-form-grid { grid-template-columns: 1fr; } }
