/* Enhanced Sidebar - Fix for Page Layouts */

/* إزالة Scroll من القائمة الجانبية بالكامل - قواعد قوية جداً */
.sidebar,
.sidebar *,
.sidebar-menu,
.sidebar-menu *,
.menu-section,
.menu-items {
    overflow: visible !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    max-height: none !important;
}

/* إزالة أي ارتفاع محدد قد يسبب scroll */
.sidebar {
    height: calc(100vh - 64px) !important;
    max-height: calc(100vh - 64px) !important;
}

/* تحسين توزيع العناصر داخل القائمة */
.sidebar {
    display: flex !important;
    flex-direction: column !important;
}

.sidebar-header {
    flex-shrink: 0 !important;
    padding: 16px 20px 12px !important;
}

.sidebar-menu {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-evenly !important;
    padding: 4px 0 !important;
    overflow: visible !important;
}

.menu-section {
    flex-shrink: 0 !important;
    margin-bottom: 0 !important;
}

.menu-section-title {
    padding: 0 20px 4px !important;
    font-size: 9.5px !important;
    margin-bottom: 2px !important;
}

.menu-item {
    margin: 0px 8px !important;
}

.menu-link {
    padding: 7px 12px !important;
    font-size: 13.5px !important;
    line-height: 1.2 !important;
}

.menu-link i {
    font-size: 14px !important;
}

.sidebar-footer {
    flex-shrink: 0 !important;
    margin-top: auto !important;
    padding: 10px 20px !important;
}

/* قاعدة نهائية قوية جداً لإزالة أي scroll */
nav.sidebar,
.sidebar,
#sidebar {
    overflow: visible !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
}

/* إزالة scrollbar بالكامل */
.sidebar::-webkit-scrollbar,
.sidebar-menu::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.sidebar,
.sidebar-menu {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* Ensure body doesn't have extra margins when sidebar is present */
body.has-sidebar {
    overflow-x: hidden;
}

/* Main content adjustment when sidebar is present */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    margin-left: 0;
    padding: 20px;
    min-height: 100vh;
    background: #f5f7fa;
    transition: margin-left 0.3s ease;
    width: 100%;
    overflow-x: hidden;
}

/* When sidebar is present */
body:has(.sidebar-enhanced) .main-content {
    margin-left: 280px;
}

body:has(.sidebar-enhanced.collapsed) .main-content {
    margin-left: 80px;
}

/* Page Header Fixes */
.page-header {
    background: linear-gradient(135deg, #4c51bf 0%, #667eea 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 15px rgba(76, 81, 191, 0.2);
}

.page-header .breadcrumb {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: white;
}

.breadcrumb-separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.breadcrumb-current {
    color: white;
    font-weight: 600;
}

/* Summary Section Fixes */
.summary-section {
    margin-bottom: 24px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.summary-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.summary-card .summary-icon {
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    color: white;
}

.summary-card.critical .summary-icon {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.summary-card.warning .summary-icon {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}

.summary-card.info .summary-icon {
    background: linear-gradient(135deg, #eab308 0%, #facc15 100%);
}

.summary-card.success .summary-icon {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.summary-content h3 {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.summary-content p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 8px;
}

.summary-change {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.summary-change.positive {
    color: #10b981;
}

.summary-change.negative {
    color: #ef4444;
}

.summary-change.neutral {
    color: #6b7280;
}

/* Content Grid Fixes */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-bottom: 24px;
}

.content-main {
    min-width: 0;
}

.content-sidebar {
    min-width: 0;
}

/* Data Table Section Fixes */
.data-table-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:hover,
.filter-select:focus {
    border-color: #3b82f6;
    outline: none;
}

.search-input {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    min-width: 250px;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #3b82f6;
    outline: none;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fafafa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table thead tr {
    background: #f0f0f0;
    border-bottom: 2px solid #e5e7eb;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f8f8;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #1f2937;
    background: #fcfcfc;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background: #f5f5f5;
}

.data-table tbody tr:hover td {
    background: #f5f5f5;
}

/* Remove Colors from Table Indicators */
.utilization-bar {
    width: 100px;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.utilization-fill {
    height: 100%;
    background: #d1d5db !important;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.utilization-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: #374151;
}

/* Remove Colors from Status Badges */
.idle-time.excellent,
.idle-time.good,
.idle-time.average,
.idle-time.poor {
    background: #f3f4f6 !important;
    color: #666 !important;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.efficiency-badge.excellent,
.efficiency-badge.good,
.efficiency-badge.average,
.efficiency-badge.poor {
    background: #f3f4f6 !important;
    color: #666 !important;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active,
.status-badge.idle,
.status-badge.underutilized,
.status-badge.under-utilized {
    background: #f3f4f6 !important;
    color: #666 !important;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Action Buttons */
.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.action-btn.secondary {
    background: white;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.action-btn.secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Responsive Fixes */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    body:has(.sidebar-enhanced) .main-content {
        margin-left: 0;
    }
    
    .sidebar-enhanced {
        transform: translateX(-100%);
    }
    
    .sidebar-enhanced.open {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .table-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
}

/* Fade-in Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fix z-index issues */
.sidebar-enhanced {
    z-index: 1000;
}

.main-content {
    z-index: 1;
    position: relative;
}

/* Ensure proper spacing */
.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.header-left h1 {
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}
