/* ==========================================================================
   Admin Dashboard Custom Responsive Styles
   ========================================================================== */

/* Variables and Base Transitions */
:root {
    --sidebar-width: 280px;
    --sidebar-bg: #0f1c17;
    --primary-color: #3b7161;
}

.sidebar-wrapper,
.page-body,
.page-header {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Desktop Sidebar Styles */
.sidebar-wrapper {
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
    z-index: 1001 !important;
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.page-body-wrapper .page-body {
    margin-left: var(--sidebar-width);
    margin-top: 80px; /* Adjust based on header height */
}

.page-header {
    left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    margin-left: 0 !important;
    top: 0;
    position: fixed;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
}

/* Force header toggle visibility */
.header-sidebar-toggle {
    display: flex !important;
    visibility: visible !important;
}

/* Desktop Collapse State */
.sidebar-close .sidebar-wrapper {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-close .page-body {
    margin-left: 0 !important;
}

.sidebar-close .page-header {
    left: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
}

/* Sidebar Elements Styles (Moved from Sidebar.jsx) */
.logo-wrapper {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 20px 24px !important;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.sidebar-main {
    background: var(--sidebar-bg) !important;
}

/* Force toggle visibility when rendered */
.header-sidebar-toggle {
    display: none !important; /* Hidden by default */
}

.sidebar-wrapper .toggle-sidebar {
    display: flex !important;
    visibility: visible !important;
}

/* Show header toggle ONLY when sidebar is closed */
.sidebar-close .header-sidebar-toggle {
    display: flex !important;
}

/* For mobile specifically */
@media (max-width: 1200px) {
    /* If sidebar is NOT open, show header toggle */
    .page-wrapper.sidebar-close .header-sidebar-toggle {
        display: flex !important;
    }
    
    /* If sidebar IS open, the sidebar toggle will be used, hide header one */
    .page-wrapper:not(.sidebar-close) .header-sidebar-toggle {
        display: none !important;
    }
}

.toggle-sidebar:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    transform: scale(1.05);
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.5) !important;
    padding: 14px 20px !important;
    margin: 6px 16px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.sidebar-link.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 8px 16px rgba(59, 113, 97, 0.3) !important;
}

.sidebar-link i {
    font-size: 18px !important;
    margin-right: 14px !important;
    opacity: 0.7;
}

.sidebar-link.active i {
    opacity: 1;
}

.simplebar-content {
    background: var(--sidebar-bg) !important;
}

/* UI Components Consistency */
.card {
    /* border-radius: 16px !important; */
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
}

.table-responsive {
    border-radius: 12px;
    overflow: hidden;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1200px) {
    /* Layout Overrides */
    .sidebar-wrapper {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar-wrapper:not(.close_icon) {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,0.5) !important;
    }

    .page-body {
        margin-left: 0 !important;
        padding: 15px !important;
        margin-top: 70px !important;
    }

    .page-header {
        left: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 5px !important;
        position: fixed;
        top: 0;
        z-index: 1000;
        background: #fff;
        height: 70px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    .header-wrapper {
        padding: 0 !important;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* Header adjustments */
    .left-header {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .left-header h4 {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #333;
        max-width: 100px;
    }

    .nav-right {
        width: auto !important;
        flex: 0 0 auto !important;
    }

    .welcome-container {
        display: none !important; /* Hide welcome on mobile to save space */
    }

    /* Filters & Cards UI Polish */
    .card {
        margin-bottom: 15px !important;
    }

    .card-body {
        padding: 15px !important;
    }

    .project-list .card .row > div {
        padding: 5px 15px !important;
    }

    .project-list .card .row > div.d-flex > div {
        flex: 0 0 calc(50% - 8px) !important;
        margin-bottom: 8px;
    }

    .filter-width {
        flex: 0 0 calc(50% - 8px) !important;
        margin-bottom: 8px;
    }

    .project-list .card .row > div.d-flex > div.search-filter {
        flex: 0 0 100% !important;
        margin-bottom: 8px;
    }

    .search_wrp {
        width: 100% !important;
    }

    .search_wrp input {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .project-list .btn:not(.search-btn) {
        width: 100% !important;
        justify-content: center !important;
    }

    .search-btn {
        width: auto !important;
        padding: 0 20px !important;
    }

    .form-control, .form-select {
        height: 42px !important;
        font-size: 14px !important;
        /* border-radius: 8px !important; */
        border: 1px solid #e0e0e0 !important;
    }

    .btn-sm {
        height: 42px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px !important;
    }

    /* Breadcrumbs on mobile */
    .page-title {
        margin-bottom: 15px !important;
    }

    .breadcrumb {
        background: transparent !important;
        padding: 0 !important;
        font-size: 11px !important;
    }

    .table-container {
        border-radius: 12px;
        background: #fff;
        border: 1px solid #f0f0f0;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .project-status-table {
        min-width: 800px;
    }
}

@media (max-width: 576px) {
    .left-header h4 {
        display: none !important; /* Hide text if screen is too small */
    }
    
    .nav-right .nav-menus {
        gap: 10px !important;
    }

    .profile-nav .profile-media img {
        width: 32px !important;
        height: 32px !important;
    }
}
