/* =========================================================
   Agile AI University — Admin Base Styles
   ---------------------------------------------------------
   Version: v2.0.0 (Design-System Ready)
   Date: 2026-03-29

   PURPOSE:
   - Structure ONLY (no visual overrides)
   - Compatible with refinement + surface CSS
   - No global component conflicts

========================================================= */


/* ===============================
   BASE
=============================== */
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg-main);
  color: var(--text-main);
}


/* ===============================
   TOP BAR
=============================== */
.topbar {
  background: #111827;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  font-size: 20px;
  margin: 0;
}

.topbar .user {
  display: flex;
  gap: 12px;
  align-items: center;
}


/* ===============================
   ROLE BADGE
=============================== */
.role-badge {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #111;
}

.role-super_admin {
  background: #111;
  color: #fff;
}

.role-admin {
  background: #2563eb;
  color: #fff;
}


/* ===============================
   ADMIN WARNING
=============================== */
.admin-warning {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.admin-warning.hidden {
  display: none;
}


/* ===============================
   LAYOUT
=============================== */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  border-bottom: 1px solid var(--border);
}

.sidebar a {
  display: block;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text-main);
}

.sidebar a:hover {
  background: rgba(37, 99, 235, 0.08);
}

.sidebar a.active {
  font-weight: 600;
  border-left: 3px solid var(--primary);
  padding-left: 13px;
  background: rgba(37, 99, 235, 0.12);
}


/* ===============================
   CONTENT
=============================== */
.content {
  flex: 1;
  padding: 24px;
  width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

.hidden {
  display: none;
}


/* ===============================
   BUTTONS (BASE ONLY)
=============================== */
button {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}


/* ===============================
   INPUTS (STRUCTURE ONLY)
=============================== */
input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  box-sizing: border-box;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-main);
}

input:focus,
select:focus {
  outline: none;
}


/* ===============================
   FORM SYSTEM
=============================== */
.form-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.form-field label {
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.lead-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 20px;
}

.form-field.full {
  grid-column: span 3;
}

.form-actions {
  grid-column: span 3;
  margin-top: 8px;
}


/* ===============================
   PAGE STRUCTURE
=============================== */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
}


/* ===============================
   CARD (STRUCTURE ONLY)
=============================== */
.card {
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.card h3 {
  margin-bottom: 16px;
  font-size: 18px;
}


/* ===============================
   METRICS
=============================== */
.metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.metric-card {
  padding: 14px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border);
}


/* ===============================
   FILTER BAR
=============================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

.filter-bar select,
.filter-bar input {
  height: 38px;
  border-radius: 8px;
  padding: 0 10px;
}


/* ===============================
   TABLE WRAPPER ONLY (NO GLOBAL TABLE)
=============================== */
.table-wrapper {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}


/* ===============================
   INLINE INPUT
=============================== */
.inline-input {
  width: 100%;
  border: none;
  background: transparent;
}

.inline-input:focus {
  outline: 2px solid var(--primary);
}


/* ===============================
   SCORE COLORS
=============================== */
.score-high { color: #15803d; font-weight: 600; }
.score-mid { color: #b45309; font-weight: 600; }
.score-low { color: #b91c1c; font-weight: 600; }


/* ===============================
   FOOTER
=============================== */
.admin-footer {
  margin-top: 40px;
  padding: 20px;
  border-top: 1px solid var(--border);
}

.admin-footer .footer-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}


/* ===============================
   APP LOADING
=============================== */
body.app-loading #loginView,
body.app-loading #appView,
body.app-loading #adminNav {
  display: none !important;
}

#appView {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.3s ease;
}

body:not(.app-loading) #appView {
  opacity: 1;
  transform: translateY(0);
}