/* =====================================================================
   coursematter — Bootstrap modals, app-wide (signed-in layouts)

   Brings every stock Bootstrap modal onto the new theme without touching
   its markup: indigo-tinted blurred backdrop, a soft 24px sheet, a white
   header with the title in ink and its icon in violet, a round close
   button, violet pill buttons and violet focus rings.

   How it stays safe:
   - Bootstrap 5.3 drives the modal box through --bs-modal-* variables on
     .modal, so most of the look is set there. Modals that style their own
     box (the profile-completion and agreement modals, the course filter)
     set real properties and keep winning.
   - The peach header (.co-bg-peach), the rose .co-red-button and the grey
     .co-form-input carry !important in site.css, so their overrides here
     are scoped to .modal and repeat the !important.
   Plain structure rules use :where(.modal) so they add no specificity: a
   modal that styles itself in its own <style> block still wins.
   Loaded after site.css and co-bootstrap.css in _AuthenticatedLayout,
   _InstitutionLayout and _InstitutionLeanLayout.
   ===================================================================== */

.modal {
    --cmm-ink: #14121f;
    --cmm-ink-2: #3d3a4d;
    --cmm-muted: #6c6980;
    --cmm-line: #e4e2ee;
    --cmm-wash: #f3f2f8;
    --cmm-night: #6a4bc8;
    --cmm-violet: #6d4aff;
    --cmm-violet-ink: #4f30e0;
    --cmm-violet-soft: #ece8ff;

    --bs-modal-bg: #fff;
    --bs-modal-color: var(--cmm-ink-2);
    --bs-modal-border-width: 0;
    --bs-modal-border-radius: 24px;
    --bs-modal-inner-border-radius: 24px;
    --bs-modal-box-shadow: 0 40px 90px -30px rgba(28, 22, 70, .45), 0 2px 6px rgba(28, 22, 70, .06);
    --bs-modal-header-padding: 20px 24px 16px;
    --bs-modal-header-border-color: var(--cmm-line);
    --bs-modal-header-border-width: 1px;
    --bs-modal-padding: 24px;
    --bs-modal-footer-border-color: var(--cmm-line);
    --bs-modal-footer-gap: 10px;
    --bs-modal-title-line-height: 1.3;
}

.modal-backdrop {
    --bs-backdrop-bg: #6a4bc8;
    --bs-backdrop-opacity: .42;
}
.modal-backdrop.show {
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

:where(.modal) .modal-content {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    box-shadow: var(--bs-modal-box-shadow);
}
/* .co-border-radius-sm pins the sheet to 10px with !important */
.modal .modal-content.co-border-radius-sm { border-radius: 24px !important; }

/* ---------- header ---------- */
:where(.modal) .modal-header { align-items: center; gap: 12px; }
.modal .modal-header.co-bg-peach,
.modal .modal-header.co-bg-peach-dark {
    background: #fff !important;
}
:where(.modal) .modal-header > br { display: none; }

:where(.modal) .modal-title {
    font-size: 19px !important; font-weight: 700; letter-spacing: -0.015em; color: var(--cmm-ink);
    display: flex; align-items: center; gap: 10px; margin-right: auto; line-height: 1.3;
}
:where(.modal) .modal-title > .bi {
    order: -1; flex: none;
    width: 34px; height: 34px; border-radius: 11px; display: inline-grid; place-items: center;
    background: var(--cmm-violet-soft); color: var(--cmm-violet-ink);
    font-size: 16px !important;
}

/* round close button */
:where(.modal) .btn-close {
    --bs-btn-close-opacity: .65;
    --bs-btn-close-hover-opacity: 1;
    --bs-btn-close-focus-shadow: 0 0 0 3px rgba(109, 74, 255, .3);
    flex: none; box-sizing: border-box;
    width: 36px; height: 36px; padding: 0; margin: 0 0 0 auto;
    border-radius: 50%;
    background-color: var(--cmm-wash);
    background-size: 11px;
    transition: background-color .15s ease, opacity .15s ease;
}
:where(.modal) .btn-close:hover { background-color: var(--cmm-violet-soft); }

/* ---------- body ---------- */
:where(.modal) .modal-body { color: var(--cmm-ink-2); font-size: 15px; line-height: 1.55; }
:where(.modal) .modal-body label { font-size: 14px; font-weight: 600; color: var(--cmm-ink); margin-bottom: 6px; }
.modal .modal-body .red,
.modal .modal-body label .co-red { color: #c9283a !important; }

.modal .co-form-input,
.modal .form-control,
.modal .form-select {
    border: 1.5px solid var(--cmm-line) !important;
    border-radius: 12px !important;
    background-color: #fff;
    color: var(--cmm-ink);
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.modal .co-form-input:hover,
.modal .form-control:hover,
.modal .form-select:hover { border-color: #cfc9e6 !important; }
.modal .co-form-input:focus,
.modal .form-control:focus,
.modal .form-select:focus {
    border-color: var(--cmm-violet) !important;
    box-shadow: 0 0 0 4px rgba(109, 74, 255, .15) !important;
    outline: 0;
}
.modal .form-check-input:checked { background-color: var(--cmm-violet); border-color: var(--cmm-violet); }
.modal .form-check-input:focus { border-color: var(--cmm-violet); box-shadow: 0 0 0 4px rgba(109, 74, 255, .15); }
.modal .ql-toolbar.ql-snow { border: 1.5px solid var(--cmm-line); border-radius: 12px 12px 0 0; }
.modal .ql-container.ql-snow { border: 1.5px solid var(--cmm-line); border-top: 0; border-radius: 0 0 12px 12px; }

/* ---------- footer ---------- */
:where(.modal) .modal-footer { padding: 14px 24px 18px; background: #fcfcfe; }

/* ---------- buttons ---------- */
.modal .co-red-button,
.modal .btn-primary {
    display: inline-flex !important; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 20px !important;
    border: 0 !important; border-radius: 999px !important;
    background: var(--cmm-violet) !important; color: #fff !important;
    font-family: inherit; font-size: 14.5px !important; font-weight: 600;
    box-shadow: none !important;
    transition: background-color .15s ease !important;
}
.modal .co-red-button:hover,
.modal .btn-primary:hover { background: var(--cmm-violet-ink) !important; color: #fff !important; box-shadow: none !important; border: 0 !important; }
.modal .co-red-button:focus-visible,
.modal .btn-primary:focus-visible { outline: 2.5px solid var(--cmm-violet); outline-offset: 3px; }
.modal .co-red-button:disabled,
.modal .btn-primary:disabled { opacity: .5; }

.modal .btn-secondary,
.modal .btn-light,
.modal .btn-outline-secondary {
    min-height: 44px; padding: 0 18px;
    border-radius: 999px; border: 1.5px solid var(--cmm-line);
    background: #fff; color: var(--cmm-ink);
    font-size: 14.5px; font-weight: 600;
}
.modal .btn-secondary:hover,
.modal .btn-light:hover,
.modal .btn-outline-secondary:hover { border-color: var(--cmm-ink); background: #fff; color: var(--cmm-ink); }

/* ---------- motion: a short rise instead of Bootstrap's 50px drop (desktop only;
   co-bootstrap.css slides the full-screen phone sheet in from the top) ---------- */
@media (min-width: 992px) {
    .modal.fade .modal-dialog { transform: translateY(14px) scale(.985); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
    .modal.show .modal-dialog { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .modal.fade .modal-dialog { transition: none; }
}

/* ---------- phones: co-bootstrap.css turns modals into full-screen sheets and pushes the
   header to the right for the menu modal; keep a title on the left when there is one ---------- */
@media (max-width: 991px) {
    :where(.modal) .modal-content { --bs-modal-border-radius: 0; border-radius: 0 !important; background-color: #fff; }
    .modal .modal-content.co-border-radius-sm { border-radius: 0 !important; }
    :where(.modal) .modal-header { position: sticky; top: 0; z-index: 2; background-color: #fff; }
}
