/* =========================================================================
   SB Admin 2 Design System — Adapted for Bootstrap 5
   Extracted from SB Admin 2 theme by Start Bootstrap
   Modified for PythonClassroom (BS5 + Bootstrap Icons)
   ========================================================================= */

/* ── Local Nunito Font ── */
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url('../vendor/nunito/nunito-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Nunito';
    font-style: italic;
    font-weight: 200 900;
    font-display: swap;
    src: url('../vendor/nunito/nunito-italic.woff2') format('woff2');
}

/* ── Base Typography ── */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    color: #6e707e;
}

a:focus-visible {
    outline: 2px solid var(--primary-color, #306998);
    outline-offset: 2px;
}

/* ── Wrapper Layout ── */
#wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#wrapper #content-wrapper {
    background-color: #f8f9fc;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

#wrapper #content-wrapper #content {
    flex: 1 0 auto;
}

/* ── Container Padding ── */
.container,
.container-fluid,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-xxl {
    padding-left: 1rem; 
    padding-right: 1rem;
}

/* ── Scroll to Top Button ── */
.scroll-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    text-align: center;
    color: #fff;
    background: rgba(90, 92, 105, 0.5);
    line-height: 46px;
    border-radius: 0.35rem;
    z-index: 1000;
}

.scroll-to-top:focus,
.scroll-to-top:hover {
    color: white;
    background: #5a5c69;
}

/* ── Animations ── */
@keyframes growIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animated--grow-in,
.sidebar .nav-item .collapse {
    animation-name: growIn;
    animation-duration: 200ms;
    animation-timing-function: cubic-bezier(0.18, 1.25, 0.4, 1);
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.animated--fade-in {
    animation-name: fadeIn;
    animation-duration: 200ms;
    animation-timing-function: cubic-bezier(0, 1, 0.4, 1);
}

/* ── Gradient Backgrounds (using PythonClassroom brand colors) ── */
.bg-gradient-primary {
    background-color: #306998;
    background-image: linear-gradient(180deg, #306998 10%, #1e4264 100%);
    background-size: cover;
}

.bg-gradient-secondary {
    background-color: #858796;
    background-image: linear-gradient(180deg, #858796 10%, #60616f 100%);
    background-size: cover;
}

.bg-gradient-success {
    background-color: #1cc88a;
    background-image: linear-gradient(180deg, #1cc88a 10%, #13855c 100%);
    background-size: cover;
}

.bg-gradient-info {
    background-color: #5397ce;
    background-image: linear-gradient(180deg, #5397ce 10%, #306998 100%);
    background-size: cover;
}

.bg-gradient-warning {
    background-color: #ffbe1f;
    background-image: linear-gradient(180deg, #ffbe1f 10%, #dda20a 100%);
    background-size: cover;
}

.bg-gradient-danger {
    background-color: #e74a3b;
    background-image: linear-gradient(180deg, #e74a3b 10%, #be2617 100%);
    background-size: cover;
}

/* ── Gray Scale Backgrounds ── */
.bg-gray-100 { background-color: #f8f9fc !important; }
.bg-gray-200 { background-color: #eaecf4 !important; }
.bg-gray-300 { background-color: #dddfeb !important; }
.bg-gray-400 { background-color: #d1d3e2 !important; }
.bg-gray-500 { background-color: #b7b9cc !important; }
.bg-gray-600 { background-color: #858796 !important; }
.bg-gray-700 { background-color: #6e707e !important; }
.bg-gray-800 { background-color: #5a5c69 !important; }
.bg-gray-900 { background-color: #3a3b45 !important; }

/* ── Gray Scale Text ── */
.text-gray-100 { color: #f8f9fc !important; }
.text-gray-200 { color: #eaecf4 !important; }
.text-gray-300 { color: #dddfeb !important; }
.text-gray-400 { color: #d1d3e2 !important; }
.text-gray-500 { color: #b7b9cc !important; }
.text-gray-600 { color: #858796 !important; }
.text-gray-700 { color: #6e707e !important; }
.text-gray-800 { color: #5a5c69 !important; }
.text-gray-900 { color: #3a3b45 !important; }

/* ── Utility: Overflow Hidden ── */
.o-hidden {
    overflow: hidden !important;
}

/* ── Text Size Utilities ── */
.text-xs { font-size: .7rem; }
.text-lg { font-size: 1.2rem; }
.font-weight-bold { font-weight: 700 !important; }

/* ── Icon Circle ── */
.icon-circle {
    height: 2.5rem;
    width: 2.5rem;
    border-radius: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Border-Left Accent Cards ── */
.border-left-primary   { border-left: 0.25rem solid #306998 !important; }
.border-bottom-primary { border-bottom: 0.25rem solid #306998 !important; }

.border-left-secondary   { border-left: 0.25rem solid #858796 !important; }
.border-bottom-secondary { border-bottom: 0.25rem solid #858796 !important; }

.border-left-success   { border-left: 0.25rem solid #1cc88a !important; }
.border-bottom-success { border-bottom: 0.25rem solid #1cc88a !important; }

.border-left-info   { border-left: 0.25rem solid #5397ce !important; }
.border-bottom-info { border-bottom: 0.25rem solid #5397ce !important; }

.border-left-warning   { border-left: 0.25rem solid #ffbe1f !important; }
.border-bottom-warning { border-bottom: 0.25rem solid #ffbe1f !important; }

.border-left-danger   { border-left: 0.25rem solid #e74a3b !important; }
.border-bottom-danger { border-bottom: 0.25rem solid #e74a3b !important; }

/* ── Progress Bar Small ── */
.progress-sm { height: .5rem; }

/* ── Rotate Utilities ── */
.rotate-15  { transform: rotate(15deg); }
.rotate-n-15 { transform: rotate(-15deg); }

/* ── Dropdown Styles ── */
.dropdown .dropdown-menu {
    font-size: 0.85rem;
}

.dropdown .dropdown-menu .dropdown-header {
    font-weight: 800;
    font-size: 0.65rem;
    color: #b7b9cc;
}

.dropdown.no-arrow .dropdown-toggle::after {
    display: none;
}

/* Sidebar transition — only after first user interaction to prevent flash on load */
.sidebar.sidebar-animate {
    transition: width 0.25s ease-in-out;
}

/* Early sidebar collapse — applied via <html> class before body paints */
html.sidebar-toggled-early .sidebar {
    width: 0 !important;
    overflow: hidden;
}

@media (min-width: 768px) {
    html.sidebar-toggled-early .sidebar {
        overflow: visible;
        width: 6.5rem !important;
    }
    html.sidebar-toggled-early .sidebar .nav-item .nav-link {
        text-align: center;
        padding: 0.75rem 1rem;
        width: 100%;
    }
    html.sidebar-toggled-early .sidebar .nav-item .nav-link span {
        font-size: 0.65rem;
        display: block;
    }
    html.sidebar-toggled-early .sidebar .nav-item .nav-link i {
        margin-right: 0;
    }
    html.sidebar-toggled-early .sidebar .sidebar-brand .sidebar-brand-text {
        display: none;
    }
    html.sidebar-toggled-early .sidebar .sidebar-heading {
        text-align: center;
    }
}

/* ── Topbar ── */
.topbar {
    height: 4.375rem;
    z-index: 2;
}

/* Prevent topbar items from causing horizontal overflow on mobile */
@media (max-width: 767.98px) {
    .topbar {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .topbar .navbar-nav .nav-item {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .topbar .topbar-divider {
        display: none !important;
    }

    .topbar .nav-link {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    .topbar .topbar-brand-text {
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40vw;
    }
}

.topbar #sidebarToggleTop {
    height: 2.5rem;
    width: 2.5rem;
    color: #858796;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar #sidebarToggleTop:hover {
    background-color: #eaecf4;
}

.topbar #sidebarToggleTop:active {
    background-color: #dddfeb;
}

.topbar #sidebarToggleTop:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.topbar .topbar-brand-text {
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
}

.topbar .navbar-search {
    width: 25rem;
}

.topbar .navbar-search input {
    font-size: 0.85rem;
    height: auto;
}

.topbar .topbar-divider {
    width: 0;
    border-right: 1px solid #e3e6f0;
    height: calc(4.375rem - 2rem);
    margin: auto 1rem;
}

.topbar .nav-item .nav-link {
    height: 4.375rem;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
}

.topbar .nav-item .nav-link:focus-visible {
    outline: 2px solid var(--primary-color, #306998);
    outline-offset: -2px;
    border-radius: 0.25rem;
}

.topbar .dropdown {
    position: static;
}

.topbar .dropdown .dropdown-menu {
    width: calc(100% - 1.5rem);
    right: 0.75rem;
}

.topbar .dropdown-list {
    padding: 0;
    border: none;
    overflow: hidden;
}

.topbar .dropdown-list .dropdown-header {
    background-color: #306998;
    border: 1px solid #306998;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    color: #fff;
}

.topbar .dropdown-list .dropdown-item {
    white-space: normal;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-left: 1px solid #e3e6f0;
    border-right: 1px solid #e3e6f0;
    border-bottom: 1px solid #e3e6f0;
    line-height: 1.3rem;
}

.topbar .dropdown-list .dropdown-item .dropdown-list-image {
    position: relative;
    height: 2.5rem;
    width: 2.5rem;
}

.topbar .dropdown-list .dropdown-item .dropdown-list-image img {
    height: 2.5rem;
    width: 2.5rem;
}

.topbar .dropdown-list .dropdown-item .text-truncate {
    max-width: 10rem;
}

.topbar .dropdown-list .dropdown-item:active {
    background-color: #eaecf4;
    color: #3a3b45;
}

@media (min-width: 576px) {
    .topbar .dropdown {
        position: relative;
    }
    .topbar .dropdown .dropdown-menu {
        width: auto;
        right: 0;
    }
    .topbar .dropdown-list {
        width: 20rem !important;
    }
    .topbar .dropdown-list .dropdown-item .text-truncate {
        max-width: 13.375rem;
    }
}

/* ── Topbar Badge Counter ── */
.topbar .nav-item .nav-link .badge-counter,
.sidebar .nav-item .nav-link .badge-counter {
    position: absolute;
    transform: scale(0.7);
    transform-origin: top right;
    right: .25rem;
    margin-top: -.25rem;
}

.topbar .nav-item .nav-link .img-profile,
.sidebar .nav-item .nav-link .img-profile {
    height: 2rem;
    width: 2rem;
}

/* ── Sidebar ── */
.sidebar {
    width: 6.5rem;
    z-index: 1;
    position: relative;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar .nav-item {
    position: relative;
}

.sidebar .nav-item:last-child {
    margin-bottom: 1rem;
}

.sidebar .nav-item .nav-link {
    text-align: center;
    padding: 0.75rem 1rem;
    width: 100%;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.sidebar .nav-item .nav-link span {
    font-size: 0.65rem;
    display: block;
}

.sidebar .nav-item .nav-link i {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}

.sidebar .nav-item .nav-link:hover {
    color: #fff;
}

.sidebar .nav-item .nav-link:hover i {
    color: #fff;
}

.sidebar .nav-item.active .nav-link {
    font-weight: 700;
    color: #fff;
}

.sidebar .nav-item.active .nav-link i {
    color: #fff;
}

/* Mobile sidebar: fixed overlay so topbar sticky-top works independently */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
    }

    html.sidebar-toggled-early .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
    }
}

/* Mobile sidebar backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

/* Show backdrop when sidebar is open on mobile */
@media (max-width: 767.98px) {
    body:not(.sidebar-toggled) .sidebar-backdrop {
        display: block;
    }
}

/* Sidebar Toggled (collapsed) */
.sidebar.toggled {
    width: 0 !important;
    overflow: hidden;
}

/* Sidebar Brand */
.sidebar .sidebar-brand {
    height: 4.375rem;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 800;
    padding: 1.5rem 1rem;
    text-align: center;
    z-index: 1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar .sidebar-brand .sidebar-brand-icon {
    font-size: 3rem;
}

.sidebar .sidebar-brand .sidebar-brand-icon img {
    height: 3rem;
    width: auto;
}

.sidebar .sidebar-brand .sidebar-brand-text {
    display: none;
}

/* Sidebar Divider & Heading */
.sidebar hr.sidebar-divider {
    margin: 0 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar .sidebar-heading {
    text-align: center;
    padding: 0 1rem;
    font-weight: 800;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

/* ── Desktop Sidebar (768px+) ── */
@media (min-width: 768px) {
    .sidebar {
        width: 14rem !important;
    }

    .sidebar .nav-item .nav-link {
        display: block;
        width: 100%;
        text-align: left;
        padding: 1rem;
    }

    .sidebar .nav-item .nav-link i {
        font-size: 0.85rem;
        margin-right: 0.25rem;
    }

    .sidebar .nav-item .nav-link span {
        font-size: 0.85rem;
        display: inline;
    }

    .sidebar .sidebar-brand .sidebar-brand-text {
        display: inline;
    }

    .sidebar .sidebar-heading {
        text-align: left;
    }

    /* Toggled (mini sidebar on desktop) */
    .sidebar.toggled {
        overflow: visible;
        width: 6.5rem !important;
    }

    .sidebar.toggled .nav-item:last-child {
        margin-bottom: 1rem;
    }

    .sidebar.toggled .nav-item .nav-link {
        text-align: center;
        padding: 0.75rem 1rem;
        width: 100%;
    }

    .sidebar.toggled .nav-item .nav-link span {
        font-size: 0.65rem;
        display: block;
    }

    .sidebar.toggled .nav-item .nav-link i {
        margin-right: 0;
    }

    .sidebar.toggled .sidebar-brand .sidebar-brand-text {
        display: none;
    }

    .sidebar.toggled .sidebar-heading {
        text-align: center;
    }
}

/* ── Login Page Styles ── */
.bg-login-image {
    background-color: #f8f9fc;
    min-height: 100%;
}

form.user .form-control-user {
    font-size: 0.9rem;
    border-radius: 10rem;
    padding: 0.75rem 1.25rem;
}

form.user .form-select {
    font-size: 0.9rem;
    border-radius: 10rem;
    padding: 0.75rem 1.25rem;
}

form.user .btn-user {
    font-size: 0.9rem;
    border-radius: 10rem;
    padding: 0.75rem 1rem;
}

/* ── Sticky Footer ── */
footer.sticky-footer {
    padding: 2rem 0;
    flex-shrink: 0;
    background-color: #fff;
}

footer.sticky-footer .copyright {
    line-height: 1;
    font-size: 0.8rem;
}

body.sidebar-toggled footer.sticky-footer {
    width: 100%;
}

/* ── Card Header Styles ── */
.card .card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
}

/* ── Dark Mode Overrides ── */
[data-bs-theme="dark"] #wrapper #content-wrapper {
    background-color: #1a1d21;
}

[data-bs-theme="dark"] .sidebar {
    background-color: #1a2332 !important;
    background-image: linear-gradient(180deg, #1a2332 10%, #0d1520 100%) !important;
}

[data-bs-theme="dark"] .topbar {
    background-color: #212529 !important;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(0,0,0,0.3) !important;
}

[data-bs-theme="dark"] .topbar #sidebarToggleTop {
    color: #d1d3e2;
}

[data-bs-theme="dark"] .topbar #sidebarToggleTop:hover {
    background-color: #343a40;
}

[data-bs-theme="dark"] .topbar #sidebarToggleTop:active {
    background-color: #495057;
}

[data-bs-theme="dark"] .card {
    background-color: #2b3035;
    border-color: #373b3e;
}

[data-bs-theme="dark"] .card .card-header {
    background-color: #343a40;
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] footer.sticky-footer {
    background-color: #1a1d21 !important;
    border-top-color: #373b3e;
}

[data-bs-theme="dark"] .bg-gradient-primary {
    background-color: #1a3a5c;
    background-image: linear-gradient(180deg, #1a3a5c 10%, #0d1f32 100%);
}

[data-bs-theme="dark"] .text-gray-800 {
    color: #d1d3e2 !important;
}

[data-bs-theme="dark"] .text-gray-600 {
    color: #b7b9cc !important;
}

[data-bs-theme="dark"] .border-left-primary { border-left-color: #5397ce !important; }
[data-bs-theme="dark"] .border-left-success { border-left-color: #1cc88a !important; }
[data-bs-theme="dark"] .border-left-info    { border-left-color: #5397ce !important; }
[data-bs-theme="dark"] .border-left-warning { border-left-color: #ffbe1f !important; }
[data-bs-theme="dark"] .border-left-danger  { border-left-color: #e74a3b !important; }

[data-bs-theme="dark"] .bg-login-image { background-color: #1a1d21; }
[data-bs-theme="dark"] .text-gray-900 { color: #d1d3e2 !important; }
