/*
 * Yarl IT Hub general-user design system.
 *
 * The rules are deliberately scoped to .user-portal-body so programme pages
 * can retain their identity while sharing one accessible, responsive product
 * foundation. Staff and operational workflows use admin_portal.css instead.
 */

.user-portal-body {
    --user-accent: #1478ad;
    --user-accent-strong: #095f8f;
    --user-accent-deep: #083b5c;
    --user-accent-soft: #eaf6fc;
    --user-ink: #102f46;
    --user-muted: #536c7f;
    --user-subtle: #718697;
    --user-canvas: #f5f8fb;
    --user-surface: #ffffff;
    --user-surface-muted: #f8fafc;
    --user-border: #dce6ed;
    --user-border-strong: #c7d5df;
    --user-success: #13724f;
    --user-success-soft: #e9f8f1;
    --user-warning: #8a5a08;
    --user-warning-soft: #fff7df;
    --user-danger: #ae2638;
    --user-danger-soft: #fff0f2;
    --user-radius-sm: 0.625rem;
    --user-radius: 0.875rem;
    --user-radius-lg: 1.25rem;
    --user-radius-xl: 1.75rem;
    --user-shadow-xs: 0 1px 2px rgba(8, 59, 92, 0.04);
    --user-shadow-sm: 0 0.3rem 1rem rgba(8, 59, 92, 0.06);
    --user-shadow: 0 1rem 2.5rem rgba(8, 59, 92, 0.1);
    --user-content-width: 80rem;
    --user-reading-width: 46rem;
    background: var(--user-canvas);
    color: var(--user-ink);
}

.user-portal-body main {
    min-width: 0;
    padding-bottom: clamp(2.5rem, 6vw, 5rem);
    background:
        radial-gradient(circle at 100% 0, rgba(72, 159, 212, 0.09), transparent 30rem),
        radial-gradient(circle at 0 35%, rgba(150, 195, 83, 0.055), transparent 26rem),
        var(--user-canvas);
}

.user-portal-body main > :is(.container, .container-fluid),
.user-portal-body main > section > :is(.container, .container-fluid),
.user-portal-body main > div > :is(.container, .container-fluid) {
    padding-right: clamp(1rem, 3vw, 2rem);
    padding-left: clamp(1rem, 3vw, 2rem);
}

.user-portal-body main > .container,
.user-portal-body main > section > .container,
.user-portal-body main > div > .container {
    max-width: var(--user-content-width);
}

.user-portal-body main :is(h1, h2, h3, h4, h5, h6) {
    color: var(--user-ink);
    text-wrap: balance;
}

.user-portal-body main h1 {
    font-size: clamp(1.85rem, 4vw, 3rem);
    font-weight: 760;
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.user-portal-body main h2 {
    letter-spacing: -0.025em;
}

.user-portal-body main p,
.user-portal-body main li,
.user-portal-body main dd {
    text-wrap: pretty;
}

.user-portal-body main :is(.lead, .text-muted) {
    color: var(--user-muted) !important;
}

/* Preserve intentional inverse heroes without leaking white text into cards. */
.user-portal-body main .text-white :is(h1, h2, h3, h4, h5, h6, p, .lead, .text-muted):not(.card *),
.user-portal-body main .events-auth-hero :is(h1, h2, p),
.user-portal-body main .dashboard-hero > :first-child :is(h1, h2, p) {
    color: #fff !important;
}

.user-portal-body main .text-white :is(.section-label, .text-uppercase.text-primary):not(.card *),
.user-portal-body main .dashboard-hero > :first-child .text-uppercase {
    color: rgba(255, 255, 255, 0.76) !important;
}

.user-portal-body main img,
.user-portal-body main video,
.user-portal-body main iframe {
    max-width: 100%;
}

.user-portal-body main :is(.row, [class*="grid"]) > * {
    min-width: 0;
}

/* Shared page composition for new and progressively migrated screens. */
.user-page {
    width: 100%;
    max-width: var(--user-content-width);
    margin-inline: auto;
    padding: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem);
}

.user-page--narrow {
    max-width: 56rem;
}

.user-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    padding: clamp(1.35rem, 4vw, 2.5rem);
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius-xl);
    background:
        radial-gradient(circle at 92% 12%, rgba(72, 159, 212, 0.2), transparent 34%),
        linear-gradient(135deg, #fff 0%, #f2f9fc 100%);
    box-shadow: var(--user-shadow-sm);
}

.user-page-header__copy {
    min-width: 0;
    max-width: 52rem;
}

.user-page-eyebrow,
.user-portal-body main .section-label,
.user-portal-body main .text-uppercase.text-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
    color: var(--user-accent-strong) !important;
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.user-page-title {
    margin: 0;
}

.user-page-description {
    max-width: var(--user-reading-width);
    margin: 0.65rem 0 0;
    color: var(--user-muted);
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    line-height: 1.65;
}

.user-page-actions,
.user-action-group {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.user-section {
    margin-bottom: 1.5rem;
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius-lg);
    background: var(--user-surface);
    box-shadow: var(--user-shadow-xs);
}

.user-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--user-border);
}

.user-section__body {
    min-width: 0;
    padding: clamp(1.2rem, 3vw, 1.625rem);
    overflow-wrap: anywhere;
}

.user-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.user-stat-card {
    min-width: 0;
    padding: 1.15rem;
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    background: var(--user-surface);
    box-shadow: var(--user-shadow-xs);
}

.user-stat-card__label {
    color: var(--user-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.user-stat-card__value {
    margin-top: 0.3rem;
    color: var(--user-ink);
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1;
}

.user-empty-state {
    padding: clamp(2.25rem, 8vw, 5rem) 1.25rem;
    border: 1px dashed var(--user-border-strong);
    border-radius: var(--user-radius-lg);
    background: var(--user-surface-muted);
    color: var(--user-muted);
    text-align: center;
}

.user-reading-width {
    max-width: var(--user-reading-width);
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.7rem 1rem;
    border-radius: var(--user-radius-sm, 0.625rem);
    background: #102f46;
    color: #fff;
    font-weight: 700;
    transform: translateY(-150%);
}

.skip-link:focus {
    color: #fff;
    opacity: 1;
    transform: translateY(0);
}

/* Bootstrap and Django component treatment. */
.user-portal-body main .card {
    height: auto;
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius-lg);
    background: var(--user-surface);
    box-shadow: var(--user-shadow-xs);
    transform: none;
}

.user-portal-body main .card:hover {
    border-color: var(--user-border-strong);
    box-shadow: var(--user-shadow-sm);
    transform: none;
}

.user-portal-body main .card-header,
.user-portal-body main .card-footer {
    padding: 1rem 1.25rem;
    border-color: var(--user-border);
    background: var(--user-surface-muted);
}

.user-portal-body main .card-body {
    min-width: 0;
    padding: clamp(1.2rem, 3vw, 1.625rem);
    overflow-wrap: anywhere;
}

.user-portal-body main :is(.card-title, .card-header h2, .card-header h3, .card-header h4, .card-header h5) {
    color: var(--user-ink);
    font-weight: 720;
}

.user-portal-body .btn {
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    border-radius: var(--user-radius-sm);
    font-weight: 680;
    line-height: 1.25;
}

.user-portal-body .btn-sm {
    min-height: 2.35rem;
    padding: 0.48rem 0.75rem;
    font-size: 0.8125rem;
}

.user-portal-body .btn-lg {
    min-height: 3.15rem;
    padding: 0.8rem 1.25rem;
}

.user-portal-body .btn-primary {
    border: 1px solid var(--user-accent);
    background: var(--user-accent);
    box-shadow: 0 0.3rem 0.75rem rgba(20, 120, 173, 0.16);
}

.user-portal-body .btn-primary:hover,
.user-portal-body .btn-primary:focus-visible {
    border-color: var(--user-accent-strong);
    background: var(--user-accent-strong);
    box-shadow: 0 0.5rem 1rem rgba(9, 95, 143, 0.22);
    color: #fff;
    opacity: 1;
    transform: translateY(-1px);
}

.user-portal-body :is(.btn-outline-primary, .btn-outline-secondary) {
    border: 1px solid var(--user-border-strong);
    background: var(--user-surface);
    color: var(--user-ink);
}

.user-portal-body :is(.btn-outline-primary, .btn-outline-secondary):hover,
.user-portal-body :is(.btn-outline-primary, .btn-outline-secondary):focus-visible {
    border-color: var(--user-accent);
    background: var(--user-accent-soft);
    color: var(--user-accent-strong);
    opacity: 1;
}

.user-portal-body .btn-danger {
    background: var(--user-danger);
}

.user-portal-body :is(.form-control, .form-select),
.user-portal-body main form :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, select) {
    min-height: 2.85rem;
    border: 1px solid var(--user-border-strong);
    border-radius: var(--user-radius-sm);
    background-color: var(--user-surface);
    color: var(--user-ink);
}

.user-portal-body textarea.form-control,
.user-portal-body main form textarea {
    min-height: 7.5rem;
}

.user-portal-body :is(.form-control, .form-select):focus,
.user-portal-body main form :is(input, textarea, select):focus {
    border-color: var(--user-accent);
    box-shadow: 0 0 0 0.22rem rgba(20, 120, 173, 0.14);
}

.user-portal-body .form-label,
.user-portal-body main form label:not(.btn) {
    color: var(--user-ink);
    font-size: 0.875rem;
    font-weight: 700;
}

.user-portal-body :is(.form-text, .helptext) {
    color: var(--user-muted);
}

.user-portal-body .form-check-input:checked {
    border-color: var(--user-accent);
    background-color: var(--user-accent);
}

.user-portal-body .table-responsive {
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    background: var(--user-surface);
    box-shadow: var(--user-shadow-xs);
}

.user-portal-body .card > .table-responsive,
.user-portal-body .user-section > .table-responsive {
    border: 0;
    border-radius: inherit;
    box-shadow: none;
}

.user-portal-body .table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #f2f8fb;
    margin-bottom: 0;
    color: var(--user-ink);
    vertical-align: middle;
}

.user-portal-body .table > :not(caption) > * > * {
    padding: 0.85rem 1rem;
    border-bottom-color: var(--user-border);
}

.user-portal-body .table thead th {
    border-bottom-width: 1px;
    background: var(--user-surface-muted);
    color: var(--user-muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.user-portal-body .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 1.75rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 720;
    letter-spacing: 0.01em;
    line-height: 1;
    overflow-wrap: anywhere;
    text-align: center;
}

.user-meta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 1.75rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 740;
    letter-spacing: 0.01em;
    line-height: 1;
    overflow-wrap: anywhere;
    text-align: center;
}

.user-meta-pill--accent {
    border-color: rgba(20, 120, 173, 0.2);
    background: var(--user-accent-soft);
    color: var(--user-accent-strong);
}

.user-meta-pill--warning {
    border-color: rgba(138, 90, 8, 0.18);
    background: var(--user-warning-soft);
    color: var(--user-warning);
}

.user-meta-pill--neutral {
    border-color: var(--user-border);
    background: var(--user-surface-muted);
    color: var(--user-muted);
}

.user-portal-body .alert {
    border: 1px solid currentColor;
    border-radius: var(--user-radius);
    box-shadow: var(--user-shadow-xs);
}

.user-portal-body .list-group {
    overflow: hidden;
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
}

.user-portal-body .list-group-item {
    padding: 1rem 1.15rem;
    border-color: var(--user-border);
    overflow-wrap: anywhere;
}

/*
 * Bootstrap's px-0 utility is !important. Keep a design-system gutter on
 * bordered list rows so legacy feature markup cannot place text or badges
 * directly against the list boundary.
 */
.user-portal-body .list-group > .list-group-item {
    padding-inline: clamp(1rem, 2.5vw, 1.25rem) !important;
}

.user-portal-body .nav-tabs {
    gap: 0.25rem;
    padding: 0.3rem;
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    background: var(--user-surface);
}

.user-portal-body .nav-tabs .nav-link {
    border: 0;
    border-radius: var(--user-radius-sm);
    color: var(--user-muted);
    font-weight: 650;
}

.user-portal-body .nav-tabs .nav-link.active {
    background: var(--user-accent-soft);
    color: var(--user-accent-strong);
}

.user-portal-body .pagination {
    gap: 0.3rem;
    flex-wrap: wrap;
}

.user-portal-body .page-link {
    min-width: 2.65rem;
    min-height: 2.65rem;
    border-color: var(--user-border);
    border-radius: var(--user-radius-sm) !important;
    color: var(--user-accent-strong);
    text-align: center;
}

.user-portal-body .page-item.active .page-link {
    border-color: var(--user-accent);
    background: var(--user-accent);
}

.user-portal-body .modal-content {
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius-xl);
    box-shadow: 0 1.5rem 4rem rgba(8, 59, 92, 0.2);
}

.user-portal-body .footer-minimal {
    border-color: var(--user-border) !important;
    background: rgba(255, 255, 255, 0.94) !important;
}

.user-portal-body main .link-arrow,
.user-portal-body .footer-minimal :is(a, button) {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
}

.user-portal-body :focus-visible {
    outline: 3px solid rgba(20, 120, 173, 0.34);
    outline-offset: 3px;
}

@media (max-width: 991.98px) {
    .user-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-portal-body main .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .user-portal-body main :is(.btn-group, .user-page-actions, .user-action-group) {
        max-width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .user-page {
        padding-top: 1rem;
    }

    .user-page-header {
        align-items: stretch;
        flex-direction: column;
        padding: 1.2rem;
        border-radius: var(--user-radius-lg);
    }

    .user-page-actions,
    .user-action-group {
        justify-content: flex-start;
        width: 100%;
    }

    .user-page-actions > :is(.btn, form, .btn-group),
    .user-action-group > :is(.btn, form, .btn-group) {
        flex: 1 1 auto;
    }

    .user-portal-body main .card-body,
    .user-portal-body main .card-header,
    .user-portal-body main .card-footer,
    .user-section__header,
    .user-section__body {
        padding-right: 1.125rem;
        padding-left: 1.125rem;
    }

    .user-portal-body main form.row > [class*="col-"] > :is(.btn, .btn-group) {
        width: 100%;
    }

    /* Legacy tables become locally scrollable even before their next markup edit. */
    .user-portal-body main .table:not(.table-responsive .table) {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575.98px) {
    .user-stat-grid {
        grid-template-columns: 1fr;
    }

    .user-portal-body main :is(.btn-group, .user-page-actions, .user-action-group) > :is(.btn, form) {
        flex: 1 1 100%;
    }

    .user-portal-body main .btn-group > .btn {
        border-radius: var(--user-radius-sm) !important;
    }

    .user-portal-body main .d-flex.gap-2 > .btn:not(.btn-sm) {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .user-portal-body *,
    .user-portal-body *::before,
    .user-portal-body *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (forced-colors: active) {
    .user-portal-body :focus-visible {
        outline: 3px solid CanvasText;
    }
}

@media print {
    .user-portal-body .site-navbar,
    .user-portal-body .site-nav-spacer,
    .user-portal-body footer,
    .user-portal-body .user-page-actions,
    .user-portal-body .user-action-group,
    .user-portal-body .btn {
        display: none !important;
    }

    .user-portal-body,
    .user-portal-body main {
        background: #fff !important;
    }
}
