:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-bg: #ffffff;
    --body-bg: #f1f5f9;
    --success: #10b981;
    --danger: #ef4444;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--body-bg);
    color: var(--text-main);
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.sidebar-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    padding: 12px 24px;
    cursor: pointer;
    color: var(--text-main);
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-links li:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.nav-links li.active {
    background-color: #eff6ff;
    color: var(--primary-color);
    border-right: 4px solid var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.page-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h1 {
    font-size: 1.75rem;
}

.section-header p {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:disabled {
    border-color: var(--text-muted);
    color: var(--text-muted);
    cursor: not-allowed;
}

.w-100 { width: 100%; }

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card h3 {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 8px;
}

.card .stat {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.report-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-card h3 { color: var(--text-main); font-size: 1.2rem; }

/* Tables */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--secondary-color);
    color: var(--text-muted);
    font-weight: 600;
}

tr:hover { background-color: #f8fafc; }

/* Sticky Column for Mobile Scrolling */
.sticky-col {
    position: sticky;
    right: 0;
    background-color: white;
    z-index: 1;
    border-left: 2px solid var(--border-color); /* To clearly separate it from scrolled content */
    box-shadow: -2px 0 5px rgba(0,0,0,0.05); /* Slight shadow to show depth */
}

th.sticky-col {
    background-color: var(--secondary-color);
    z-index: 2;
}

tr:hover .sticky-col {
    background-color: #f8fafc;
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
}

select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    outline: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px 10px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s;
    margin: auto; /* Centers vertically if short, allows scrolling if tall */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input { width: 18px; height: 18px; }
.checkbox-group label { margin-bottom: 0; cursor: pointer; }

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #printInventoryModal, #printInventoryModal * {
        visibility: visible;
    }
    #printInventoryModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        box-shadow: none;
        padding: 0;
    }
    .modal-content {
        max-width: 100%;
        box-shadow: none;
        padding: 0;
    }
    .print-hide {
        display: none !important;
    }
    .print-area {
        margin-top: 0 !important;
        padding: 20px !important;
    }
}

.mobile-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.hamburger-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

/* Responsive Design (Mobile & Tablet) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: -280px; /* Hidden by default */
        width: 280px;
        height: 100vh;
        z-index: 1050;
        transition: right 0.3s ease-in-out;
    }

    .sidebar.open {
        right: 0;
    }

    .mobile-overlay.active {
        display: block;
    }

    .nav-links {
        display: block;
    }
    
    .nav-links li {
        border-right: 4px solid transparent !important;
        border-bottom: none;
        padding: 12px 24px;
    }

    .nav-links li.active {
        border-right: 4px solid var(--primary-color) !important;
        border-bottom: none;
    }

    .main-content {
        padding: 10px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 15px;
    }

    .section-header div {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 10px;
    }
    
    .section-header div button, .section-header div a {
        flex: 1;
        text-align: center;
        padding: 8px;
    }

    .table-container {
        overflow-x: auto;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .filters select, .filters input, .filters button {
        flex: 1 1 auto;
        min-width: 100px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px auto;
    }
}
/* Notification Bell */
.notification-bell {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #fff;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s ease;
    border: 2px solid #e2e8f0;
}
.notification-bell:hover {
    transform: scale(1.1);
}
.bell-icon {
    font-size: 26px;
    animation: ring 2s infinite ease-in-out;
}
.notification-bell .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e53e3e;
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}
@keyframes ring {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-10deg); }
    30% { transform: rotate(5deg); }
    40% { transform: rotate(-5deg); }
    50% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #fff;
    color: #2d3748;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    font-weight: 600;
    border-right: 5px solid var(--primary-color);
    transform: translateX(-150%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }


:root {
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
}
.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-danger:hover {
    background-color: var(--danger-hover);
}
