/**
 * Admin UI Enhancements
 * Modern look and feel for admin views
 */

/* Page headers */
.admin-page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e3e6f0;
}
.admin-page-header h1,
.admin-page-header h2,
.admin-page-header h3 {
  margin: 0;
  font-weight: 600;
  color: #5a5c69;
}

/* Card improvements */
.admin-card {
  border: 1px solid #e3e6f0;
  border-radius: 0.35rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.admin-card:hover {
  box-shadow: 0 0.35rem 0.75rem rgba(0, 0, 0, 0.1);
}
.admin-card .card-header {
  background: #f8f9fc;
  border-bottom: 1px solid #e3e6f0;
  font-weight: 600;
  color: #5a5c69;
  padding: 0.75rem 1rem;
}

/* Table improvements */
.admin-table-card {
  overflow: hidden;
}
.admin-table-card .table {
  margin-bottom: 0;
}
.admin-table-card .table thead th {
  background: #f8f9fc;
  border-bottom: 1px solid #e3e6f0;
  font-weight: 600;
  color: #5a5c69;
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.admin-table-card .table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}
.admin-table-card .table tbody tr:hover {
  background-color: #f8f9fc;
}
.admin-table-card .table-bordered th,
.admin-table-card .table-bordered td {
  border-color: #e3e6f0;
}

/* Search and filter bar */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #f8f9fc;
  border-radius: 0.35rem;
  border: 1px solid #e3e6f0;
}
.admin-toolbar > * {
  margin-right: 0.75rem;
  margin-bottom: 0.5rem;
}
.admin-toolbar .input-group {
  max-width: 280px;
}
.admin-toolbar .form-control {
  border-color: #d1d3e2;
  border-radius: 0.35rem;
}
.admin-toolbar .form-control:focus {
  border-color: #4e73df;
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* Buttons */
.admin-btn-group .btn {
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}
.btn-admin-secondary {
  background-color: #858796;
  border-color: #858796;
  color: #fff;
}
.btn-admin-secondary:hover {
  background-color: #6b6d7d;
  border-color: #6b6d7d;
  color: #fff;
}

/* Action icons - replace img with icon styling */
.admin-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 0.35rem;
  transition: background-color 0.2s, color 0.2s;
}
.admin-action-btn:hover {
  text-decoration: none;
}
.admin-action-btn.btn-view {
  color: #36b9cc;
}
.admin-action-btn.btn-view:hover {
  background: rgba(54, 185, 204, 0.15);
  color: #2c9faf;
}
.admin-action-btn.btn-edit {
  color: #1cc88a;
}
.admin-action-btn.btn-edit:hover {
  background: rgba(28, 200, 138, 0.15);
  color: #17a673;
}
.admin-action-btn.btn-delete {
  color: #e74a3b;
}
.admin-action-btn.btn-delete:hover {
  background: rgba(231, 74, 59, 0.15);
  color: #be2617;
}

/* Pagination */
.admin-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e3e6f0;
}
.admin-pagination .btn {
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Settings tabs */
.admin-tabs .nav-tabs {
  border-bottom: 2px solid #e3e6f0;
  margin-bottom: 1.25rem;
}
.admin-tabs .nav-tabs .nav-link {
  border: none;
  border-bottom: 3px solid transparent;
  color: #858796;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  margin-bottom: -2px;
  border-radius: 0.35rem 0.35rem 0 0;
  transition: color 0.2s, border-color 0.2s;
}
.admin-tabs .nav-tabs .nav-link:hover {
  color: #4e73df;
  border-color: transparent;
}
.admin-tabs .nav-tabs .nav-link.active {
  color: #4e73df;
  background: transparent;
  border-bottom-color: #4e73df;
  font-weight: 600;
}
.admin-tabs .tab-content .card {
  border: 1px solid #e3e6f0;
  border-radius: 0.35rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
.admin-tabs .tab-content .card-header {
  background: #f8f9fc;
  border-bottom: 1px solid #e3e6f0;
  font-weight: 600;
  padding: 0.75rem 1rem;
}
.admin-tabs .form-group label {
  font-weight: 500;
  color: #5a5c69;
}
.admin-tabs .form-control {
  border-radius: 0.35rem;
  border-color: #d1d3e2;
}

/* Dashboard recent subscriptions - modernize */
.admin-subscription-list .list-group-item {
  border: none;
  border-bottom: 1px solid #e3e6f0;
  padding: 0.75rem 1rem;
  transition: background 0.2s;
}
.admin-subscription-list .list-group-item:last-child {
  border-bottom: none;
}
.admin-subscription-list .list-group-item:hover {
  background: #f8f9fc;
}

/* Empty state */
.admin-empty-state {
  text-align: center;
  padding: 2rem;
  color: #858796;
}
.admin-empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* Flash messages */
.alert {
  border-radius: 0.35rem;
}

/* Sidebar improvements */
.sidebar {
  transition: all 0.3s ease;
}
.sidebar-brand {
  padding: 1rem 0.5rem;
  transition: background-color 0.2s;
}
.sidebar-brand:hover {
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}
.sidebar-brand img {
  transition: transform 0.2s;
}
.sidebar-brand:hover img {
  transform: scale(1.05);
}
.sidebar .nav-item {
  margin-bottom: 0.25rem;
}
.sidebar .nav-link {
  padding: 0.75rem 1rem;
  border-radius: 0.35rem;
  margin: 0 0.5rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
}
.sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(4px);
}
.sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
}
.sidebar .nav-link i {
  width: 1.5rem;
  text-align: center;
  margin-right: 0.75rem;
  font-size: 0.9rem;
}
.sidebar .collapse-item {
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border-radius: 0.25rem;
  margin: 0.125rem 0.5rem;
  transition: all 0.2s ease;
  display: block;
  color: #5a5c69;
}
.sidebar .collapse-item:hover {
  background-color: #f8f9fc;
  color: #4e73df;
  text-decoration: none;
  transform: translateX(4px);
}
.sidebar-divider {
  border-color: rgba(255, 255, 255, 0.15);
  margin: 1rem 0;
}
.sidebar .btn-danger {
  margin: 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
}

/* Topbar/Navbar improvements */
.topbar {
  box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.1);
}
.topbar .navbar-nav .nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.35rem;
  transition: all 0.2s ease;
}
.topbar .navbar-nav .nav-link:hover {
  background-color: #f8f9fc;
}
.topbar .dropdown-toggle::after {
  margin-left: 0.5rem;
}
.topbar .badge-counter {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  font-size: 0.65rem;
  padding: 0.25rem 0.4rem;
  border-radius: 0.5rem;
}
.topbar .dropdown-menu {
  border: none;
  box-shadow: 0 0.35rem 0.75rem rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  min-width: 20rem;
}
.topbar .dropdown-header {
  font-weight: 600;
  color: #5a5c69;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e3e6f0;
}
.topbar .dropdown-item {
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f8f9fc;
}
.topbar .dropdown-item:last-child {
  border-bottom: none;
}
.topbar .dropdown-item:hover {
  background-color: #f8f9fc;
  padding-left: 1.25rem;
}
.topbar .dropdown-item i {
  width: 1.25rem;
  text-align: center;
}
.topbar-divider {
  width: 0;
  border-right: 1px solid #e3e6f0;
  height: calc(4.375rem - 2rem);
  margin: auto 1rem;
}
.icon-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

/* Quiz list filter cards */
.quiz-filter-card {
  border: 1px solid #e3e6f0;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}
.quiz-filter-card:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}
.quiz-filter-card .card-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e3e6f0;
  transition: all 0.2s ease;
  display: block;
  text-decoration: none;
  color: #5a5c69;
  font-weight: 500;
}
.quiz-filter-card .card-header:hover {
  background-color: #f8f9fc;
  color: #4e73df;
  text-decoration: none;
}
.quiz-filter-card .card-header.active {
  background-color: #4e73df;
  color: #fff;
  font-weight: 600;
}
.quiz-filter-card .card-header .badge {
  float: right;
  background-color: rgba(0, 0, 0, 0.1);
  color: inherit;
  font-weight: 600;
}
.quiz-filter-card .card-header.active .badge {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-toolbar .input-group {
    max-width: none;
  }
  .sidebar .nav-link {
    margin: 0 0.25rem;
  }
  .topbar .dropdown-menu {
    min-width: 15rem;
  }

  /* QBank: allow horizontal table pan on touch devices */
  .qbank-table-card .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  .qbank-table-card .qbank-table {
    min-width: 980px;
    margin-bottom: 0;
  }
}
