/* ==========================================================================
   St. Mukasa design system
   The look of the announcements panel, applied site-wide: soft rounded
   surfaces, blue gradients, gentle lift on hover, readable in light + dark.
   Loaded last in base.html so it wins ties with older page styles.
   ========================================================================== */

:root {
    --ds-radius: 20px;
    --ds-radius-sm: 14px;
    --ds-grad: linear-gradient(135deg, #0a2d5c 0%, #1565c0 70%, #1e88e5 100%);
    --ds-grad-btn: linear-gradient(135deg, #0d47a1, #1976d2);
    --ds-surface: #ffffff;
    --ds-soft: #f4f8ff;
    --ds-soft-hover: #eaf2ff;
    --ds-border: #e1eaf7;
    --ds-shadow: 0 14px 38px rgba(13, 71, 161, .10);
    --ds-shadow-hover: 0 22px 50px rgba(13, 71, 161, .18);
    --ds-title: #0a2d5c;
    --ds-text: #33445f;
    --ds-muted: #6b7a90;
    --ds-accent: #1976d2;
    --ds-link: #1565c0;
    --ds-input-bg: #f8fafd;
    --ds-input-border: #dbe3f0;
}

body.dark-mode {
    --ds-grad: linear-gradient(135deg, #0b2246 0%, #123a7a 70%, #1565c0 100%);
    --ds-surface: #10284f;
    --ds-soft: rgba(255, 255, 255, .07);
    --ds-soft-hover: rgba(255, 255, 255, .11);
    --ds-border: rgba(255, 255, 255, .12);
    --ds-shadow: 0 16px 40px rgba(0, 0, 0, .40);
    --ds-shadow-hover: 0 24px 54px rgba(0, 0, 0, .55);
    --ds-title: #ffffff;
    --ds-text: rgba(255, 255, 255, .86);
    --ds-muted: rgba(255, 255, 255, .6);
    --ds-accent: #6ea8ff;
    --ds-link: #8ab4ff;
    --ds-input-bg: rgba(255, 255, 255, .06);
    --ds-input-border: rgba(255, 255, 255, .18);
}

html { scroll-behavior: smooth; }
body { font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif; }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }
::selection { background: rgba(25, 118, 210, .25); }

/* brand utilities (previously only defined inside one page) */
.bg-stm-primary { background: var(--ds-grad) !important; color: #fff; }
.bg-stm-light { background: var(--ds-soft) !important; }
.text-stm-primary { color: #0d47a1; }
body.dark-mode .text-stm-primary { color: #8ab4ff; }

/* ---------- Cards ---------- */
.card {
    border-radius: var(--ds-radius);
    border: 1px solid var(--ds-border);
    background-color: var(--ds-surface);
    box-shadow: var(--ds-shadow);
    overflow: hidden;
    transition: transform .28s ease, box-shadow .28s ease;
}
body.dark-mode .card { background: linear-gradient(180deg, #10284f 0%, #0c1f40 100%); }
.card.shadow, .card.shadow-sm { box-shadow: var(--ds-shadow) !important; }
.card.shadow-sm:hover, .card.shadow:hover { transform: translateY(-3px); box-shadow: var(--ds-shadow-hover) !important; }
.card.bg-light { background: var(--ds-soft) !important; }
.card-header { border: 0; padding: 1rem 1.25rem; font-weight: 700; position: relative; }
.card-header.bg-primary, .card-header.bg-stm-primary { background: var(--ds-grad) !important; color: #fff !important; overflow: hidden; }
.card-header.bg-primary::after, .card-header.bg-stm-primary::after {
    content: ""; position: absolute; right: -30px; top: -40px; width: 130px; height: 130px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%); pointer-events: none;
}
.card-header.bg-primary > *, .card-header.bg-stm-primary > * { position: relative; z-index: 1; color: #fff; }
.card-header.bg-white { background: transparent !important; border-bottom: 1px solid var(--ds-border); color: var(--ds-title); }
.card-footer { border-top: 1px solid var(--ds-border); }
.card-footer.bg-transparent { background: transparent !important; }
.card-title { color: var(--ds-title); font-weight: 700; }
body.dark-mode .card-title { color: #fff; }

/* ---------- Buttons ---------- */
.btn { border-radius: 12px; font-weight: 600; transition: transform .18s ease, box-shadow .18s ease, background .2s, color .2s; }
.btn-lg { border-radius: 14px; }
.btn-primary, .btn-stm-primary {
    background: var(--ds-grad-btn); border: 0; color: #fff;
    box-shadow: 0 8px 20px rgba(13, 71, 161, .26);
}
.btn-primary:hover, .btn-primary:focus, .btn-stm-primary:hover, .btn-stm-primary:focus {
    background: var(--ds-grad-btn); color: #fff; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(13, 71, 161, .36);
}
.btn-primary:active, .btn-stm-primary:active { transform: translateY(0); }
.btn-success { background: linear-gradient(135deg, #15803d, #22c55e); border: 0; box-shadow: 0 8px 20px rgba(21, 128, 61, .25); }
.btn-success:hover { background: linear-gradient(135deg, #15803d, #22c55e); transform: translateY(-2px); box-shadow: 0 14px 28px rgba(21, 128, 61, .35); }
.btn-danger { background: linear-gradient(135deg, #b91c1c, #ef4444); border: 0; box-shadow: 0 8px 20px rgba(185, 28, 28, .25); }
.btn-danger:hover { background: linear-gradient(135deg, #b91c1c, #ef4444); transform: translateY(-2px); box-shadow: 0 14px 28px rgba(185, 28, 28, .35); }
.btn-warning { background: linear-gradient(135deg, #d97706, #fbbf24); border: 0; color: #3b2600; }
.btn-warning:hover { background: linear-gradient(135deg, #d97706, #fbbf24); color: #3b2600; transform: translateY(-2px); }
.btn-info { background: linear-gradient(135deg, #0e7490, #22d3ee); border: 0; color: #032b36; }
.btn-info:hover { background: linear-gradient(135deg, #0e7490, #22d3ee); color: #032b36; transform: translateY(-2px); }
.btn-outline-primary, .btn-outline-secondary, .btn-outline-success, .btn-outline-danger, .btn-outline-info,
.btn-outline-stm-primary { border-width: 1.5px; }
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-outline-success:hover, .btn-outline-danger:hover,
.btn-outline-info:hover, .btn-outline-stm-primary:hover { transform: translateY(-2px); }
.btn-light { border: 1px solid var(--ds-border); }
.btn:focus-visible { outline: 3px solid rgba(25, 118, 210, .4); outline-offset: 2px; }
.btn:disabled, .btn.disabled { transform: none; box-shadow: none; }

/* ---------- Forms (page forms, not only modals) ---------- */
.form-label { font-weight: 600; font-size: .86rem; color: var(--ds-text); margin-bottom: .35rem; }
.form-control, .form-select {
    border: 1.5px solid var(--ds-input-border); border-radius: 12px; padding: .68rem .95rem;
    background-color: var(--ds-input-bg); transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.form-control:focus, .form-select:focus { border-color: var(--ds-accent); background-color: #fff; box-shadow: 0 0 0 .25rem rgba(25, 118, 210, .16); }
.form-check-input:checked { background-color: #1565c0; border-color: #1565c0; }
body.dark-mode .form-control, body.dark-mode .form-select { color: #fff; }
body.dark-mode .form-control:focus, body.dark-mode .form-select:focus { background-color: rgba(255, 255, 255, .1); }
body.dark-mode .form-control::placeholder { color: rgba(255, 255, 255, .45); }
body.dark-mode .form-select option { color: #0a1a3a; }

/* ---------- Badges, progress, lists, tables, alerts ---------- */
.badge { border-radius: 999px; font-weight: 700; letter-spacing: .3px; padding: .45em .85em; }
.progress { height: 10px; border-radius: 999px; background: rgba(25, 118, 210, .12); overflow: hidden; }
.progress-bar { border-radius: 999px; background-image: linear-gradient(90deg, #1976d2, #42a5f5); }
.progress-bar.bg-success { background-image: linear-gradient(90deg, #16a34a, #4ade80); }
.list-group-item { background: transparent; border-color: var(--ds-border); color: inherit; transition: background .2s; }
.list-group-item:hover:not(.text-center) { background: var(--ds-soft); }
.table { --bs-table-bg: transparent; --bs-table-color: inherit; }
.table thead th {
    background: var(--ds-soft); color: var(--ds-title); border: 0; font-size: .74rem; text-transform: uppercase; letter-spacing: .7px;
}
.table > :not(caption) > * > * { border-color: var(--ds-border); }
.table-hover > tbody > tr:hover > * { background: var(--ds-soft); color: inherit; }
body.dark-mode .table thead th { color: #fff; }
.alert { border-radius: 16px; border: 1px solid transparent; border-left-width: 5px; }
.alert-success { background: #ecfdf3; border-color: #bbf7d0; border-left-color: #16a34a; color: #14532d; }
.alert-info { background: #eff8ff; border-color: #bfe3ff; border-left-color: #1976d2; color: #0c4a6e; }
.alert-warning { background: #fffbeb; border-color: #fde9a6; border-left-color: #d97706; color: #78500a; }
.alert-danger { background: #fef2f2; border-color: #fecaca; border-left-color: #dc2626; color: #7f1d1d; }
body.dark-mode .alert-success { border-left-color: #22c55e; }
body.dark-mode .alert-info { border-left-color: #6ea8ff; }
body.dark-mode .alert-warning { border-left-color: #fbbf24; }
body.dark-mode .alert-danger { border-left-color: #f87171; }
.dropdown-menu { border-radius: 16px; border: 1px solid var(--ds-border); padding: .5rem; }
.dropdown-item { border-radius: 10px; padding: .55rem .85rem; font-weight: 500; }

/* ---------- Navbar ---------- */
.navbar .nav-link { font-weight: 600; border-radius: 10px; padding: .5rem .8rem !important; margin: 0 .1rem; transition: background .2s, color .2s; }
.navbar .nav-link:hover { background: rgba(21, 101, 192, .09); color: #0d47a1; }
.navbar .nav-link.active { background: rgba(21, 101, 192, .13); color: #0d47a1 !important; }
body.dark-mode .navbar .nav-link:hover { background: rgba(255, 255, 255, .1); }
body.dark-mode .navbar .nav-link.active { background: rgba(255, 255, 255, .14); border-bottom: 0; }
.navbar.fixed-top { transition: box-shadow .3s ease, background-color .3s ease; }
.navbar.fixed-top.stm-scrolled { box-shadow: 0 10px 34px rgba(10, 45, 92, .22) !important; }

/* ---------- Page hero banner ---------- */
.page-hero {
    position: relative; overflow: hidden; border-radius: 26px; padding: 2.4rem 2.4rem; margin-bottom: 2.2rem; color: #fff;
    background: var(--ds-grad); box-shadow: 0 24px 60px rgba(13, 71, 161, .28);
    display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
}
.page-hero::before {
    content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
}
.page-hero::after {
    content: ""; position: absolute; left: 30%; bottom: -120px; width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgba(66, 165, 245, .30), transparent 70%);
}
.page-hero > * { position: relative; z-index: 1; }
.page-hero .hero-icon {
    flex: none; width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; font-size: 1.9rem;
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.page-hero .hero-text { flex: 1; min-width: 220px; }
.page-hero h1 { margin: 0; font-weight: 800; font-size: clamp(1.7rem, 3.4vw, 2.5rem); color: #fff !important; }
.page-hero p { margin: .45rem 0 0; font-size: 1.05rem; color: rgba(255, 255, 255, .88) !important; max-width: 60ch; }
.page-hero .hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.page-hero .btn-light { background: #fff; color: #0a2d5c; border: 0; }
@media (max-width: 576px) { .page-hero { padding: 1.7rem 1.4rem; border-radius: 22px; } }

/* section heading with accent bar */
.section-title { position: relative; padding-left: 1rem; font-weight: 800; color: var(--ds-title); }
.section-title::before { content: ""; position: absolute; left: 0; top: .15em; bottom: .15em; width: 5px; border-radius: 5px; background: var(--ds-grad-btn); }
body.dark-mode .section-title { color: #fff; }

/* ---------- Footer ---------- */
footer { background: linear-gradient(180deg, #0a2d5c 0%, #061a38 100%) !important; position: relative; }
footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, #42a5f5, #1565c0, #42a5f5); }
footer a { transition: color .2s, transform .2s; display: inline-block; }
footer ul a:hover { transform: translateX(4px); }
footer h4, footer h5 { font-weight: 700; }

/* ---------- Scroll progress + back-to-top ---------- */
#stm-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 10001; pointer-events: none;
    background: linear-gradient(90deg, #42a5f5, #1565c0); box-shadow: 0 0 10px rgba(66, 165, 245, .7);
}
#stm-top {
    position: fixed; left: 20px; bottom: 20px; z-index: 9990; width: 46px; height: 46px; border: 0; border-radius: 50%;
    display: grid; place-items: center; font-size: 1.2rem; color: #fff; cursor: pointer;
    background: var(--ds-grad-btn); box-shadow: 0 12px 26px rgba(13, 71, 161, .38);
    opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none; transition: opacity .3s, transform .3s;
}
#stm-top.show { opacity: 1; transform: none; pointer-events: auto; }
#stm-top:hover { transform: translateY(-3px); }

/* ---------- Gallery filter chips + cards ---------- */
.gal-filters { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1.8rem; }
.gal-chip {
    display: inline-flex; align-items: center; gap: .5rem; border: 1.5px solid var(--ds-border); background: var(--ds-surface);
    color: var(--ds-title); font-weight: 600; font-size: .9rem; padding: .5rem 1rem; border-radius: 999px; cursor: pointer;
    transition: transform .18s, background .2s, color .2s, box-shadow .2s, border-color .2s;
}
body.dark-mode .gal-chip { color: #fff; }
.gal-chip:hover { transform: translateY(-2px); border-color: var(--ds-accent); }
.gal-chip.active { background: var(--ds-grad-btn); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(13, 71, 161, .3); }
.gal-chip span { font-size: .72rem; font-weight: 800; padding: .1rem .5rem; border-radius: 999px; background: rgba(25, 118, 210, .14); }
.gal-chip.active span { background: rgba(255, 255, 255, .25); }
.gal-item { transition: opacity .35s ease, transform .35s ease; }
.gal-item.gal-hide { display: none; }
.gal-item.gal-fade { opacity: 0; transform: scale(.94); }
.gal-cat {
    display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .4px; padding: .28rem .75rem; border-radius: 999px;
    color: var(--ds-link); background: rgba(25, 118, 210, .12);
}
body.dark-mode .gal-cat { color: #8ab4ff; background: rgba(110, 168, 255, .16); }
.gal-title { font-weight: 700; font-size: .95rem; line-height: 1.35; color: var(--ds-title); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
body.dark-mode .gal-title { color: #fff; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .card, .btn, .gal-item, #stm-top { transition: none; }
}

/* ==========================================================================
   Dark-mode form fixes (icons in input groups, native controls, file buttons)
   ========================================================================== */
body.dark-mode { color-scheme: dark; }
body.dark-mode .input-group-text,
body.dark-mode .input-group-text.bg-light,
body.dark-mode button.input-group-text {
    background: rgba(255, 255, 255, .09) !important;
    color: #a9c7ff !important;
    border-color: var(--ds-input-border) !important;
}
body.dark-mode .input-group-text i { color: inherit !important; }
body.dark-mode button.input-group-text:hover { background: rgba(255, 255, 255, .16) !important; color: #fff !important; }
.input-group-text { border-radius: 12px; }
.input-group > .form-control:not(:last-child), .input-group > .input-group-text:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .form-control:not(:first-child), .input-group > .input-group-text:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }

body.dark-mode .form-control::file-selector-button,
body.dark-mode .form-control::-webkit-file-upload-button {
    background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-right: 1px solid var(--ds-input-border);
}
body.dark-mode .form-control:hover:not(:disabled):not([readonly])::file-selector-button { background: rgba(255, 255, 255, .22); }
body.dark-mode .form-control:disabled, body.dark-mode .form-select:disabled {
    background-color: rgba(255, 255, 255, .03); color: rgba(255, 255, 255, .5); opacity: 1;
}
body.dark-mode .form-check-input:not(:checked) { background-color: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .45); }
body.dark-mode .form-check-input:checked { background-color: #2f80ed; border-color: #2f80ed; }
body.dark-mode .form-check-label, body.dark-mode .form-text { color: rgba(255, 255, 255, .85) !important; }
body.dark-mode .invalid-feedback { color: #ff8a8a; }
body.dark-mode .form-control.is-invalid, body.dark-mode .was-validated .form-control:invalid { border-color: #f87171; }
body.dark-mode .form-control.is-valid, body.dark-mode .was-validated .form-control:valid { border-color: #4ade80; }

/* info buttons: white text on a deeper teal (dark text on teal was hard to read) */
.btn-info { background: linear-gradient(135deg, #0e7490, #0891b2); color: #fff; }
.btn-info:hover, .btn-info:focus { background: linear-gradient(135deg, #0e7490, #0891b2); color: #fff; }
/* ==========================================================================
   Navbar sizing: compact links, no wrapping, long usernames truncated
   ========================================================================== */
.navbar .navbar-nav { gap: .1rem; flex-wrap: nowrap; }
.navbar .nav-link { font-size: .9rem; padding: .45rem .7rem !important; white-space: nowrap; margin: 0; }
.navbar .navbar-brand { max-width: none; }
.navbar .logo-container { width: 44px; height: 44px; }
.navbar-brand .brand-text .fw-bold { font-size: 1.05rem; line-height: 1.15; white-space: nowrap; }
.navbar-brand .brand-text small { font-size: .72rem !important; line-height: 1.2; white-space: nowrap; }
.navbar .btn { padding: .42rem .95rem; font-size: .9rem; white-space: nowrap; }
.navbar .username-text { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.navbar .dark-mode-toggle { flex: none; }

@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar .nav-link { font-size: .84rem; padding: .4rem .5rem !important; }
    .navbar-brand .brand-text small { display: none; }
    .navbar .btn { padding: .38rem .7rem; font-size: .84rem; }
    .navbar .username-text { display: none; }
}
@media (max-width: 991.98px) {
    .navbar .nav-link { font-size: 1rem; padding: .6rem .8rem !important; }
    .navbar .username-text { max-width: 160px; }
}
.navbar.fixed-top { min-height: 72px; }
.navbar .navbar-brand { margin-right: .9rem; }

/* ==========================================================================
   Phones and touch screens
   ========================================================================== */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; }
    .form-control, .form-select { min-height: 46px; }
    .navbar .nav-link { min-height: 44px; display: flex; align-items: center; }
    .dropdown-item { min-height: 44px; display: flex; align-items: center; }
    .form-check-input { width: 1.3em; height: 1.3em; }
}
@media (max-width: 767.98px) {
    /* 16px stops iOS from zooming the page when a field is focused */
    .form-control, .form-select, textarea { font-size: 16px; }
    .container { padding-left: 16px; padding-right: 16px; }
    h1 { word-break: break-word; }
    .card-body { padding: 1.1rem; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
}
img, video { max-width: 100%; height: auto; }
/* ==========================================================================
   Layering: keep the navbar and floating buttons underneath open modals
   (the navbar's z-index was above the modal, hiding the title/close button)
   ========================================================================== */
body.modal-open .navbar.fixed-top { z-index: 1030 !important; }
body.modal-open #stm-top, body.modal-open #stm-progress { display: none; }
@media (max-width: 767.98px) { body.has-sticky-cta #stm-top { display: none; } }
/* footer links and social icons: comfortable to tap on phones */
@media (pointer: coarse) {
    footer ul a { padding: .6rem 0; }
    footer a:has(> i.bi:only-child) { display: inline-grid; place-items: center; width: 44px; height: 44px; }
}