/* ==========================================================================
   QLCT - QUẢN LÝ CÔNG TRÌNH
   Sleek Collapsible Two-Pane Layout Stylesheet
   ========================================================================== */

/* Page Layout overrides to prevent overlap under the absolute/fixed site header */
#pagebody {
    padding-top: 100px !important; /* Matches desktop header height */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    font-family: 'Manrope', 'Roboto', Helvetica, Arial, sans-serif;
}

@media (max-width: 1200px) {
    #pagebody {
        padding-top: 130px !important;
    }
}

@media (max-width: 768px) {
    #pagebody {
        padding-top: 150px !important;
    }
}

/* Base Body Font Override */
body {
    font-family: 'Manrope', 'Roboto', Helvetica, Arial, sans-serif;
    background-color: #ffffff;
}

/* Main Container */
#qlct-container {
    display: flex;
    position: relative;
    background-color: #ffffff;
    flex: 1;
    overflow: visible; /* Crucial: allows the circular toggle button to show when collapsed */
    border-top: 1px solid #e2e8f0;
}

/* Collapsible Left Sidebar (Sticky on Desktop) */
.qlct-sidebar {
    width: 320px;
    background-color: #f4f7fc; /* Light blue-gray sidebar background from screenshot */
    border-right: 1px solid #cbd5e1;
    position: sticky;
    top: 100px; /* Aligned with #pagebody padding-top */
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    overflow: visible;
}

@media (max-width: 1200px) {
    .qlct-sidebar {
        top: 130px;
        height: calc(100vh - 130px);
    }
}

/* Sidebar collapsed state: slides out of view to the left */
.qlct-sidebar.collapsed {
    margin-left: -320px;
}

/* Tab Navigation Header */
.qlct-tabs {
    display: flex;
    background-color: #e2e8f0;
    border-bottom: 1px solid #cbd5e1;
    padding: 6px;
    gap: 6px;
}

.qlct-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-weight: 700;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-align: center;
}

.qlct-tab-btn:hover {
    color: #2155ce;
    background-color: rgba(33, 85, 206, 0.05);
}

.qlct-tab-btn.active {
    color: #2155ce;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Tab Content Viewports */
.qlct-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.qlct-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Categories Tree View styling */
.qlct-tree-wrapper {
    padding: 10px 0;
}

.qlct-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.qlct-tree-item {
    display: flex;
    flex-direction: column;
}

/* Category Headers (e.g. parent items) */
.qlct-tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 13.5px;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.qlct-tree-header:hover {
    background-color: rgba(33, 85, 206, 0.04);
    color: #2155ce;
}

/* When a branch is open, highlight the parent title in blue */
.qlct-tree-item.open > .qlct-tree-header {
    color: #2155ce;
    background-color: rgba(33, 85, 206, 0.02);
}

/* Nested Submenu list */
.qlct-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.015);
    display: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.qlct-tree-item.open > .qlct-submenu {
    display: block;
}

/* Submenu/Leaf list items (Warm orange/brown color from screenshot) */
.qlct-submenu-item {
    padding: 10px 20px 10px 36px;
    font-size: 13px;
    color: #b55d14; /* Orange-brown font color */
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
}

.qlct-submenu-item:hover {
    background-color: rgba(33, 85, 206, 0.05);
    color: #2155ce;
}

/* Active sub-item styling */
.qlct-submenu-item.active {
    background-color: #ffffff;
    color: #b45309;
    font-weight: 800;
    border-left: 3px solid #2155ce; /* Left blue accent marker */
    box-shadow: inset 2px 0 4px rgba(0, 0, 0, 0.02);
}

/* Chevron arrow alignment */
.qlct-arrow {
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.25s ease;
}

.qlct-tree-item.open > .qlct-tree-header > .qlct-arrow {
    transform: rotate(90deg);
    color: #2155ce;
}

/* Search panel styling */
.qlct-search-container {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qlct-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.qlct-search-box .search-icon {
    position: absolute;
    left: 12px;
    color: #94a3b8;
    font-size: 14px;
}

#qlct-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
}

#qlct-search-input:focus {
    border-color: #2155ce;
    box-shadow: 0 0 0 3px rgba(33, 85, 206, 0.15);
}

.qlct-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qlct-filter-group label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

#qlct-filter-type {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    outline: none;
    background-color: #ffffff;
    cursor: pointer;
}

#qlct-filter-type:focus {
    border-color: #2155ce;
}

/* Search Results list */
.qlct-search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    max-height: calc(100vh - 380px);
    overflow-y: auto;
}

.qlct-search-item {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qlct-search-item:hover {
    border-color: #2155ce;
    background-color: #f0f5ff;
}

.qlct-search-item.active {
    border-color: #2155ce;
    background-color: #eff6ff;
    font-weight: 600;
}

.qlct-search-item h4 {
    margin: 0 0 4px 0;
    font-size: 13.5px;
    color: #1e293b;
    font-weight: 700;
}

.qlct-search-item p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.search-empty-state {
    text-align: center;
    padding: 24px 12px;
    color: #94a3b8;
}

.search-empty-state i {
    font-size: 24px;
    margin-bottom: 8px;
}

.search-empty-state p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
}

/* Floating Circular Toggle Button */
.qlct-toggle-btn {
    position: absolute;
    right: -16px;
    top: 76px;
    width: 32px;
    height: 32px;
    background-color: #2155ce;
    color: #ffffff;
    border: 3px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(33, 85, 206, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    outline: none;
}

.qlct-toggle-btn:hover {
    background-color: #1e40af;
    transform: scale(1.1);
}

/* Arrow rotation when sidebar is collapsed */
.qlct-sidebar.collapsed .qlct-toggle-btn {
    transform: rotate(180deg);
}
.qlct-sidebar.collapsed .qlct-toggle-btn:hover {
    transform: rotate(180deg) scale(1.1);
}

/* Right Content Area */
.qlct-content {
    flex: 1;
    padding: 32px;
    background-color: #ffffff;
    min-width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Content Title & Header */
.qlct-content-header {
    border-bottom: 2px solid #2155ce; /* Blue underline */
    padding-bottom: 14px;
    margin-bottom: 24px;
}

.qlct-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qlct-content-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.qlct-edit-btn {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    color: #2155ce;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    font-size: 14px;
}

.qlct-edit-btn:hover {
    background-color: rgba(33, 85, 206, 0.08);
    border-color: #2155ce;
}

/* Content Text and Typography Formatting */
.qlct-content-body {
    font-size: 14.5px;
    line-height: 1.8;
    color: #334155;
}

.qlct-content-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-top: 28px;
    margin-bottom: 14px;
    border-left: 4px solid #2155ce;
    padding-left: 10px;
}

.qlct-content-body h4 {
    font-size: 15.5px;
    font-weight: 600;
    color: #334155;
    margin-top: 20px;
    margin-bottom: 10px;
}

.qlct-content-body p {
    margin-top: 0;
    margin-bottom: 18px;
    text-align: justify;
}

.qlct-content-body strong {
    color: #0f172a;
}

/* Statistics Grid */
.qlct-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.qlct-stat-card {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    border-top: 3px solid #2155ce;
}

.qlct-stat-num {
    font-size: 24px;
    font-weight: 800;
    color: #2155ce;
    display: block;
    margin-bottom: 6px;
}

.qlct-stat-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

/* Tables inside right pane */
.qlct-table-content {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.qlct-table-content th {
    background-color: #f1f5f9;
    color: #1e293b;
    font-weight: 700;
    text-align: left;
    padding: 14px;
    border-bottom: 2px solid #cbd5e1;
}

.qlct-table-content td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    color: #475569;
}

.qlct-table-content tr:hover {
    background-color: rgba(33, 85, 206, 0.015);
}

.qlct-table-content tr:last-child td {
    border-bottom: none;
}

/* Responsive / Mobile layout */
@media (max-width: 992px) {
    #qlct-container {
        flex-direction: column;
    }
    
    .qlct-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #cbd5e1;
        position: relative;
        top: 0 !important;
        height: auto !important;
    }
    
    .qlct-sidebar.collapsed {
        margin-left: 0;
        height: 0;
        overflow: hidden;
        border-bottom: none;
    }
    
    .qlct-tab-content {
        max-height: 300px;
    }
    
    .qlct-toggle-btn {
        display: none; /* Hide circular button on mobile view */
    }
    
    .qlct-content {
        padding: 20px;
    }
}
