:root {
    --admin-sidebar-width: 260px;
    --admin-sidebar-tablet-width: 92px;
    --table-cell-padding-x-sm: 0.5rem;
}

body {
    background-color: #f8f9fa;
}

body.admin-portal,
body.public-portal {
    min-height: 100vh;
}

body.public-portal {
    display: flex;
    flex-direction: column;
}

body.public-portal main,
body.admin-portal main {
    flex-grow: 1;
}

body.admin-portal #wrapper {
    min-width: 768px;
}

#sidebar-wrapper {
    height: 100vh;
    left: 0;
    position: fixed;
    top: 0;
    transition: width 0.2s ease;
    width: var(--admin-sidebar-width);
    z-index: 1000;
}

#page-content-wrapper {
    display: flex;
    flex-direction: column;
    margin-left: var(--admin-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.2s ease, width 0.2s ease;
    width: calc(100% - var(--admin-sidebar-width));
}

.sticky-navbar {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    position: sticky;
    top: 0;
    z-index: 999;
}

.admin-portal .card {
    border-radius: 8px;
}

.admin-portal .table-responsive {
    -webkit-overflow-scrolling: touch;
}

.admin-portal .table > :not(caption) > * > *,
.public-portal .table > :not(caption) > * > *,
.table-sm >:not(caption) > * > * {
    padding-left: var(--table-cell-padding-x-sm);
    padding-right: var(--table-cell-padding-x-sm);
}

.admin-portal .btn,
.public-portal .btn {
    white-space: nowrap;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
}

.admin-sidebar {
    background: #17202a;
    color: #eef3f7;
}

.sidebar-brand {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 72px;
    padding: 0.85rem 1rem;
}

.sidebar-logo {
    background: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    height: 44px;
    object-fit: contain;
    padding: 0.15rem;
    width: 44px;
}

.sidebar-brand-text {
    min-width: 0;
}

.sidebar-kicker {
    color: #9ad0c2;
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.sidebar-brand h5 {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-scroll {
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    scrollbar-width: thin;
}

.sidebar-nav {
    gap: 0.2rem;
    padding: 0.8rem;
}

.sidebar-section {
    color: #8fa3b6;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0;
    list-style: none;
    margin: 0.9rem 0 0.25rem;
    padding: 0 0.55rem;
    text-transform: uppercase;
}

.sidebar-link {
    align-items: center;
    border-radius: 8px;
    color: #d7e0e8;
    display: flex;
    font-size: 0.9rem;
    font-weight: 600;
    gap: 0.65rem;
    min-height: 40px;
    padding: 0.55rem 0.65rem;
}

.sidebar-link i {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #9ad0c2;
    display: inline-flex;
    flex: 0 0 28px;
    font-size: 1rem;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.sidebar-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-link:hover,
.sidebar-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-link.active,
.sidebar-link.bg-primary {
    background: #2f80ed !important;
    box-shadow: 0 10px 24px rgba(47, 128, 237, 0.24);
    color: #ffffff;
}

.sidebar-link.active i,
.sidebar-link.bg-primary i {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

@media (min-width: 992px) {
    .public-portal main.container {
        max-width: 1140px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    body.admin-portal {
        overflow-x: auto;
    }

    #sidebar-wrapper {
        width: var(--admin-sidebar-tablet-width);
    }

    #page-content-wrapper {
        margin-left: var(--admin-sidebar-tablet-width);
        width: calc(100% - var(--admin-sidebar-tablet-width));
    }

    .admin-portal main.container-fluid {
        padding: 1rem !important;
    }

    .admin-portal #sidebar-wrapper .sidebar-brand {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .admin-portal #sidebar-wrapper .sidebar-brand-text,
    .admin-portal #sidebar-wrapper .sidebar-section,
    .admin-portal #sidebar-wrapper .sidebar-link span {
        display: none;
    }

    .admin-portal #sidebar-wrapper .sidebar-logo {
        height: 46px;
        width: 46px;
    }

    .admin-portal #sidebar-wrapper .nav-link {
        text-align: center;
    }

    .admin-portal #sidebar-wrapper .nav {
        gap: 0.35rem !important;
        padding: 0.75rem 0.5rem !important;
    }

    .admin-portal #sidebar-wrapper .sidebar-link {
        justify-content: center;
        min-height: 44px;
        padding: 0.5rem;
    }

    .admin-portal #sidebar-wrapper .sidebar-link i {
        flex-basis: 30px;
        font-size: 1.1rem;
        height: 30px;
        margin-right: 0 !important;
        width: 30px;
    }

    .admin-portal .navbar {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .admin-portal .navbar-brand {
        font-size: 1rem;
        max-width: 55vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-portal .row.g-4 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    .admin-portal .col-md-2,
    .admin-portal .col-md-3,
    .admin-portal .col-md-4,
    .admin-portal .col-md-8 {
        flex: 0 0 auto;
        width: 50%;
    }
}

@media (max-width: 767.98px) {
    body.admin-portal {
        min-width: 768px;
        overflow-x: auto;
    }

    body.admin-portal::before {
        background: #fff3cd;
        border-bottom: 1px solid #ffe69c;
        color: #664d03;
        content: "Admin portal supports web and tablet views. Rotate or use a wider screen.";
        display: block;
        font-size: 0.875rem;
        font-weight: 600;
        padding: 0.5rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1100;
    }

    .public-portal main.container {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
    }

    .public-portal .card {
        border-radius: 8px;
    }
}
