@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0d6efd;
    --primary-soft: rgba(13, 110, 253, 0.1);
    --sidebar-bg: #ffffff;
    --sidebar-width: 280px;
    --header-height: 70px;
    --body-bg: #f4f7fa;
    --text-main: #212529;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
}

body {
    font-family: 'Public Sans', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    font-size: 0.9375rem;
    /* 15px base */
    line-height: 1.6;
}

/* Typography Harmony */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: #1a1d21;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

/* Adjusted from previous large display */
h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

.small,
small {
    font-size: 0.8125rem;
}

.smallest {
    font-size: 0.7rem;
}

/* Layout Structure */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    z-index: 1050;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#content {
    margin-left: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent the main container from scrolling */
    transition: all 0.25s ease;
}

.topbar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    /* Header won't shrink */
    z-index: 1000;
}

#main-body {
    flex: 1;
    overflow-y: auto;
    /* This area scrolls */
    background-color: var(--body-bg);
}

.footer {
    flex-shrink: 0;
    /* Footer won't shrink */
    background: #fff;
    z-index: 1000;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #adb5bd;
    padding: 0 0.75rem;
    margin: 1rem 0 0.25rem;
}

.nav-link-custom {
    display: flex;
    padding: 0.5rem 0.75rem;
    color: #495057;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link-custom i {
    font-size: 1.125rem;
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.nav-link-custom:hover {
    background-color: var(--primary-soft);
    color: var(--primary-color);
}

.nav-link-custom.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Premium Components */
.card-premium {
    background: #fff;
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body-custom {
    padding: 1.5rem;
}

/* Control Refinement */
.form-control,
.form-select {
    font-size: 0.9375rem;
    padding: 0.6rem 0.75rem;
    border-color: #dee2e6;
    border-radius: 0.375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.btn {
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Table Excellence */
.table thead th {
    background-color: #f8f9fa;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #6c757d;
    letter-spacing: 0.025em;
    border-top: none;
    padding: 1rem 1.5rem;
}

.table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
}

/* Dashboard Stat Cards */
.stat-card {
    padding: 1.25rem;
    display: flex;
    align-items: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

/* Utility Classes */
.bg-purple-soft {
    background-color: rgba(111, 66, 193, 0.1) !important;
}

.text-purple {
    color: #6f42c1 !important;
}

.border-purple-subtle {
    border-color: rgba(111, 66, 193, 0.25) !important;
}

.bg-primary-soft {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

@media (max-width: 991.98px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    #sidebar.show {
        margin-left: 0;
    }

    #content {
        margin-left: 0;
    }
}

/* Page Loader Styling */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s;
}

#loader-wrapper.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--primary-soft);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 2px;
    font-size: 0.75rem;
    text-transform: uppercase;
}