/* ═══════════════════════════════════════════
   EVERBLOG ADMIN — Light Theme
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c1:       #6c63ff;
  --c1-light: #ede9ff;
  --c1-dark:  #4f46e5;
  --bg:       #f8f9fc;
  --bg2:      #ffffff;
  --bg3:      #f1f3f8;
  --border:   #e4e7ef;
  --text:     #1a1d2e;
  --muted:    #8b92a9;
  --dark:     #0f111a;
  --white:    #ffffff;
  --success:  #16a34a;
  --warning:  #d97706;
  --danger:   #dc2626;
  --info:     #0ea5e9;
  --sidebar-w: 230px;
  --r: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--c1);
  letter-spacing: -.3px;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  padding: 14px 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--c1);
}

.nav-item.active {
  background: var(--c1-light);
  color: var(--c1-dark);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}

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

.avatar {
  width: 34px;
  height: 34px;
  background: var(--c1);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-info strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-info span {
  font-size: 11px;
  color: var(--muted);
}

/* ── Topbar ────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.topbar h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Content area ──────────────────────────── */
.content {
  padding: 24px 28px;
  flex: 1;
  max-width: 1300px;
  width: 100%;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
}

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

.btn-primary {
  background: var(--c1);
  color: #fff;
  border-color: var(--c1);
}
.btn-primary:hover { background: var(--c1-dark); border-color: var(--c1-dark); }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg3); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn:disabled, .btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
}

.card-body { padding: 20px; }

/* ── Forms ─────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--c1);
  box-shadow: 0 0 0 3px rgba(108,99,255,.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b92a9' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ── Alerts ────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
.alert-danger   { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.alert-warning  { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-info     { background: #f0f9ff; border-color: #7dd3fc; color: #0369a1; }

/* ── Tables ────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }

tbody td {
  padding: 11px 14px;
  color: var(--text);
  vertical-align: middle;
}

/* ── Badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #dcfce7; color: var(--success); }
.badge-warning { background: #fef3c7; color: var(--warning); }
.badge-danger  { background: #fee2e2; color: var(--danger); }
.badge-info    { background: #e0f2fe; color: var(--info); }
.badge-muted   { background: var(--bg3); color: var(--muted); }
.badge-accent  { background: var(--c1-light); color: var(--c1-dark); }

/* ── Portal dot ────────────────────────────── */
.portal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Pagination ────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--white);
  transition: all .15s;
}

.pagination a:hover { background: var(--bg3); border-color: var(--c1); color: var(--c1); }
.pagination .current { background: var(--c1); color: #fff; border-color: var(--c1); font-weight: 700; }

/* ── Stats grid ────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
}

/* ── Search & Filters ──────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-control {
  width: auto;
  min-width: 200px;
}

/* ── Tab pills ─────────────────────────────── */
.tab-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-pills a, .tab-pills span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--white);
  transition: all .15s;
  cursor: pointer;
}

.tab-pills a:hover { background: var(--bg3); color: var(--text); }
.tab-pills a.active, .tab-pills span.active {
  background: var(--c1);
  color: #fff;
  border-color: var(--c1);
}

/* ── Role colors ───────────────────────────── */
.role-superadmin { color: var(--c1); font-weight: 700; }
.role-admin { color: var(--warning); }
.role-editor { color: var(--success); }

/* ── Utility ───────────────────────────────── */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--c1); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w-full { width: 100%; }

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}

/* ── Portal Cards (Dashboard) ──────────────── */
.portals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
}

.portal-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}

.portal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.portal-card-header {
  height: 6px;
}

.portal-name {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--dark);
}

.portal-domain {
  padding: 0 18px 14px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.portal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 14px 18px;
}

.portal-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 600;
}

.portal-stat strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
}

.portal-actions {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  flex-wrap: wrap;
}

/* ── Dashboard Stats ───────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  padding: 20px;
}

.dashboard-stats .stat-card {
  border-top: 3px solid var(--c1);
}
