/* ===== General layout ===== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #f5f7fa;
    color: #263445;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

main,
.container {
    width: min(100% - 2rem, 1100px);
    margin: 2rem auto;
}

/* ===== Headings and links ===== */

h1, h2, h3, h4 {
    color: #183153;
    line-height: 1.3;
}

h1 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

h2 {
    margin-top: 1.8rem;
    font-size: 1.5rem;
}

a {
    color: #2459c9;
    text-decoration: none;
}

a:hover {
    color: #2459c9;
    text-decoration: underline;
}

/* ===== Navigation bar ===== */

.navbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem max(1rem, calc((100% - 1100px) / 2));
    background-color: #183153;
    color: white;
}

.navbar a {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    color: white;
    text-decoration: none;
}

.navbar a:hover {
    background-color: #2b466a;
}

.navbar .navbar-brand {
    margin-right: 1rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.navbar-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ===== Forms ===== */

form {
    margin: 1rem 0;
}

form p {
    margin-bottom: 1.25rem;
}

/* label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
} */

input[type="radio"] {
    display: inline;
    margin-right: 0.4rem;
}

label:has(input[type="radio"]) {
    display: inline;
    font-weight: normal;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
select,
textarea {
    width: 100%;
    max-width: 500px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #cbd3df;
    border-radius: 5px;
    background-color: white;
    color: #263445;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #9bbdf5;
    outline-offset: 1px;
    border-color: #2459a9;
}

input[type="checkbox"],
input[type="radio"] {
    margin-right: 0.4rem;
}

.helptext {
    display: block;
    margin-top: 0.25rem;
    color: #68778a;
    font-size: 0.875rem;
}

.errorlist {
    padding-left: 1.25rem;
    color: #b42318;
}

/* ===== Buttons ===== */

button,
input[type="submit"],
.button {
    display: inline-block;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 5px;
    background-color: #2459a9;
    color: white;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
input[type="submit"]:hover,
.button:hover {
    background-color: #183f80;
    color: white;
    text-decoration: none;
}

button:focus-visible,
input[type="submit"]:focus-visible,
a:focus-visible {
    outline: 2px solid #6194e8;
    outline-offset: 3px;
}

/* ===== Tables ===== */

table {
    width: 100%;
    margin: 1.25rem 0;
    border-collapse: collapse;
    background-color: white;
}

th, td {
    padding: 6px 8px;
    border-bottom: 1px solid #e0e5ec;
    text-align: left;
    vertical-align: top;
    font-size: 0.75rem;
}

th {
    background-color: #eaf0f7;
    color: #183153;
    font-weight: 700;
}

tbody tr:hover {
    background-color: #f5f8fc;
}

/* ===== Messages and notices ===== */

.messages {
    margin: 1rem 0;
    padding: 0;
    list-style: none;
}

.messages li {
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid #b9d5f5;
    border-radius: 5px;
    background-color: #eaf3ff;
    color: #183f70;
}

/* Django message tags */

.messages .success {
    border-color: #a7d9b5;
    background-color: #eaf7ee;
    color: #176534;
}

.messages .error {
    border-color: #f0b4b0;
    background-color: #fdf0ef;
    color: #a12622;
}

.messages .warning {
    border-color: #f0d28b;
    background-color: #fff7e5;
    color: #795500;
}

/* ===== Small screens ===== */

@media (max-width: 600px) {
    main,
    .container {
        width: calc(100% - 1.5rem);
        margin: 1.25rem auto;
    }

    h1 {
        font-size: 1.65rem;
    }

    .navbar {
        padding: 0.5rem;
    }

    .navbar-brand {
        width: 100%;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.5rem;
    }
}


/* ===== Disabled and read-only fields ===== */

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
textarea[readonly] {
    background-color: #e9ecef !important;
    color: #6c757d !important;
    border-color: #ced4da !important;
    cursor: not-allowed;
    opacity: 1 !important;
}

input:disabled,
select:disabled,
textarea:disabled {
    pointer-events: none;
}

