html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* Ensure the page doesn't add extra height that forces body scrolling */
html, body {
    height: 100%;
}

body {
    margin-bottom: 0;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    /*box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;*/
}

header {
    padding-top: 1rem;
}

html {
    position: relative;
    min-height: 100%;
}

/* Ensure focus styles are not visually clipped */
.form-select:focus,
.form-control:focus {
    outline: 2px solid #258cfb;
    outline-offset: 2px;
    border-color: #ced4da;
    box-shadow: none;
    z-index: unset !important;
}

/* Catalogue styling */
.catalogue .search-input {
    display: flex;
    position: relative; /* needed for the ::after ring */
    border-radius: 0.6rem; /* match visual shape of the group */
}

    /* Unified focus ring around the entire search input group */
    /* Draw one ring for the whole group when any child is focused */
    .catalogue .search-input:focus-within::after {
        content: "";
        position: absolute;
        inset: 1px; /* place ring outside the group */
        border-radius: .6rem;
        pointer-events: none;
        /* mimic Bootstrap focus ring */
        box-shadow: 0 0 0 2px #fff, 0 0 0 4px #258cfb;
    }

    /* Remove per-control focus ring to avoid double highlighting inside the group */
    .catalogue .search-input .form-control:focus,
    .catalogue .search-input .input-group-text:focus {
        outline: none !important;
        box-shadow: none !important;
    }

/* Catalogue styling */
/* Search input: DESKTOP = icon on the LEFT (mockup), MOBILE flips to RIGHT */
.catalogue .search-input {
    display: flex;
}

    .catalogue .search-input .input-group-text {
        border-top-left-radius: 0.6rem;
        border-bottom-left-radius: 0.6rem;
        border-right: 0;
    }

    .catalogue .search-input .form-control {
        border-top-right-radius: 0.6rem;
        border-bottom-right-radius: 0.6rem;
    }

/* Filter "chips" */
.filter-select {
    border-radius: 0.6rem;
    border-color: #e4e7ec;
    background-color: #fff;
    padding: .6rem .9rem;
    line-height: 1.2;
    font-weight: 600;
    color: #232b3a;
    min-width: 9.5rem;
}

/* Course card */
.course-item {
    background: #fff;
    border: 1px solid #e7ebef;
    border-radius: 0.6rem;
    padding: .5rem 1rem;
    transition: box-shadow .15s ease, transform .02s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/*    .course-item:hover {
        box-shadow: 0 6px 16px rgba(16, 24, 40, 0.08);
    }*/

.course-title {
    word-break: break-word;
}

/* Slightly larger title on desktop to mimic mockup scale */
@media (min-width: 992px) {
    .course-title.h3 {
        font-size: 1.75rem;
    }
}

/* Badges */
:root {
    --course-badge-width: 7.5rem; /* default fixed width for index */
}

.badges .badge {
    font-weight: 600;
    box-sizing: border-box; /* include padding/border within width */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--course-badge-width);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Variable (auto) width override used on Details page */
.badges.badges-variable .badge {
    width: auto;
}

.badges .bg-ects {
    background: #f57d55;
    color: #fff;
    padding: .5rem .65rem;
    font-size: .9rem;
}

.badges .bg-level {
    background: #f2f4f7;
    color: #232b3a;
    border: 1px solid #e4e7ec;
    padding: .5rem .65rem;
    font-size: .9rem;
}

/* Mobile tweaks: stack title over badges and move icon to the RIGHT */
@media (max-width: 576.98px) {
    .filter-select {
        min-width: unset;
        flex: 1 0 auto;
    }

    .catalogue .search-input .form-control {
        border-top-left-radius: 0.6rem;
        border-bottom-left-radius: 0.6rem;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

    .catalogue .search-input .input-group-text {
        border-top-right-radius: 0.6rem;
        border-bottom-right-radius: 0.6rem;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-left: 0;
    }

    .course-item {
        display: block;
        padding: 1rem 1.25rem;
    }

    .badges {
        margin-top: .5rem;
    }

    .course-title.h3 {
        font-size: 1.35rem;
    }

    .badges .badge {
        width: auto;
    }
}

.badge.bg-ects {
    background: #f57d55;
    color: #fff;
    padding: .5rem .65rem;
    font-size: .9rem;
    font-weight: 600;
}

.badge.bg-level {
    background: #f2f4f7;
    color: #232b3a;
    border: 1px solid #e4e7ec;
    padding: .5rem .65rem;
    font-size: .9rem;
    font-weight: 600;
}
