/* Hargeisa Plastic Factory - Modern Design with Sidebar */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --border-radius-lg: 16px;
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--dark-color);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Layout Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles - Premium Dark Theme */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3), inset 1px 0 0 rgba(255, 255, 255, 0.03);
    transition: var(--transition);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(99, 102, 241, 0.15);
}

.sidebar::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4));
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.6), rgba(139, 92, 246, 0.6));
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-size: 1.35rem;
    font-weight: 700;
    white-space: nowrap;
    transition: var(--transition);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sidebar-brand span:first-child {
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    pointer-events: none;
}

.sidebar-user-info {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-toggle {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(99, 102, 241, 0.35);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Sidebar Menu */
.sidebar-menu {
    padding: 1rem 0.75rem;
}

.menu-section {
    margin-bottom: 1.75rem;
}

.menu-section-title {
    padding: 0.5rem 1rem;
    margin: 0 0.5rem 0.5rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
    transition: var(--transition);
    border-radius: 6px;
}

.sidebar.collapsed .menu-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 0 0.5rem 0.25rem 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 3px 3px 0;
    transition: height 0.25s ease;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.menu-item:hover::before {
    height: 60%;
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    color: white;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.menu-item.active::before {
    height: 100%;
    top: 0;
    transform: none;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}

.menu-icon {
    width: 28px;
    height: 28px;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: var(--transition);
}

.menu-item:hover .menu-icon,
.menu-item.active .menu-icon {
    background: rgba(99, 102, 241, 0.2);
}

.menu-text {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 0.75rem;
    margin: 0 0.5rem 0.25rem 0.5rem;
}

.sidebar.collapsed .menu-icon {
    margin-right: 0;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    height: var(--header-height);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Content Wrapper */
.content-wrapper {
    padding: 2rem;
    position: relative;
}

/* Bootstrap table overrides for consistent styling */
.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.8);
}

.table-striped > tbody > tr:nth-of-type(even) {
    background-color: white;
}

.table-primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1)) !important;
}

/* Modern Cards */
.modern-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.modern-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(99, 102, 241, 0.08);
}

.card-header-modern {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.card-header-modern::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08));
}

.card-body-modern {
    padding: 1.5rem;
}

/* Stat Cards */
.stat-card-modern {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 16px;
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-card-modern:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.35);
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: pulse 4s ease-in-out infinite;
}

.stat-card-modern.success {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.stat-card-modern.success:hover {
    box-shadow: 0 16px 40px rgba(16, 185, 129, 0.35);
}

.stat-card-modern.warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}

.stat-card-modern.warning:hover {
    box-shadow: 0 16px 40px rgba(245, 158, 11, 0.35);
}

.stat-card-modern.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
}

.stat-card-modern.danger:hover {
    box-shadow: 0 16px 40px rgba(239, 68, 68, 0.35);
}

.stat-card-modern.info {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.25);
}

.stat-card-modern.info:hover {
    box-shadow: 0 16px 40px rgba(6, 182, 212, 0.35);
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0.5rem 0;
    position: relative;
    z-index: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Quick Access Cards */
.quick-access-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 14px;
    text-decoration: none;
    color: var(--dark-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.quick-access-card:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.2);
}

.quick-access-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.quick-access-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

/* Buttons */
.btn-modern {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.btn-primary-modern {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary-modern:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.btn-success-modern {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.btn-success-modern:hover {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.btn-danger-modern {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.btn-secondary-modern {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

.btn-info-modern {
    background: linear-gradient(135deg, var(--info-color), #0891b2);
    color: white;
}

/* Form Controls */
.form-control-modern,
.form-select-modern {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.25s ease;
    font-size: 1rem;
    background: #fafafa;
}

.form-control-modern:hover,
.form-select-modern:hover {
    border-color: #cbd5e1;
}

.form-control-modern:focus,
.form-select-modern:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
    outline: none;
    background: white;
}

.form-label-modern {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

/* Tables */
.table-modern,
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    background: white;
}

.table-modern thead th,
.table thead th {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border: none;
    font-weight: 600;
    padding: 1rem 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
}

.table-modern tbody tr,
.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.table-modern tbody tr:hover,
.table tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.04), transparent);
}

.table-modern tbody td,
.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

/* Alerts */
.alert-modern {
    border: none;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.alert-modern.success {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    color: #065f46;
    border-left: 5px solid var(--success-color);
}

.alert-modern.danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
    color: #991b1b;
    border-left: 5px solid var(--danger-color);
}

.alert-modern.info {
    background: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 100%);
    color: #0e7490;
    border-left: 5px solid var(--info-color);
}

.alert-modern.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fffbeb 100%);
    color: #92400e;
    border-left: 5px solid var(--warning-color);
}

/* Badges */
.badge-modern {
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: 10px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.badge-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.08));
    color: #047857;
}

.badge-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
    color: #b91c1c;
}

.badge-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.08));
    color: #b45309;
}

.badge-info,
.badge.bg-primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15)) !important;
    color: var(--primary-color) !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
}

/* Menu Toggle Button - Always visible and prominent */
.menu-toggle-btn,
#mobileMenuBtn, 
#menuToggleBtn {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1rem !important;
    border-radius: var(--border-radius) !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    min-width: 48px !important;
    height: 48px !important;
    box-shadow: var(--shadow-md) !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1001 !important;
    position: relative !important;
}

.menu-toggle-btn svg,
#mobileMenuBtn svg, 
#menuToggleBtn svg {
    width: 24px !important;
    height: 24px !important;
    stroke: white !important;
}

.menu-toggle-btn:hover,
#mobileMenuBtn:hover, 
#menuToggleBtn:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.menu-toggle-btn:active,
#mobileMenuBtn:active, 
#menuToggleBtn:active {
    transform: translateY(0) !important;
}

/* Ensure button is always visible even with btn-modern classes */
button.menu-toggle-btn,
button#mobileMenuBtn.btn-modern,
button#mobileMenuBtn.btn-secondary-modern,
button#menuToggleBtn.btn-modern,
button#menuToggleBtn.btn-secondary-modern {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: var(--primary-color) !important;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Sidebar backdrop overlay on mobile */
    .sidebar.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        animation: fadeIn 0.3s ease-out;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    .top-header {
        padding: 0 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .card-body-modern {
        padding: 1rem;
    }
}

/* Animation Utilities */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* Text Gradient */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Grid Layout */
.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Flex Utilities */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Spacing */
.mb-section {
    margin-bottom: 2rem;
}

.mt-section {
    margin-top: 2rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

