:root {
    --fyp-font-size-xs: 0.75rem;
    --fyp-font-size-sm: 0.875rem;
    --fyp-font-size-base: 1rem;
    --fyp-font-size-md: 1.0625rem;
    --fyp-font-size-lg: 1.125rem;
    --fyp-font-size-xl: 1.25rem;
    --fyp-font-size-2xl: 1.5rem;
    --fyp-font-size-3xl: 2rem;
    --fyp-line-height-base: 1.5;
    --fyp-top-navbar-offset: 5rem;
}

html {
    font-size: 16px;
}

body {
    background: #f4f7fb;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-size: var(--fyp-font-size-base);
    line-height: var(--fyp-line-height-base);
}

img,
video,
iframe,
canvas,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

div.dataTables_wrapper div.dataTables_filter input,
div.dataTables_wrapper div.dataTables_length select,
div.dt-container div.dt-search input,
div.dt-container div.dt-length select {
    margin-left: 0.5rem;
}

div.dataTables_wrapper div.dt-buttons,
div.dt-container div.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

div.dataTables_wrapper div.dt-buttons .btn,
div.dt-container div.dt-buttons .btn,
div.dt-container div.dt-buttons .dt-button {
    margin: 0;
}

div.dataTables_wrapper .dataTables_length,
div.dataTables_wrapper .dataTables_filter,
div.dataTables_wrapper .dataTables_info,
div.dataTables_wrapper .dataTables_paginate,
div.dt-container .dt-length,
div.dt-container .dt-search,
div.dt-container .dt-info,
div.dt-container .dt-paging,
table.dataTable tbody th,
table.dataTable tbody td {
    font-size: var(--fyp-font-size-sm);
}

table.dataTable > thead > tr > th.no-sort::after,
table.dataTable > thead > tr > th.no-sort::before,
table.dataTable > thead > tr > td.no-sort::after,
table.dataTable > thead > tr > td.no-sort::before {
    display: none !important;
}

table.dataTable > thead > tr > th.no-sort .dt-column-order,
table.dataTable > thead > tr > td.no-sort .dt-column-order {
    display: none !important;
}

p,
li,
td,
th,
label,
input,
select,
textarea,
button {
    font-size: var(--fyp-font-size-base);
}

small,
.small,
.form-text,
.text-muted {
    font-size: var(--fyp-font-size-sm);
}

h1,
.h1 {
    font-size: clamp(1.75rem, 1.45rem + 0.9vw, var(--fyp-font-size-3xl));
    line-height: 1.2;
}

h2,
.h2 {
    font-size: clamp(1.4rem, 1.2rem + 0.6vw, var(--fyp-font-size-2xl));
    line-height: 1.25;
}

h3,
.h3 {
    font-size: clamp(1.2rem, 1.08rem + 0.4vw, 1.75rem);
    line-height: 1.3;
}

h4,
.h4,
h5,
.h5,
h6,
.h6 {
    line-height: 1.3;
}

.form-label {
    font-size: var(--fyp-font-size-sm);
}

.form-control,
.form-select,
.btn,
.dropdown-item,
.nav-link,
.navbar-brand {
    font-size: 0.95rem;
}

.table {
    font-size: 0.9375rem;
}

.badge,
.status-badge {
    font-size: var(--fyp-font-size-sm);
}

/* Tab labels increased by 10% from the compact size */
.nav-tabs .nav-link,
.nav-pills .nav-link {
    font-size: 0.732rem;
    padding: 0.385rem 0.77rem;
}

.display-1,
.display-2,
.display-3,
.display-4,
.display-5,
.display-6 {
    line-height: 1.1;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 290px;
    flex: 0 0 290px;
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    color: #e5eefc;
    padding: 1.25rem 1rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.app-sidebar-brand:hover {
    color: #fff;
}

.app-sidebar-section-title {
    color: rgba(229, 238, 252, 0.7);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.15rem 0 0.65rem;
    padding: 0 0.5rem;
}

.app-sidebar-nav .nav-link {
    color: rgba(229, 238, 252, 0.88);
    border-radius: 0.8rem;
    padding: 0.72rem 0.85rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.app-sidebar-nav .nav-link:hover,
.app-sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-sidebar-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    font-weight: 600;
    margin-bottom: 0.9rem;
}

.app-sidebar-user .nav-user-avatar,
.app-sidebar-user .nav-user-avatar-fallback {
    border-color: rgba(255, 255, 255, 0.18);
}

.app-sidebar-logout {
    width: 100%;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
}

main.container:not(.auth-layout),
main.container-fluid:not(.auth-layout) {
    width: 95%;
    max-width: 95vw;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

main.container:not(.auth-layout),
main.container-fluid:not(.auth-layout) {
    padding-left: clamp(0.75rem, 2vw, 1.25rem);
    padding-right: clamp(0.75rem, 2vw, 1.25rem);
}

.hero-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.08);
}

.status-badge {
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
}

.activity-card {
    border: 0;
    border-left: 5px solid transparent;
}

.activity-card.ongoing {
    border-left-color: #198754;
}

.activity-card.upcoming {
    border-left-color: #0d6efd;
}

.activity-card.past {
    border-left-color: #6c757d;
}

.activity-number {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
}

.activity-number.ongoing {
    background: #d1e7dd;
    color: #146c43;
}

.activity-number.upcoming {
    background: #cfe2ff;
    color: #0a58ca;
}

.activity-number.past {
    background: #e2e3e5;
    color: #495057;
}

.time-badge {
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
}

.modal {
    overflow-y: auto;
}

.modal-dialog {
    margin: 1rem auto;
}

.modal-content {
    max-height: calc(100vh - 2rem);
}

.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tooltip-inner {
    max-width: 420px;
    text-align: left;
    white-space: normal;
}

.nav-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.nav-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

.nav-user-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.app-top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.app-top-navbar .container {
    width: 95%;
    max-width: 95vw;
    margin-left: auto;
    margin-right: auto;
}

body.app-body-with-topnav {
    padding-top: var(--fyp-top-navbar-offset);
}

@media (max-width: 1199.98px) {
    .app-top-navbar .container,
    main.container:not(.auth-layout),
    main.container-fluid:not(.auth-layout) {
        width: 96vw;
        max-width: 96vw;
    }
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        flex-basis: auto;
        height: auto;
        position: relative;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    :root {
        --fyp-top-navbar-offset: 4.75rem;
    }

    main.container:not(.auth-layout),
    main.container-fluid:not(.auth-layout),
    .app-top-navbar .container {
        width: calc(100vw - 1.5rem);
        max-width: calc(100vw - 1.5rem);
    }

    .app-top-navbar .navbar-brand {
        font-size: 0.98rem;
    }

    .app-top-navbar .navbar-nav {
        gap: 0.25rem;
    }

    .app-top-navbar .btn {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .modal-dialog {
        margin: 0.75rem auto;
    }

    .modal-content {
        max-height: calc(100vh - 1.5rem);
    }
}

@media (max-width: 767.98px) {
    html {
        font-size: 15px;
    }

    .app-top-navbar {
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
    }

    .app-top-navbar .container {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
    }

    .app-top-navbar .navbar-collapse {
        padding: 0.75rem 0 0.25rem;
    }

    .app-sidebar {
        padding: 1rem 0.85rem;
    }

    .app-sidebar-brand {
        font-size: 1rem;
    }

    .app-sidebar-nav .nav-link {
        padding: 0.65rem 0.75rem;
    }

    .app-sidebar-footer {
        margin-top: 1rem;
        padding-top: 0.85rem;
    }

    .app-sidebar-user {
        font-size: 0.95rem;
    }

    .hero-card,
    .card,
    .modal-content {
        border-radius: 0.9rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575.98px) {
    main.container:not(.auth-layout),
    main.container-fluid:not(.auth-layout),
    .app-top-navbar .container {
        width: calc(100vw - 0.75rem);
        max-width: calc(100vw - 0.75rem);
    }

    .app-top-navbar .navbar-brand {
        font-size: 0.92rem;
    }

    .app-top-navbar .navbar-toggler {
        padding: 0.25rem 0.45rem;
    }

    .app-top-navbar .btn {
        width: 100%;
    }

    .app-top-navbar .d-flex.align-items-center.gap-3 {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }

    .modal-dialog {
        margin: 0.5rem auto;
    }

    .modal-content {
        max-height: calc(100vh - 1rem);
    }

    .modal-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }
}