@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Source+Serif+4:wght@500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #efefef;
  --surface: #ffffff;
  --surface-muted: #f3f3f3;
  --border: #0f0f0f;
  --border-soft: #d0d3d8;
  --border-strong: #000000;
  --text: #0f0f0f;
  --text-muted: #545b64;
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.08);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, #f7f7f7 0%, #ededed 100%),
    radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.06) 1px, transparent 0);
  background-size: 100% 100%, 22px 22px;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.65;
}

a {
  color: var(--text);
  text-decoration: none;
}

a:hover {
  color: var(--text);
  text-decoration: underline;
}

.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: none;
}

.navbar-brand {
  font-weight: 600;
  letter-spacing: 0.4px;
  font-family: "Source Serif 4", "IBM Plex Sans", serif;
}

.navbar.navbar-dark .navbar-brand,
.navbar.navbar-dark .nav-link,
.navbar.navbar-dark .navbar-toggler {
  color: var(--text) !important;
}

.navbar .nav-link {
  font-weight: 600;
  color: var(--text);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.navbar .nav-link:hover {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--border);
}

.navbar-nav {
  gap: 0.25rem;
}

.navbar .nav-link.active {
  border-color: var(--border-strong);
  background: var(--surface-muted);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.nav-btn:hover {
  background: #eef1f4;
  text-decoration: none;
}

.navbar.navbar-dark .navbar-toggler {
  border-color: var(--border);
}

.navbar.navbar-dark .navbar-toggler-icon {
  filter: grayscale(100%);
}

.dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.dropdown-item:hover {
  background: var(--surface-muted);
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
  min-height: 100vh;
  padding: 0;
}

.sidebar .nav-link {
  color: var(--text);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  font-weight: 600;
  letter-spacing: 0.1px;
}

.sidebar .nav-link:hover {
  background: var(--surface-muted);
}

.sidebar .nav-link.active {
  background: #e0e0e0;
  font-weight: 600;
  border-left: 3px solid var(--text);
  color: #000;
}

.sidebar-header {
  padding: 1.2rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-muted);
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.nav-section {
  padding: 0.5rem 0;
}

.sidebar .nav-link i {
  width: 18px;
  margin-right: 0.5rem;
  opacity: 0.7;
}

.sidebar .nav-link.active i {
  opacity: 1;
}

.main-content {
  padding: 2rem;
  min-height: 100vh;
}

.content-wrapper {
  margin: 1.5rem 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.card-header {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

.simple-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

h1,
h2,
h3,
h4,
h5 {
  color: var(--text);
  font-weight: 600;
  font-family: "Source Serif 4", "IBM Plex Sans", serif;
  letter-spacing: 0.2px;
}

.table {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.table thead th {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.table td,
.table th {
  border-color: var(--border-soft);
}

.table tbody tr:hover {
  background: #f0f1f3;
}

.table .form-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.table .form-check {
  padding: 0;
  margin: 0;
  min-height: auto;
  display: flex;
  justify-content: center;
}

/* Custom Checkbox Style (Black Tick) */
.form-check-input:checked {
  background-color: #ffffff;
  border-color: #000000;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  border-color: #000000;
  box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
}


.table th:first-child,
.table td:first-child {
  width: 40px;
  text-align: center;
  vertical-align: middle;
}

.btn {
  border-radius: 8px;
  border: 1px solid var(--border);
  font-weight: 600;
}

.btn-primary {
  background: #1f2933;
  border-color: #1f2933;
  color: #fff;
}

.btn-primary:hover {
  background: #11171d;
  border-color: #11171d;
  color: #fff;
}

.btn-success,
.btn-danger,
.btn-warning,
.btn-info {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e9ecef;
  color: var(--text);
}

.btn-outline-primary,
.btn-outline-danger,
.btn-outline-success,
.btn-outline-warning,
.btn-outline-info {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline-primary:hover,
.btn-outline-danger:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.alert {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
}

.alert-success,
.alert-danger,
.alert-info,
.alert-warning,
.alert-primary,
.alert-secondary {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text);
}

.badge {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.08);
}

.pagination .page-link {
  border-color: var(--border);
  color: var(--text);
}

.pagination .page-item.active .page-link {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text);
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-primary,
.text-success,
.text-danger,
.text-warning,
.text-info,
.text-secondary {
  color: var(--text) !important;
}

.bg-primary,
.bg-success,
.bg-danger,
.bg-warning,
.bg-info,
.bg-secondary {
  /* Removed !important overrides to allow Bootstrap colors */
}

.stats-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 130px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  margin-bottom: 1.5rem;
}

.stats-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.stats-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stats-change {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.stats-row,
.quick-actions,
.recent-activity,
.import-export-card,
.info-card,
.action-card,
.danger-zone,
.metric-card,
.profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.9rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stats-row {
  margin-bottom: 1.5rem;
}

.quick-actions .action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
}

.quick-actions .action-btn:hover {
  background: #eef1f4;
}

.activity-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.activity-item:last-child {
  border-bottom: none;
}

.search-filters {
  margin-bottom: 1rem;
}

.items-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.item:last-child {
  border-bottom: none;
}

.item-id {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: monospace;
}

.delete-btn {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  color: var(--text);
  cursor: pointer;
}

.delete-btn:hover {
  background: #eceff1;
}

.template {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  font-size: 0.85rem;
  max-height: 140px;
  overflow-y: auto;
  font-family: "Courier New", monospace;
}

.question-card {
  border-left: 3px solid var(--border-strong);
}

.bulk-actions {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.current-user {
  background: #eceff1 !important;
}

.file-upload-area {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: var(--surface-muted);
}

.file-upload-area.dragover {
  background: #e9ecef;
  border-color: var(--text);
}

.activity-log {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
}

.activity-log .timestamp,
.activity-log .action,
.activity-log .details {
  color: var(--text);
  font-weight: 600;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.type-badge,
.level-badge,
.status-active,
.status-inactive {
  background: var(--surface-muted) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

.nav-pills .nav-link {
  color: var(--text);
  border: 1px solid transparent;
}

.nav-pills .nav-link.active {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
}

.modal-content,
.modal-header,
.modal-footer {
  background: var(--surface);
  border-color: var(--border);
}

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}

.login-container {
  max-width: 420px;
  width: 100%;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.btn-login {
  width: 100%;
}

body.admin-simple-page {
  padding: 1.5rem;
}

.boxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.box h2 {
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.add-btn {
  background: var(--surface-muted);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.add-btn:hover {
  background: #e9ecef;
}

/* Custom Modal for Simple Admin Page */
.simple-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.simple-modal.active {
  display: flex;
}

.modal-content {
  border-radius: var(--radius);
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.message {
  padding: 0.6rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.message.success,
.message.error {
  color: var(--text);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header,
.stats-card,
.content-wrapper,
.stats-row,
.quick-actions,
.recent-activity,
.import-export-card,
.info-card,
.action-card,
.danger-zone,
.metric-card,
.profile-header {
  animation: rise-in 0.45s ease both;
}

@media (prefers-reduced-motion: reduce) {

  .page-header,
  .stats-card,
  .content-wrapper,
  .stats-row,
  .quick-actions,
  .recent-activity,
  .import-export-card,
  .info-card,
  .action-card,
  .danger-zone,
  .metric-card,
  .profile-header {
    animation: none;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
}