:root {
    --navy: #05345c;
    --navy-light: #235279;
    --red: #e43131;
    --text-grey: #666;
    --page-bg: #f2f5f8;
}

body {
    margin: 0;
    display: flex;
    min-height: 100vh;
    font-family: system-ui, sans-serif;
}

/* sidebar */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    background: var(--navy);
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
}

.sidebar a.active,
.sidebar a:hover {
    background: var(--navy-light);
}

.logout-form {
    margin-top: auto;
}

.logout-form button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--red);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.logout-form button:hover {
    background: var(--navy-light);
}

/* header bar + content column */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* rounded corner of main */
    background: var(--navy);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--navy);
    color: #fff;
}

.topbar-text {
    font-size: 1.4rem;
}

.logo {
    height: 42px;
}

main {
    flex: 1;
    padding: 1.5rem;
    background: var(--page-bg);
    border-top-left-radius: 16px;
}

h1, h2 {
    color: var(--navy);
}

/* home cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    max-width: 900px;
}

.card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 1rem;
    color: inherit;
    text-decoration: none;
    background: #fff;
}

.card p {
    color: var(--text-grey);
}

/* icon sizing */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.sidebar-username {
    color: #fff;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.avatar {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    /* recoloring the black svg to white */
    filter: brightness(0) invert(1);
}

.card-icon {
    width: 48px;
    height: 48px;
    /* recolor the black svg to --navy */
    filter: brightness(0) saturate(100%) invert(21%) sepia(92%) saturate(1060%) hue-rotate(183deg) brightness(65%) contrast(100%);
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-icon {
    width: 48px;
    height: 48px;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--navy);
}

/* shared form styling */
main label {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.95rem;
}

main input,
main select,
main textarea {
    padding: 0.5rem 0.7rem;
    border: 1px solid #ccd5de;
    border-radius: 8px;
    font: inherit;
    background: #fff;
    box-sizing: border-box;
}

main form button {
    padding: 0.55rem 1.4rem;
    border: none;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

main form button:hover {
    background: var(--navy-light);
}

.btn {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    text-decoration: none;
}

.btn:hover {
    background: var(--navy-light);
}

/* white panel for stacked forms (wellbeing, booking) */
.form-card {
    max-width: 480px;
    padding: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
}

.form-card p {
    margin: 0 0 1rem;
}

.form-card label {
    display: block;
    margin-bottom: 0.35rem;
}

.form-card input,
.form-card select,
.form-card textarea {
    width: 100%;
}

/* study space search bar */
.space-search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    max-width: 900px;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
}

.space-search-form p {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}

.space-search-form a {
    align-self: center;
    color: var(--navy);
}

/* card lists: study spaces + directory */
.space-list,
.directory-list {
    display: grid;
    gap: 1rem;
    max-width: 900px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.space-list li,
.directory-list li {
    padding: 1.25rem;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
}

.space-list h2,
.directory-list h2 {
    margin: 0 0 0.25rem;
}

.directory-link {
    color: var(--navy);
    text-decoration: none;
}

.directory-link:hover {
    text-decoration: underline;
}

.space-list p,
.directory-list p {
    margin: 0.35rem 0;
    color: var(--text-grey);
}

.space-list .space-building {
    color: var(--navy);
    font-weight: 600;
}

.space-list .btn {
    margin-top: 0.75rem;
}

/* availability badges */
.badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-free {
    background: #e2f3e6;
    color: #1a7f37;
}

.badge-in-use {
    background: #fdeee0;
    color: #b25e09;
}

.badge-closed {
    background: #eceff2;
    color: #5c6670;
}

/* academic calendar */
.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-nav a {
    padding: 0.4rem 1rem;
    border: 1px solid #ccd5de;
    border-radius: 8px;
    background: #fff;
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
}

.calendar-nav a:hover {
    background: var(--navy);
    color: #fff;
}

.calendar-wrap {
    max-width: 900px;
    overflow-x: auto;
}

.calendar-wrap table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.calendar-wrap th {
    padding: 0.6rem;
    background: var(--navy);
    color: #fff;
    font-weight: 600;
    text-align: center;
}

.calendar-wrap td {
    height: 72px;
    padding: 0.4rem 0.5rem;
    border-top: 1px solid #e5eaef;
    vertical-align: top;
    text-align: left;
}

.calendar-wrap td + td {
    border-left: 1px solid #e5eaef;
}

.calendar-wrap td.noday {
    background: #f7f9fb;
}

.calendar-wrap td ul {
    margin: 0.3rem 0 0;
    padding: 0;
    list-style: none;
}

.calendar-wrap td li {
    margin-top: 0.2rem;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: var(--navy);
    color: #fff;
    font-size: 0.78rem;
    overflow-wrap: break-word;
}

/* profile card */
.profile-card {
    max-width: 480px;
    padding: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e5eaef;
}

.profile-avatar {
    width: 56px;
    height: 56px;
}

.profile-header h2 {
    margin: 0;
}

.profile-header p {
    margin: 0.15rem 0 0;
    color: var(--text-grey);
}

.profile-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.6rem 1.5rem;
    margin: 0 0 1.5rem;
}

.profile-details dt {
    font-weight: 600;
    color: var(--navy);
}

.profile-details dd {
    margin: 0;
}

/* login page */
.login-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3.5rem;
    padding: 1.5rem;
    background: radial-gradient(circle at 50% 45%, var(--navy-light), var(--navy) 75%);
}

.login-logo {
    height: 72px;
    margin-bottom: 3rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5rem;
    width: 100%;
    max-width: 420px;
}

.login-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    background: #ffffff;
}

.login-field-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.login-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 1.2rem;
    color: var(--navy);
}

.login-field input::placeholder {
    color: #b5b5b5;
}

.login-remember {
    align-self: center;
    margin-top: -2.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    font-weight: 600;
}

.login-remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--red);
}

.login-button {
    width: 75%;
    padding: 0.7rem;
    border: 1px solid #ffffff;
    border-radius: 10px;
    background: var(--navy-light);
    color: #ffffff;
    font-size: 1.3rem;
    font-family: inherit;
    cursor: pointer;
}

.login-button:hover {
    background: #2d6291;
}

.login-error {
    /* counteract the form gap so this sits just above the username field */
    margin-bottom: -3.5rem;
    color: #ff9d9d;
    font-weight: 600;
}

.admin-login-link {
    /* counteract the form gap so this sits just under the button */
    margin-top: -3.5rem;
    color: #ffffff;
    font-size: 0.95rem;
}
