/* ============================================================
   ONE ABOVE KENYA — ADMIN CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:        #080b0e;
  --bg-2:      #0e1318;
  --bg-3:      #141b22;
  --bg-4:      #1a2535;
  --border:    rgba(255,255,255,.08);
  --blue:      #00b4f0;
  --blue-dark: #0090c8;
  --gold:      #c9a84c;
  --red:       #f87171;
  --green:     #4ade80;
  --text:      #e8edf2;
  --text-muted:#8a9bb0;
  --white:     #ffffff;
  --radius:    8px;
  --radius-lg: 12px;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: .9rem;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar__logo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar__logo-img img { width: 100%; height: 100%; object-fit: cover; }

.sidebar__logo-text {
  font-size: .875rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.25;
}
.sidebar__logo-sub {
  font-size: .65rem;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sidebar__nav { padding: 1rem 0; flex: 1; }

.sidebar__section-label {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .8rem 1.25rem .3rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem 1.25rem;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 400;
  transition: color var(--transition), background var(--transition);
  border-radius: 0;
  position: relative;
}
.sidebar__link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar__link:hover { color: var(--white); background: rgba(255,255,255,.04); }
.sidebar__link--active {
  color: var(--blue);
  background: rgba(0,180,240,.08);
  font-weight: 500;
}
.sidebar__link--active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

.sidebar__badge {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}

.sidebar__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.sidebar__logout {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .82rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.sidebar__logout svg { width: 15px; height: 15px; }
.sidebar__logout:hover { color: var(--red); }

/* ---------- Main Content ---------- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}

.topbar__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.topbar__view-site {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: .4rem .85rem;
  border-radius: var(--radius);
  transition: color var(--transition), border-color var(--transition);
}
.topbar__view-site svg { width: 14px; height: 14px; }
.topbar__view-site:hover { color: var(--blue); border-color: var(--blue); }

.topbar__user {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .82rem;
  color: var(--text-muted);
}

/* ---------- Content Area ---------- */
.admin-content { padding: 2rem; flex: 1; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: rgba(0,180,240,.3); }

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card__icon--blue  { background: rgba(0,180,240,.12); color: var(--blue); }
.stat-card__icon--gold  { background: rgba(201,168,76,.12); color: var(--gold); }
.stat-card__icon--green { background: rgba(74,222,128,.12); color: var(--green); }
.stat-card__icon--red   { background: rgba(248,113,113,.12); color: var(--red); }

.stat-card__num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  margin-bottom: .2rem;
}
.stat-card__lbl {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ============================================================
   PANEL / TABLE
   ============================================================ */
.panel {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.panel__title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--white);
}

.panel__body { padding: 1.5rem; }

/* Table */
.tbl-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.tbl th {
  text-align: left;
  padding: .7rem 1rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }

.tbl__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge--green  { background: rgba(74,222,128,.12); color: var(--green);   border: 1px solid rgba(74,222,128,.25); }
.badge--red    { background: rgba(248,113,113,.12); color: var(--red);     border: 1px solid rgba(248,113,113,.25); }
.badge--blue   { background: rgba(0,180,240,.12);  color: var(--blue);    border: 1px solid rgba(0,180,240,.25); }
.badge--yellow { background: rgba(201,168,76,.12); color: var(--gold);    border: 1px solid rgba(201,168,76,.25); }
.badge--gray   { background: rgba(138,155,176,.1); color: var(--text-muted); border: 1px solid var(--border); }

/* ============================================================
   BUTTONS (ADMIN)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer;
  white-space: nowrap;
  border: none;
}
.btn svg { width: 14px; height: 14px; }

.btn--primary { background: var(--blue);  color: var(--white); }
.btn--primary:hover { background: var(--blue-dark); }

.btn--danger  { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.btn--danger:hover  { background: var(--red); color: var(--white); }

.btn--ghost   { border: 1px solid var(--border); color: var(--text-muted); background: transparent; }
.btn--ghost:hover   { border-color: var(--blue); color: var(--blue); }

.btn--sm { padding: .35rem .75rem; font-size: .78rem; }
.btn--icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 6px; }

/* ============================================================
   FORMS (ADMIN)
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.col-span-2 { grid-column: span 2; }

.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  margin-bottom: .4rem;
  color: var(--text);
}
.form-label span { color: var(--red); margin-left: .2rem; }

.form-control {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  padding: .6rem .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,180,240,.12);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 120px; }

.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { font-size: .75rem; color: var(--red); margin-top: .3rem; }

.form-check {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  font-size: .85rem;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

@media (max-width: 640px) {
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
}

/* ============================================================
   IMAGE UPLOAD PREVIEW
   ============================================================ */
.img-preview-wrap {
  margin-top: .75rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .8rem;
  transition: border-color var(--transition);
  cursor: pointer;
}
.img-preview-wrap:hover { border-color: var(--blue); }
.img-preview-wrap img { max-height: 180px; border-radius: 6px; margin: 0 auto; }

/* Media grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.media-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
  position: relative;
}
.media-item:hover { border-color: rgba(0,180,240,.3); }

.media-item__select {
  position: absolute;
  top: .4rem;
  left: .4rem;
  z-index: 2;
  cursor: pointer;
}
.media-item__select input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--blue);
}
.media-item.is-checked {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,180,240,.25);
}
.media-item__thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}
.media-item__placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.media-item__body {
  padding: .65rem;
}
.media-item__name {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .5rem;
}
.media-item__actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.alert--success { background: rgba(74,222,128,.1);  border-color: rgba(74,222,128,.25);  color: var(--green); }
.alert--error   { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); color: var(--red); }
.alert--info    { background: rgba(0,180,240,.1);   border-color: rgba(0,180,240,.25);   color: var(--blue); }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.admin-login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(0,180,240,.08) 0%, transparent 60%);
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}
.login-card__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  text-align: center;
}
.login-card__logo-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(201,168,76,.15);
  overflow: hidden;
  margin-bottom: 1rem;
}
.login-card__logo-wrap img { width: 100%; height: 100%; object-fit: cover; }
.login-card__logo h2 { font-size: 1.4rem; margin-bottom: .25rem; }
.login-card__logo p  { font-size: .82rem; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: .35; }
.empty-state h4  { font-size: 1rem; color: var(--text); margin-bottom: .5rem; }
.empty-state p   { font-size: .875rem; margin-bottom: 1.5rem; }

/* ============================================================
   MESSAGE DETAIL
   ============================================================ */
.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}
.message-meta__item { display: flex; flex-direction: column; gap: .2rem; }
.message-meta__label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.message-meta__value { font-size: .9rem; color: var(--white); }

.message-body {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-size: .95rem;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 680px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    transition: transform .3s ease;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  #sidebar-toggle { display: flex !important; }
}
