/* ============================================================
   EduCore Admin Dashboard Styles
   ============================================================ */
:root {
  --p: #1a237e;
  --p-lt: #283593;
  --p-dk: #0d1b6e;
  --s: #e65100;
  --ac: #ffd700;
  --green: #2e7d32;
  --red: #c62828;
  --yellow: #f9a825;
  --gray: #64748b;
  --bg: #f1f5f9;
  --white: #ffffff;
  --shadow: 0 2px 12px rgba(26, 35, 126, .10);
  --radius: 12px;
  --tr: all .25s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: #1e293b;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--p-dk) 0%, var(--p) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 500;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  font-size: 2rem;
}

.sidebar-logo .logo-text {
  font-family: 'Poppins', sans-serif;
}

.sidebar-logo .s-name {
  font-weight: 800;
  color: #fff;
  font-size: .95rem;
  line-height: 1.2;
}

.sidebar-logo .s-panel {
  font-size: .7rem;
  color: rgba(255, 255, 255, .55);
  font-weight: 500;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
  padding: 14px 10px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, .75);
  font-size: .88rem;
  font-weight: 500;
  transition: var(--tr);
  margin-bottom: 2px;
  text-decoration: none;
}

.sidebar-link .icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.sidebar-link.active {
  background: var(--s);
  color: #fff;
  font-weight: 700;
}

.sidebar-link .badge {
  margin-left: auto;
  background: var(--s);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
}

.sidebar-link.active .badge {
  background: rgba(255, 255, 255, .3);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

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

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--s);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  font-size: .9rem;
}

.user-name {
  font-weight: 600;
  color: #fff;
  font-size: .88rem;
}

.user-role {
  font-size: .72rem;
  color: rgba(255, 255, 255, .5);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, .08);
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, .7);
  font-size: .84rem;
  cursor: pointer;
  transition: var(--tr);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.sidebar-logout:hover {
  background: var(--red);
  color: #fff;
}

/* ── Main Admin Content ─────────────────────────────────── */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.topbar-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--p);
  font-size: 1.1rem;
}

.topbar-breadcrumb {
  font-size: .8rem;
  color: var(--gray);
  margin-top: 2px;
}

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

.topbar-badge {
  background: var(--s);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
}

.admin-content {
  padding: 28px;
  flex: 1;
}

/* ── Stat Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid transparent;
  transition: var(--tr);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(26, 35, 126, .15);
}

.stat-icon {
  font-size: 2rem;
}

.stat-info {}

.stat-val {
  font-family: 'Poppins', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--p);
  line-height: 1;
}

.stat-lbl {
  font-size: .8rem;
  color: var(--gray);
  font-weight: 500;
  margin-top: 3px;
}

.stat-card.blue {
  border-left-color: var(--p);
}

.stat-card.blue .stat-val {
  color: var(--p);
}

.stat-card.orange {
  border-left-color: var(--s);
}

.stat-card.orange .stat-val {
  color: var(--s);
}

.stat-card.green {
  border-left-color: var(--green);
}

.stat-card.green .stat-val {
  color: var(--green);
}

.stat-card.yellow {
  border-left-color: var(--yellow);
}

.stat-card.yellow .stat-val {
  color: var(--yellow);
}

.stat-card.red {
  border-left-color: var(--red);
}

/* ── Admin Card ─────────────────────────────────────────── */
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.admin-card-header {
  padding: 16px 22px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-card-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--p);
}

.admin-card-body {
  padding: 22px;
}

/* ── Tables ─────────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: var(--bg);
  color: var(--gray);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
  padding: 13px 16px;
  font-size: .88rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

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

.admin-table tr:hover td {
  background: #f8fafc;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  text-transform: capitalize;
}

.badge-pending {
  background: #fff3e0;
  color: #e65100;
}

.badge-under_review {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-accepted {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-rejected {
  background: #ffebee;
  color: #c62828;
}

.badge-published {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-draft {
  background: #f5f5f5;
  color: #616161;
}

.badge-upcoming {
  background: #e8eaf6;
  color: #3949ab;
}

.badge-completed {
  background: #f5f5f5;
  color: #616161;
}

.badge-read {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-unread {
  background: #ffebee;
  color: #c62828;
}

/* ── Buttons (Admin) ────────────────────────────────────── */
.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  border: none;
  transition: var(--tr);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.btn-primary-sm {
  background: var(--p);
  color: #fff;
}

.btn-primary-sm:hover {
  background: var(--p-dk);
}

.btn-success-sm {
  background: var(--green);
  color: #fff;
}

.btn-success-sm:hover {
  background: #1b5e20;
}

.btn-warning-sm {
  background: var(--yellow);
  color: #333;
}

.btn-warning-sm:hover {
  background: #f57f17;
}

.btn-danger-sm {
  background: var(--red);
  color: #fff;
}

.btn-danger-sm:hover {
  background: #b71c1c;
}

.btn-secondary-sm {
  background: var(--s);
  color: #fff;
}

.btn-secondary-sm:hover {
  background: #bf360c;
}

.btn-outline-sm {
  background: transparent;
  color: var(--p);
  border: 1.5px solid var(--p);
}

.btn-outline-sm:hover {
  background: var(--p);
  color: #fff;
}

.btn-gray-sm {
  background: #e2e8f0;
  color: #475569;
}

.btn-gray-sm:hover {
  background: #cbd5e1;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--s);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: .88rem;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: var(--tr);
  text-decoration: none;
}

.btn-add:hover {
  background: #bf360c;
  transform: translateY(-1px);
}

/* ── Forms (Admin) ──────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: .84rem;
  color: var(--p);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 9px;
  font-size: .88rem;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
  background: #fff;
  transition: var(--tr);
  outline: none;
}

.form-control:focus {
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgba(26, 35, 126, .1);
}

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

select.form-control {
  cursor: pointer;
}

.form-help {
  font-size: .76rem;
  color: var(--gray);
  margin-top: 4px;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--white);
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from {
    transform: scale(.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--p);
  font-size: 1rem;
}

.modal-close {
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--gray);
  border: none;
  background: none;
  transition: var(--tr);
}

.modal-close:hover {
  color: var(--red);
  transform: rotate(90deg);
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Flash ──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: .88rem;
  font-weight: 500;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #ef5350;
}

.alert-warning {
  background: #fff8e1;
  color: #f57f17;
  border-left: 4px solid #ffc107;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border-left: 4px solid #2196f3;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.page-link {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: .84rem;
  font-weight: 600;
  background: var(--white);
  color: var(--p);
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  transition: var(--tr);
  text-decoration: none;
}

.page-link:hover {
  background: var(--p);
  color: #fff;
  border-color: var(--p);
}

.page-link.active {
  background: var(--p);
  color: #fff;
  border-color: var(--p);
}

.page-link.disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ── Search / Filter Bar ────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.search-input {
  padding: 9px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 9px;
  font-size: .87rem;
  outline: none;
  transition: var(--tr);
  flex: 1;
  min-width: 180px;
}

.search-input:focus {
  border-color: var(--p);
}

.filter-select {
  padding: 9px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 9px;
  font-size: .87rem;
  outline: none;
  transition: var(--tr);
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--p);
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: .5;
}

.empty-state h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  margin-bottom: 8px;
  color: #94a3b8;
}

/* ── Image Preview ──────────────────────────────────────── */
.img-preview {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 7px;
  border: 2px solid #e2e8f0;
}

.upload-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.upload-preview-img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  display: none;
}

/* Sidebar toggle button (hidden on desktop) */
.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--p);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 8px;
  transition: var(--tr);
}

.sidebar-toggle:hover {
  background: #f1f5f9;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar-toggle {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-260px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .admin-content {
    padding: 16px;
  }
}

/* Login page */
.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--p-dk) 0%, var(--p) 60%, var(--p-lt) 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .icon {
  font-size: 3.5rem;
  display: block;
}

.login-logo h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  color: var(--p);
  font-size: 1.4rem;
  margin-top: 8px;
}

.login-logo p {
  color: var(--gray);
  font-size: .85rem;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--p), var(--p-lt));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--tr);
  margin-top: 6px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(26, 35, 126, .4);
}

.login-lock-msg {
  background: #fff3e0;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 12px 16px;
  color: #e65100;
  font-size: .85rem;
  margin-bottom: 16px;
}

.login-error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  padding: 12px 16px;
  color: #c62828;
  font-size: .85rem;
  margin-bottom: 16px;
}