html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
    min-height: 100vh;
    overflow-y: auto; /* Ensure body can scroll vertically */
}
main {
    flex: 1 0 auto;
}
.main-content {
    flex: 1 0 auto;
    display: flex;
    min-height: 0; /* ����X */
}

.sidebar {
    min-width: 220px;
    max-width: 220px;
    background: #23272b;
}

.content-wrapper {
    flex: 1 1 auto;
    padding: 0.5rem 1rem 1rem 1rem;
    min-width: 0; /* ����X */
}

.layout-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrapper {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}


.sidebar .nav-link, .sidebar .navbar-brand {
    color: #fff;
}

.sidebar .nav-link.active, .sidebar .nav-link:focus, .sidebar .nav-link:hover {
    background: #495057;
    color: #fff;
}

.sidebar .navbar-brand {
    font-weight: bold;
    font-size: 1.2rem;
}



@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1031;
        left: -220px;
        transition: left 0.3s;
    }

    .sidebar.show {
        left: 0;
    }

    .content-wrapper {
        margin-left: 0;
    }
}

.navbar-custom {
    background: #23272b;
}

.navbar-custom .navbar-brand, .navbar-custom .nav-link, .navbar-custom .navbar-text {
    color: #fff;
}

.navbar-custom .nav-link:hover {
    color: #ffc107;
}

/* Footer 樣式調整 - 防止遮蔽頁面內容 */
.footer {
    flex-shrink: 0;
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6;
    position: relative;
    z-index: 10;
}

/* 確保主要內容區域有足夠的底部間距 */
.content-wrapper {
    padding-bottom: 2rem !important;
}

/* 在小螢幕上調整Footer */
@media (max-width: 768px) {
    .footer .row {
        text-align: center !important;
    }
    
    .footer .col-md-6 {
        margin-bottom: 0.5rem;
    }
}

/* 修正主要內容的flex屬性 */
main.container-fluid {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}
