/*
 * Gradient / soft-UI design system for the administration panels.
 *
 * Colours were sampled from the supplied kit rather than eyeballed:
 * background #EDEDEF, gradient #FE9A3E → #FF404D, inactive surfaces #E8E9EB.
 * The kit is neumorphic, so shapes are lifted with a pair of shadows — light
 * from the top-left, shadow to the bottom-right — instead of a single drop.
 *
 * Layered on top of Bootstrap 5: the panels already use its classes, so this
 * restyles them instead of replacing the markup.
 */

:root {
  --g-from: #fe9a3e;
  --g-to: #ff404d;
  --g-gradient: linear-gradient(135deg, var(--g-from) 0%, var(--g-to) 100%);

  --g-bg: #ededef;
  --g-surface: #ffffff;
  --g-surface-muted: #e8e9eb;
  --g-border: #d8d9dd;
  --g-ink: #2b2b33;
  --g-muted: #7a7b84;

  --g-radius: 16px;
  --g-radius-sm: 12px;

  /* Neumorphic elevation: light source at the top-left. */
  --g-raised: -6px -6px 14px rgba(255, 255, 255, 0.9), 6px 6px 16px rgba(163, 165, 173, 0.45);
  --g-raised-sm: -3px -3px 8px rgba(255, 255, 255, 0.85), 3px 3px 9px rgba(163, 165, 173, 0.38);
  --g-pressed: inset -3px -3px 8px rgba(255, 255, 255, 0.9), inset 3px 3px 8px rgba(163, 165, 173, 0.45);
  --g-glow: 0 10px 24px rgba(255, 82, 70, 0.32);
}

body.bg-light {
  font-family: "Montserrat", "Noto Sans", system-ui, sans-serif;
  background: var(--g-bg);
  color: var(--g-ink);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .navbar-brand {
  font-family: "Montserrat", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.2px;
}

main.container {
  max-width: 1180px;
}

/* ------------------------------- navbar --------------------------------- */

.navbar.navbar-dark.bg-dark {
  background: var(--g-gradient) !important;
  border: 0;
  box-shadow: var(--g-glow);
}

.navbar .navbar-brand {
  font-size: 1.05rem;
  color: #fff;
}

.navbar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
  border-radius: 999px;
}

.navbar .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ------------------------------- surfaces -------------------------------- */

.card {
  border: 0;
  border-radius: var(--g-radius);
  background: var(--g-surface);
  box-shadow: var(--g-raised);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: -8px -8px 18px rgba(255, 255, 255, 0.95), 8px 10px 22px rgba(163, 165, 173, 0.5);
}

.shadow-sm {
  box-shadow: var(--g-raised) !important;
}

.alert {
  border: 0;
  border-radius: var(--g-radius-sm);
  box-shadow: var(--g-raised-sm);
}

.alert-danger { background: #ffe9e7; color: #b3261e; }
.alert-warning { background: #fff2e3; color: #9a5b10; }
.alert-info { background: #eaf1ff; color: #24457f; }
.alert-success { background: #e6f6ec; color: #16653a; }

/* -------------------------------- buttons -------------------------------- */

.btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary,
.btn-success {
  border: 0;
  background: var(--g-gradient);
  color: #fff;
  box-shadow: var(--g-glow);
}

.btn-primary:hover,
.btn-success:hover {
  background: var(--g-gradient);
  filter: brightness(1.06);
  box-shadow: 0 12px 28px rgba(255, 82, 70, 0.4);
}

.btn-primary:disabled,
.btn-success:disabled {
  background: var(--g-surface-muted);
  color: var(--g-muted);
  box-shadow: none;
}

/* Outlined buttons in the kit carry the gradient on the border itself. */
.btn-outline-primary {
  position: relative;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--g-surface), var(--g-surface)) padding-box,
    var(--g-gradient) border-box;
  color: #f2563f;
}

.btn-outline-primary:hover {
  background:
    linear-gradient(#fff7f3, #fff7f3) padding-box,
    var(--g-gradient) border-box;
  color: #e8412f;
}

.btn-outline-secondary,
.btn-outline-danger {
  border: 0;
  background: var(--g-surface-muted);
  color: var(--g-ink);
  box-shadow: var(--g-raised-sm);
}

.btn-outline-secondary:hover {
  background: #dfe0e4;
  color: var(--g-ink);
}

.btn-outline-danger { color: #d13a2e; }
.btn-outline-danger:hover { background: #ffe6e3; color: #b3261e; }

.btn-danger {
  border: 0;
  background: linear-gradient(135deg, #ff6a5e, #e5241a);
  box-shadow: 0 10px 22px rgba(229, 36, 26, 0.3);
}

/* --------------------------------- forms --------------------------------- */

.form-control,
.form-select {
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-sm);
  background: var(--g-surface);
  padding: 0.6rem 0.9rem;
  color: var(--g-ink);
  box-shadow: var(--g-pressed);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--g-from);
  box-shadow: 0 0 0 0.2rem rgba(254, 154, 62, 0.25);
}

.form-control::placeholder { color: #a9aab2; }

.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--g-ink);
}

.form-text { color: var(--g-muted); }

.form-check-input {
  border-color: var(--g-border);
  box-shadow: var(--g-raised-sm);
}

.form-check-input:checked {
  background: var(--g-gradient);
  border-color: transparent;
}

/* ------------------------------ list groups ------------------------------ */

.list-group { gap: 0.55rem; }

.list-group-item {
  border: 0 !important;
  border-radius: var(--g-radius-sm) !important;
  background: var(--g-surface);
  box-shadow: var(--g-raised-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.list-group-item-action:hover {
  transform: translateX(3px);
  background: var(--g-surface);
  box-shadow: -4px -4px 10px rgba(255, 255, 255, 0.95), 5px 6px 14px rgba(163, 165, 173, 0.45);
  color: #e8412f;
}

/* --------------------------------- tables -------------------------------- */

.table {
  --bs-table-bg: transparent;
  border-color: transparent;
}

.table thead th {
  background: transparent;
  color: var(--g-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--g-border);
}

.table tbody td {
  border-color: #ececef;
  vertical-align: top;
}

.table-hover > tbody > tr:hover > * {
  background: rgba(254, 154, 62, 0.08);
}

.table-danger, .table-danger > * {
  background: #ffecea !important;
}

/* --------------------------------- badges -------------------------------- */

.badge {
  border-radius: 999px;
  padding: 0.4em 0.8em;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge.bg-primary,
.badge.bg-success {
  background: var(--g-gradient) !important;
  color: #fff;
}

.badge.bg-secondary {
  background: var(--g-surface-muted) !important;
  color: #5c5d66;
}

.badge.bg-warning {
  background: #ffe3bf !important;
  color: #8a4f06 !important;
}

.badge.bg-danger {
  background: #ffdbd6 !important;
  color: #b3261e;
}

.badge.bg-info-subtle {
  background: #e4edff !important;
  color: #2f4f8f !important;
}

/* -------------------------------- accordion ------------------------------- */

.accordion-item {
  border: 0;
  border-radius: var(--g-radius-sm);
  overflow: hidden;
  box-shadow: var(--g-raised-sm);
}

.accordion-button {
  background: var(--g-surface);
  font-weight: 600;
}

.accordion-button:not(.collapsed) {
  background: rgba(254, 154, 62, 0.12);
  color: #d9412f;
  box-shadow: none;
}

.accordion-button:focus {
  border-color: transparent;
  box-shadow: 0 0 0 0.2rem rgba(254, 154, 62, 0.22);
}

/* --------------------------- gradient utilities --------------------------- */

.g-gradient-text {
  background: var(--g-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.g-stat {
  border-radius: var(--g-radius);
  background: var(--g-surface);
  box-shadow: var(--g-raised);
  padding: 1rem;
  text-align: center;
}

.g-stat .g-stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

/* A whole card that is one big link: an exam, a section, a shortcut. Lifts on
   hover so it reads as clickable without an underline or a button. */
.g-tile {
  border-radius: var(--g-radius);
  background: var(--g-surface);
  box-shadow: var(--g-raised);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.g-tile:hover,
.g-tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--g-raised), var(--g-glow);
}

.g-tile .g-tile-chevron {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--g-to);
}

.g-dropzone {
  border: 2px dashed rgba(255, 105, 80, 0.45) !important;
  border-radius: var(--g-radius);
  background: var(--g-surface);
  box-shadow: var(--g-pressed);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.g-dropzone:hover,
.g-dropzone.is-active {
  background: #fff6f1;
  border-color: var(--g-to) !important;
}

/* Progress ring used for readiness indicators. */
.g-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: var(--g-raised);
}

.g-ring > span {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--g-surface);
  display: grid;
  place-items: center;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Entrance animation kept from the previous panel, retimed for this kit. */
main.container > * { animation: g-fade-up 0.45s ease both; }
main.container > :nth-child(1) { animation-delay: 0.04s; }
main.container > :nth-child(2) { animation-delay: 0.1s; }
main.container > :nth-child(3) { animation-delay: 0.16s; }
main.container > :nth-child(4) { animation-delay: 0.22s; }

@keyframes g-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* CKEditor sits inside these panels and needs a matching frame. */
.django-ckeditor-widget .cke_contents { min-height: 200px; }
.django-ckeditor-widget .cke_chrome {
  border-radius: var(--g-radius-sm);
  overflow: hidden;
  border-color: var(--g-border);
}

.bank-questions-table { table-layout: fixed; width: 100%; }
.bank-questions-table th,
.bank-questions-table td { word-break: break-word; overflow-wrap: anywhere; }
.bank-questions-table td.text-end { white-space: nowrap; }
