/* ================= ADMIN UI ================= */

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: #f4f7fb;
}

.admin-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 240px;
  min-width: 240px;      /* ✅ Prevent shrinking */
  flex-shrink: 0;        /* ✅ Lock sidebar size */
  background: #020617;
  color: #e5e7eb;
  padding: 20px;
}

.admin-sidebar h2 {
  margin-bottom: 20px;
}

.admin-sidebar ul {
  list-style: none;
  padding: 0;
}

.admin-sidebar li {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
}

.admin-sidebar li:hover,
.admin-sidebar li.active {
  background: #1e293b;
}

/* Main */
.admin-main {
  flex: 1;
  padding: 30px;
}

.admin-main h1 {
  margin-bottom: 20px;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.stat-card {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.stat-card h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.stat-card p {
  font-size: 24px;
  font-weight: bold;
}

/* Placeholder */
.admin-placeholder {
  margin-top: 40px;
  padding: 20px;
  background: #ffffff;
  border-radius: 12px;
}

/* ================= ADMIN TABLE ================= */

.admin-section {
  margin-top: 40px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.admin-table th {
  background: #f1f5f9;
}

.active {
  color: #16a34a;
  font-weight: 600;
}

.inactive {
  color: #dc2626;
  font-weight: 600;
}

/* ================= ADMIN LOGOUT ================= */

.admin-logout {
  margin-top: 40px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #dc2626;
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
}

.admin-logout:hover {
  background: #b91c1c;
}

/* ================= SIDEBAR LINKS ================= */
.admin-sidebar a {
  color: #ffffff;
  text-decoration: none;
  display: block;
  width: 100%;
}

.admin-sidebar a:visited {
  color: #ffffff;
}

.admin-sidebar a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Active menu item */
.admin-sidebar .active a {
  background: rgba(255, 255, 255, 0.25);
  font-weight: 600;
}

.admin-form {
  max-width: 600px;
  margin-bottom: 30px;
}

.admin-form textarea,
.admin-form input,
.admin-form select {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.admin-form button {
  padding: 10px 16px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.admin-form button:hover {
  background: #1d4ed8;
}

.danger-btn {
  padding: 6px 10px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.danger-btn:hover {
  background: #b91c1c;
}

.edit-btn {
  padding: 6px 10px;
  background: #16a34a;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 6px;
}

.edit-btn:hover {
  background: #15803d;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}

.stat-box {
  background: #1e293b;
  padding: 20px;
  border-radius: 12px;
  color: white;
  text-align: center;
}

.stat-box p {
  font-size: 28px;
  margin: 0;
  font-weight: bold;
}

/* ================= EXAMS PAGE CLEAN LAYOUT ================= */

.exams-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.exams-header h2 {
  margin: 0;
}

.create-exam-box {
  background: #ffffff;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.create-exam-box input {
  width: 260px;
  padding: 8px;
  margin-right: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.create-exam-box button {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: white;
  cursor: pointer;
}

.create-exam-box button:hover {
  background: #1d4ed8;
}

.admin-table {
  margin-top: 10px;
}

/* ================= EXAMS PAGE SIMPLE LAYOUT ================= */

.exams-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.exams-header h2 {
  margin: 0;
}

#createExamBtn {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

#createExamBtn:hover {
  background: #1d4ed8;
}

#createExamForm {
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}

#createExamForm input {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#createExamForm button {
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
}

#createExamForm button:hover {
  background: #15803d;
}

.admin-table {
  width: 100%;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
}

/* ================= ADMIN UI POLISH ================= */

.stat-box {
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transition: transform 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-3px);
}

.admin-sidebar li:hover {
  padding-left: 16px;
}

.admin-main h1, 
.admin-main h2 {
  letter-spacing: 0.5px;
}

/* Mobile */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 100%;
  }

  .admin-table {
    font-size: 13px;
  }
}

.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
}

.main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}


.badge-green {
  background: #22c55e;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.badge-gray {
  background: #64748b;
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}


/* ===== Coupon Page Enhancements ===== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  margin-top: 12px;
}

.form-grid input {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #0b5ed7);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.9;
}

.card h3 {
  margin-bottom: 12px;
}

.admin-table td, 
.admin-table th {
  padding: 10px;
}

.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: #f1f5f9;
}

.admin-sidebar {
  width: 240px;
  background: #0f172a;
  color: white;
  padding: 20px;
}

/* ===== FORCE SIDEBAR LAYOUT FIX ===== */

.admin-wrapper {
  display: flex !important;
  flex-direction: row !important;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}

.main {
  flex: 1;
  width: calc(100% - 240px);
  overflow-x: hidden;
}

/* ===== Coupon Enhancements ===== */

.progress {
  background: #e5e7eb;
  height: 6px;
  border-radius: 4px;
  margin-top: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge.active {
  background: #dcfce7;
  color: #166534;
}

.badge.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  background: #3b82f6;
  color: white;
}

.btn-sm.danger {
  background: #ef4444;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-grid h2 {
  font-size: 28px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(320px,1fr));
  gap: 20px;
}

#modulesList li,
#lessonsList li {
  padding: 8px;
  margin: 4px 0;
  background: #f1f5f9;
  border-radius: 6px;
  cursor: pointer;
}

#modulesList li:hover,
#lessonsList li:hover {
  background: #e0e7ff;
}

#modulesList li.active {
  background: #6366f1;
  color: white;
  font-weight: 600;
}

#modulesList li,
#lessonsList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#modulesList button,
#lessonsList button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

#modulesList li,
#lessonsList li {
  cursor: grab;
}

#modulesList li:active,
#lessonsList li:active {
  cursor: grabbing;
  opacity: 0.7;
}

.mobile-toggle {
  display: none;
  background: #2563eb;
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 12px;
  width: fit-content;
  font-weight: 600;
}

/* ================= MOBILE RESPONSIVE ================= */
@media (max-width: 768px) {

  .mobile-toggle {
    display: inline-block;
  }

  .admin-wrapper {
    flex-direction: column;
  }

  .admin-sidebar {
    position: fixed;
    width: 240px;
    height: 100vh;
    left: -240px;
    top: 0;
    background: #0f172a;
    transition: left 0.3s ease;
    z-index: 1000;
  }

  .admin-sidebar.active {
    left: 0;
  }

  .main {
    margin-left: 0;
    padding: 12px;
  }

  .card {
    padding: 12px;
  }

  button {
    padding: 10px;
    font-size: 15px;
  }
}

/* ================= MOBILE SIDEBAR HARD OVERRIDE ================= */
@media (max-width: 768px) {

  body {
    overflow-x: hidden;
  }

  .admin-wrapper {
    display: block !important;
  }

  /* Sidebar hidden by default */
  #adminSidebar {
    position: fixed !important;
    top: 0 !important;
    left: -280px !important;   /* ⛔ Hidden off screen */
    width: 260px !important;
    height: 80vh !important;
    background: #020617 !important;
    z-index: 99999 !important;
    transition: left 0.3s ease !important;
    display: block !important;
  }

  /* Sidebar visible when active */
  #adminSidebar.active {
    left: 0 !important;       /* ✅ Slide into view */
  }

  /* Main content full width */
  .main {
    width: 100% !important;
    margin-left: 0 !important;
  }

  /* Menu button visible */
  .mobile-toggle {
    display: inline-block !important;
    position: sticky;
    top: 10px;
    z-index: 100000;
  }
}

.stat-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-link:hover .stat-box {
  transform: translateY(-3px) scale(1.02);
  transition: 0.2s ease;
  cursor: pointer;
}

