/*
  NMIMS brand palette for the admin panel.

  Values are sampled from the approved design (figma/home.jpg): the crest red
  used on the "Admission Now" pill (#D2232A), the red programme bar (#D73334),
  the pale section tint (#FDEDED) and the charcoal already used by
  dashboard.css (#2f3441).

  Loaded after the theme so it wins. Everything here re-points the Bootstrap
  colour classes the admin views already use — no blade changes needed, and
  removing this one file restores the stock theme.
*/

:root {
  --brand-red: #d2232a;
  --brand-red-hover: #b01c22;
  --brand-red-active: #8f161b;
  --brand-red-bar: #d73334;
  --brand-red-rgb: 210, 35, 42;

  --brand-tint: #fdeded;
  --brand-tint-strong: #f9dcdc;
  --brand-border: #f0c9ca;

  --brand-charcoal: #2f3441;
  --brand-charcoal-hover: #232733;
  --brand-charcoal-rgb: 47, 52, 65;

  --brand-muted: #5f6677;
  --brand-line: #e8ebf1;
}

/* Bootstrap's own tokens, so components we don't restyle by hand still land
   on brand colours rather than the theme purple. */
:root,
body {
  --bs-primary: var(--brand-red);
  --bs-primary-rgb: var(--brand-red-rgb);
  --bs-link-color: var(--brand-red);
  --bs-link-hover-color: var(--brand-red-hover);
  --bs-dark: var(--brand-charcoal);
  --bs-dark-rgb: var(--brand-charcoal-rgb);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn-primary,
.btn-brand {
  background-color: var(--brand-red) !important;
  border-color: var(--brand-red) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-brand:hover,
.btn-primary:focus,
.btn-brand:focus {
  background-color: var(--brand-red-hover) !important;
  border-color: var(--brand-red-hover) !important;
  color: #fff !important;
}

.btn-primary:active,
.btn-brand:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
  background-color: var(--brand-red-active) !important;
  border-color: var(--brand-red-active) !important;
  color: #fff !important;
}

/* The theme's "dark" button is the panel's save/confirm action. */
.btn-dark {
  background-color: var(--brand-charcoal) !important;
  border-color: var(--brand-charcoal) !important;
  color: #fff !important;
}

.btn-dark:hover,
.btn-dark:focus,
.btn-dark:active {
  background-color: var(--brand-charcoal-hover) !important;
  border-color: var(--brand-charcoal-hover) !important;
  color: #fff !important;
}

.btn-outline-primary {
  color: var(--brand-red) !important;
  border-color: var(--brand-red) !important;
  background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background-color: var(--brand-red) !important;
  border-color: var(--brand-red) !important;
  color: #fff !important;
}

.btn-outline-dark {
  color: var(--brand-charcoal) !important;
  border-color: var(--brand-charcoal) !important;
  background-color: transparent !important;
}

.btn-outline-dark:hover,
.btn-outline-dark:focus,
.btn-outline-dark:active {
  background-color: var(--brand-charcoal) !important;
  border-color: var(--brand-charcoal) !important;
  color: #fff !important;
}

.btn-outline-secondary {
  color: var(--brand-muted) !important;
  border-color: var(--brand-line) !important;
  background-color: transparent !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
  background-color: var(--brand-tint) !important;
  border-color: var(--brand-border) !important;
  color: var(--brand-red) !important;
}

.btn-outline-danger {
  color: var(--brand-red) !important;
  border-color: var(--brand-border) !important;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:active {
  background-color: var(--brand-red) !important;
  border-color: var(--brand-red) !important;
  color: #fff !important;
}

.btn-link {
  color: var(--brand-red) !important;
}

.btn-link:hover,
.btn-link:focus {
  color: var(--brand-red-hover) !important;
}

/* Focus rings — the theme's purple glow is the most visible giveaway. */
.btn:focus,
.btn:focus-visible,
.btn-check:focus + .btn {
  box-shadow: 0 0 0 0.15rem rgba(var(--brand-red-rgb), 0.25);
}

/* --------------------------------------------------------------------------
   Badges / labels
   -------------------------------------------------------------------------- */

.bg-label-primary {
  background-color: var(--brand-tint) !important;
  color: var(--brand-red) !important;
}

.bg-label-secondary {
  background-color: #eef0f4 !important;
  color: var(--brand-charcoal) !important;
}

.bg-label-info {
  background-color: var(--brand-tint-strong) !important;
  color: var(--brand-red-active) !important;
}

.bg-primary {
  background-color: var(--brand-red) !important;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 0.15rem rgba(var(--brand-red-rgb), 0.15);
}

.form-check-input:checked {
  background-color: var(--brand-red);
  border-color: var(--brand-red);
}

.form-check-input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 0.15rem rgba(var(--brand-red-rgb), 0.15);
}

/* --------------------------------------------------------------------------
   Accordion (Advanced SEO) and links
   -------------------------------------------------------------------------- */

.accordion-button:not(.collapsed) {
  background-color: var(--brand-tint);
  color: var(--brand-red);
  box-shadow: none;
}

.accordion-button:focus {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 0.15rem rgba(var(--brand-red-rgb), 0.15);
}

a {
  color: var(--brand-red);
}

a:hover {
  color: var(--brand-red-hover);
}

/* Breadcrumb chrome should stay quiet — only the trailing crumb is branded. */
.breadcrumb-nav .breadcrumb-item {
  color: var(--brand-muted);
}

.breadcrumb-nav .breadcrumb-current {
  color: var(--brand-red);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Template picker cards (Add Page)
   -------------------------------------------------------------------------- */

.cms-template-card:hover {
  border-color: var(--brand-red) !important;
  box-shadow: 0 4px 16px rgba(var(--brand-red-rgb), 0.12);
}

.cms-template-card .lt-avatar-initial {
  background-color: var(--brand-tint);
  color: var(--brand-red);
}

/* --------------------------------------------------------------------------
   SweetAlert — the save / delete confirmations
   -------------------------------------------------------------------------- */

.swal2-styled.swal2-confirm {
  background-color: var(--brand-red) !important;
  border-color: var(--brand-red) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.swal2-styled.swal2-confirm:hover {
  background-color: var(--brand-red-hover) !important;
  border-color: var(--brand-red-hover) !important;
}

.swal2-styled.swal2-cancel {
  background-color: #eef0f4 !important;
  border-color: #eef0f4 !important;
  color: var(--brand-charcoal) !important;
}

.swal2-styled:focus {
  box-shadow: 0 0 0 0.15rem rgba(var(--brand-red-rgb), 0.25) !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(var(--brand-red-rgb), 0.3);
}

.swal2-icon.swal2-success [class^="swal2-success-line"] {
  background-color: var(--brand-red);
}

/* --------------------------------------------------------------------------
   Text + surface utilities used across the CMS views
   -------------------------------------------------------------------------- */

/* Required-field asterisks and inline errors: brand red, not Bootstrap's. */
.text-danger,
.invalid-feedback {
  color: var(--brand-red) !important;
}

.text-primary {
  color: var(--brand-red) !important;
}

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

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--brand-red);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 0.15rem rgba(var(--brand-red-rgb), 0.2);
}

.bg-light {
  background-color: var(--brand-tint) !important;
}

.bg-secondary {
  background-color: var(--brand-charcoal) !important;
}

/* Repeater rows read as a set of brand-tinted cards. */
.cms-repeater-row.card {
  border-color: var(--brand-line) !important;
  background: #fdfdfe;
}

.cms-repeater-row.card:hover {
  border-color: var(--brand-border) !important;
}

/* A slug field's URL-prefix label (e.g. "https://host/school/") can run
   longer than its column, especially in a narrow one next to Status/Sort
   Order — Bootstrap's .input-group-text refuses to wrap by default, so
   without this it overflows sideways into whatever sits next to it. Ellipsis
   it instead; the full value is still in the title attribute and mostly
   redundant with the field's own label anyway. */
.input-group-text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
