/* ===== 1. RESET & ROOT VARIABLES ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* === Color Palette === */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;

    --success: #059669;
    --success-dark: #047857;
    --success-light: #d1fae5;

    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --danger-light: #fee2e2;

    --warning: #d97706;
    --warning-dark: #b45309;
    --warning-light: #fef3c7;

    --info: #0891b2;
    --info-dark: #0e7490;
    --info-light: #cffafe;

    /* === Gray Scale === */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --white: #ffffff;
    --black: #000000;

    /* === Shadows === */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* === Border Radius === */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* === Transitions === */
    --transition: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
    --transition-fast: all 0.1s ease-in-out;

    /* === Spacing Scale === */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* === Typography === */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    
    /* Fixed font scale for better readability */
    --text-xs: 0.75rem;    /* 12px - for badges, captions */
    --text-sm: 0.875rem;   /* 14px - for secondary text */
    --text-base: 1rem;     /* 16px - default body text */
    --text-lg: 1.125rem;   /* 18px - for emphasis */
    --text-xl: 1.25rem;    /* 20px - for subheadings */
    --text-2xl: 1.5rem;    /* 24px - for headings */
    --text-3xl: 1.875rem;  /* 30px - for large headings */
    --text-4xl: 2.25rem;   /* 36px - for hero text */

    /* === Z-Index === */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
    --z-toast: 1070;
}

/* ===== 2. BASE & TYPOGRAPHY ===== */
body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography improvements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-4);
    color: var(--gray-900);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
    margin-bottom: var(--space-4);
    color: var(--gray-700);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== 3. LAYOUT & CONTAINERS ===== */
.app-container {
    background: var(--gray-50);
    min-height: calc(100vh - 72px);
    padding: var(--space-6);
}

.main-content {
    background: var(--white);
    max-width: 1400px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="%23ffffff" opacity="0.1"><polygon points="1000,100 1000,0 0,100"></polygon></svg>');
    background-size: cover;
}

.page-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    position: relative;
    color: var(--white);
}

.page-header p {
    font-size: var(--text-base);
    opacity: 0.9;
    position: relative;
    max-width: 800px;
    color: #000000;
    margin: 0 auto;
    font-weight: 500;
    text-shadow: #111827;
}

.page-content {
    padding: var(--space-6);
}

.page-content h3 {
color: white;}

.page-content p {
color: black;}

/* ===== 4. NAVIGATION ===== */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
}

.navbar img {
    height: 32px;
    width: auto; 
    margin-right: var(--space-4);
    object-fit: contain;
    transition: var(--transition);
}

.navbar img:hover {
    transform: scale(1.05);
}

.nav-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.nav-brand {
    color: var(--gray-800);
    font-size: var(--text-xl);
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-right: var(--space-4);
}

.nav-menu {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.nav-item {
    background: none;
    border: none;
    color: var(--gray-600);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-weight: 500;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    position: relative;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    transform: translateY(-1px);
}

.nav-item:hover::after {
    width: 80%;
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-left: auto;
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--gray-700);
    font-weight: 500;
    font-size: var(--text-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: var(--text-sm);
    font-weight: 600;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-weight: 600;
    color: var(--gray-800);
}

/* Dropdown styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.dropdown-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.caret {
    font-size: var(--text-xs);
    transition: transform 0.3s ease;
}

.dropdown.active .caret {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-3);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 240px;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-slow);
    backdrop-filter: blur(8px);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    text-decoration: none;
    color: var(--gray-700);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    font-size: var(--text-sm);
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--gray-900);
}

.dropdown-item.user-profile {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-5) var(--space-4);
}

.dropdown-item.user-profile strong {
    font-size: var(--text-sm);
    color: var(--gray-900);
    font-weight: 600;
}

.dropdown-item.user-profile small {
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 500;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--gray-200);
    margin: var(--space-2) 0;
}

.logout-btn {
    color: var(--danger);
    font-weight: 600;
}

.logout-btn:hover {
    background-color: var(--danger-light);
    color: var(--danger-dark);
}

.logout-icon {
    font-size: var(--text-base);
    opacity: 0.8;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--danger);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-slow);
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-logout:active {
    transform: translateY(0);
}

/* Animation for dropdown */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-menu {
    animation: dropdownFadeIn 0.2s ease-out;
}

/* Focus states for accessibility */
.dropdown-toggle:focus-visible,
.dropdown-item:focus-visible,
.btn-logout:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== 5. COMPONENTS ===== */

.nav-logo {
    height: 32px;
    width: auto; 
    margin-right: var(--space-3);
    object-fit: contain;
    transition: var(--transition);
}

.nav-logo:hover {
    transform: scale(1.05); 
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition-slow);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: var(--gray-50);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.card-header h3 {
    margin: 0;
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-body {
    padding: var(--space-6);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.dashboard-card {
    color: var(--white);
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition-slow);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
}

.dashboard-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
    will-change: transform; /* Hint for browser optimization */
}

.dashboard-card:nth-child(1) { background: linear-gradient(135deg, var(--success), var(--success-dark)); }
.dashboard-card:nth-child(2) { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.dashboard-card:nth-child(3) { background: linear-gradient(135deg, var(--warning), var(--warning-dark)); }
.dashboard-card:nth-child(4) { background: linear-gradient(135deg, var(--danger), var(--danger-dark)); }
.dashboard-card:nth-child(5) { background: linear-gradient(135deg, var(--info), var(--info-dark)); }
.dashboard-card:nth-child(6) { background: linear-gradient(135deg, #8b5cf6, #7c3aed); } /* Purple */
.dashboard-card:nth-child(7) { background: linear-gradient(135deg, #ec4899, #db2777); } /* Pink */
.dashboard-card:nth-child(8) { background: linear-gradient(135deg, #14b8a6, #0d9488); } /* Teal */

.dashboard-card h3 {
    font-size: var(--text-4xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    position: relative;
    color: var(--white);
}

.dashboard-card p {
    font-size: var(--text-base);
    opacity: 0.9;
    font-weight: 500;
    position: relative;
    color: var(--white);
}

/* ===== ✅ NEW: RESPONSIVE BREAKPOINTS FOR 8 CARDS ===== */

/* Large screens (1200px+) - 4 columns */
@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablets (768px - 1199px) - 2 columns */
@media (min-width: 768px) and (max-width: 1199px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-5);
    }
    
    .dashboard-card {
        min-height: 130px;
        padding: var(--space-6);
    }
    
    .dashboard-card h3 {
        font-size: var(--text-3xl);
    }
}

/* Mobile (below 768px) - 1 column */
@media (max-width: 767px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .dashboard-card {
        min-height: 120px;
        padding: var(--space-6);
    }
    
    .dashboard-card h3 {
        font-size: var(--text-3xl);
    }
}

/* Extra small devices (below 480px) - 1 column */
@media (max-width: 479px) {
    .dashboard-grid {
        gap: var(--space-3);
    }
    
    .dashboard-card {
        min-height: 100px;
        padding: var(--space-4);
    }
    
    .dashboard-card h3 {
        font-size: var(--text-xl);
    }
    
    .dashboard-card p {
        font-size: var(--text-xs);
    }
}

/* ===== ✅ NEW: STAGGERED ANIMATIONS ===== */
.dashboard-card {
    animation: fadeInUp 0.5s ease-out backwards;
}

.dashboard-card:nth-child(1) { animation-delay: 0.05s; }
.dashboard-card:nth-child(2) { animation-delay: 0.1s; }
.dashboard-card:nth-child(3) { animation-delay: 0.15s; }
.dashboard-card:nth-child(4) { animation-delay: 0.2s; }
.dashboard-card:nth-child(5) { animation-delay: 0.25s; }
.dashboard-card:nth-child(6) { animation-delay: 0.3s; }
.dashboard-card:nth-child(7) { animation-delay: 0.35s; }
.dashboard-card:nth-child(8) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--gray-700);
    font-size: var(--text-sm);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.form-control:read-only {
    background: var(--gray-50);
    color: var(--gray-600);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-5);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em;
    padding-right: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    transition: var(--transition-slow);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before { left: 100%; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Variants */
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: var(--success-dark); }

.btn-secondary { background: var(--gray-500); color: var(--white); }
.btn-secondary:hover { background: var(--gray-600); }

/* Sizes */
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: var(--text-base); }
.btn-block { width: 100%; }

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: auto; /* Add vertical scrolling */
    max-height: 70vh; /* Set a max-height relative to the viewport */
    margin: var(--space-6) 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    scroll-behavior: smooth; /* Enable smooth scrolling */
    position: relative; /* Needed for sticky headers */
}

.table {
    width: 100%;
    min-width: 800px;
    border-collapse: separate; /* Changed from 'collapse' */
    border-spacing: 0; /* Add this to remove gaps */
    background: var(--white);
}

.table th {
    background: var(--gray-50);
    color: var(--gray-700);
    padding: var(--space-4) var(--space-3);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Add this line */
}

.table td {
    padding: var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-sm);
    vertical-align: middle;
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--gray-50);
    transform: translateY(-1px); /* Add this line */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); /* Add this line */
}   

.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover td { background: var(--primary-light); }

.table-bordered,
.table-bordered th,
.table-bordered td { border: 1px solid var(--gray-200); }

/* Modals */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    animation: modalFadeIn 0.3s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal.active { 
    display: flex !important;
}

.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease-out;
    margin: auto;
    position: relative;
}

.large-modal {
    max-width: 90%;
    width: 90%;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    background: var(--gray-50);
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: var(--text-xl);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.close {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: var(--text-2xl);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--gray-700);
    background: var(--gray-200);
}

.modal-body { 
    padding: var(--space-6); 
}

.modal-footer {
    padding: var(--space-4);
    text-align: right;
    border-top: 1px solid var(--gray-200);
}

/* ===== 6. BADGES & STATUS ===== */
/* Base Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 12px;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border: 1px solid;
    transition: var(--transition);
}

/* Badge Variants */
.badge-completed { 
    background: var(--success-light); 
    color: var(--success-dark); 
    border-color: var(--success); 
}

.badge-in-progress { 
    background: var(--warning-light); 
    color: var(--warning-dark); 
    border-color: var(--warning); 
}

.badge-pending { 
    background: var(--info-light); 
    color: var(--info-dark); 
    border-color: var(--info); 
}

.badge-active { 
    background: var(--primary-light); 
    color: var(--primary-dark); 
    border-color: var(--primary); 
}

.badge-inactive { 
    background: var(--gray-100); 
    color: var(--gray-600); 
    border-color: var(--gray-300); 
}

.badge-processing { 
    background: var(--info-light); 
    color: var(--info-dark); 
    border-color: var(--info); 
}

.badge-cancelled { 
    background: var(--danger-light); 
    color: var(--danger-dark); 
    border-color: var(--danger); 
}

/* Priority Badges */
.priority-urgent { 
    background: var(--danger-light); 
    color: var(--danger-dark); 
    border-color: var(--danger); 
    animation: pulse 2s infinite;
}

.priority-high { 
    background: var(--warning-light); 
    color: var(--warning-dark); 
    border-color: var(--warning); 
}

.priority-normal { 
    background: var(--gray-200); 
    color: var(--gray-700); 
    border-color: var(--gray-400); 
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

.status-progress {
    background: var(--info-light);
    color: var(--info-dark);
    border: 1px solid var(--info);
}

.status-completed {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid var(--success);
}

/* Progress Bar Component */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 140px;
}

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius);
    transition: var(--transition-slow);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.3) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Progress Variants */
.progress-completed .progress-fill {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
}

.progress-inprogress .progress-fill {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
}

.progress-pending .progress-fill {
    background: linear-gradient(135deg, var(--gray-500), var(--gray-600));
}

.progress-delayed .progress-fill {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
}

/* Progress Info */
.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-sm);
}

.progress-percentage {
    font-weight: 700;
    color: var(--gray-800);
}

.progress-quantity {
    color: var(--gray-600);
    font-weight: 500;
}

/* Batch Progress Bar */
.batch-progress {
    width: 100%;
    height: 24px;
    background-color: var(--gray-200);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.batch-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--success-dark) 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-xs);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    position: relative;
}

.batch-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

.batch-progress-text {
    font-size: var(--text-xs);
    color: var(--gray-600);
    margin-top: var(--space-1);
    text-align: center;
    font-weight: 500;
}

/* ===== 7. ALERTS & NOTIFICATIONS ===== */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.alert-success { background: var(--success-light); border-color: var(--success); color: var(--success-dark); }
.alert-error { background: var(--danger-light); border-color: var(--danger); color: var(--danger-dark); }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning-dark); }
.alert-info { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }

.notification {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    max-width: 400px;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    color: var(--white);
    font-weight: 600;
    z-index: var(--z-toast);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    backdrop-filter: blur(8px);
    animation: slideInRight 0.3s ease-out;
}

.notification::before { font-size: var(--text-lg); }

.notification.success { background: linear-gradient(135deg, var(--success), var(--success-dark)); }
.notification.success::before { content: '✅'; }

.notification.error { background: linear-gradient(135deg, var(--danger), var(--danger-dark)); }
.notification.error::before { content: '❌'; }

.notification.info { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.notification.info::before { content: 'ℹ️'; }

.notification.warning { background: linear-gradient(135deg, var(--warning), var(--warning-dark)); }
.notification.warning::before { content: '⚠️'; }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== 8. LOADING STATES ===== */
.loading {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal);
    transition: var(--transition-slow);
}

.loading-overlay .spinner {
    width: 50px; height: 50px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-4);
}

.loading-overlay p { color: var(--gray-600); font-weight: 500; }

.btn.loading { pointer-events: none; color: transparent; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 9. FEATURE SPECIFIC STYLES ===== */

/* BOM & Planning */
.bom-items {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin: var(--space-6) 0;
}

.bom-items h4 {
    margin-bottom: var(--space-4);
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--text-base);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.bom-item-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: uppercase;
    color: var(--gray-600);
}

.bom-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: var(--space-4);
    align-items: end;
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.bom-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.remove-bom-item {
    background: var(--danger);
    color: var(--white);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-bom-item:hover {
    background: var(--danger-dark);
    transform: scale(1.1);
}

.planning-controls {
    background: linear-gradient(135deg, var(--gray-50), var(--white));
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
    position: relative;
}

.planning-controls::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.planning-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.planning-row:hover {
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

/* Batch Management */
.batch-calculation-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: var(--space-5);
    margin: var(--space-5) 0;
}

.batch-calculation-card h4 {
    margin-bottom: var(--space-4);
    color: var(--gray-800);
}

.batch-breakdown {
    margin-top: var(--space-4);
}

.batch-list {
    max-height: 200px;
    overflow-y: auto;
}

.batch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3);
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
    margin-bottom: var(--space-1);
    border-radius: var(--radius);
}

.batch-number {
    font-weight: 600;
    color: var(--gray-800);
}

.batch-quantity {
    color: var(--gray-600);
}

.batch-status {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-xl);
    font-weight: 600;
}

.batch-status.pending {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.batch-status.in-progress {
    background: var(--info-light);
    color: var(--info-dark);
}

.batch-status.completed {
    background: var(--success-light);
    color: var(--success-dark);
}

.batch-summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius);
}

.batch-summary-item {
    display: flex;
    flex-direction: column;
}

.batch-summary-item .label {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin-bottom: var(--space-1);
}

.batch-summary-item .value {
    font-weight: 600;
    color: var(--gray-800);
}

.batch-actions {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.batches-list {
    margin-top: var(--space-5);
}

/* Unit Conversion */
.batch-converted {
    font-size: var(--text-xs);
    color: var(--gray-600);
    margin-left: var(--space-2);
}

.batch-summary-info {
    background: var(--info-light);
    border: 1px solid var(--info);
    border-radius: var(--radius);
    padding: var(--space-3);
    margin-top: var(--space-3);
    font-size: var(--text-sm);
}

.batch-summary-info strong {
    color: var(--info-dark);
}

.conversion-note {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: var(--space-2);
    margin: var(--space-3) 0;
    font-size: var(--text-sm);
    color: var(--warning-dark);
}

.unit-conversion-badge {
    background: var(--info);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-xl);
    font-size: var(--text-xs);
    margin-left: var(--space-1);
}

/* Batch Details Modal */
.batch-details-modal h3 {
    margin-top: 0;
    color: var(--primary);
}

.batch-info, .batch-totals {
    margin-bottom: var(--space-5);
}

.batch-info p, .batch-totals p {
    margin: var(--space-1) 0;
}

.batch-totals {
    background-color: var(--gray-50);
    padding: var(--space-3);
    border-radius: var(--radius);
}

.batch-totals h4 {
    margin-top: 0;
    color: var(--gray-600);
}

.table-info {
    background-color: var(--primary-light);
}

.batch-totals div {
    margin-bottom: var(--space-1);
}

/* Work Orders Table */
.table-workorders {
    font-size: var(--text-sm);
    border-collapse: separate;
    border-spacing: 0;
}

.table-workorders th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--text-sm);
    letter-spacing: 0.5px;
    padding: 14px 10px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-workorders tbody tr {
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

.table-workorders tbody tr:hover {
    background-color: var(--gray-50);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table-workorders td {
    padding: 14px 10px;
    vertical-align: middle;
    border: none;
}

/* Work Order Cell Styles */
.wo-cell {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.wo-cell-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: var(--text-sm);
    line-height: 1.3;
}

.wo-cell-subtitle {
    font-size: var(--text-xs);
    color: var(--gray-600);
    line-height: 1.3;
}

.wo-cell-detail {
    font-size: var(--text-sm);
    color: var(--gray-700);
    line-height: 1.4;
}

/* Priority Badges */
.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: var(--space-1);
    width: fit-content;
}

.priority-normal {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary);
}

.priority-high {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

.priority-urgent {
    background: var(--danger-light);
    color: var(--danger-dark);
    border: 1px solid var(--danger);
    animation: pulse 2s infinite;
}

/* Date Display */
.date-display {
    font-size: var(--text-xs);
    color: var(--gray-600);
    white-space: nowrap;
}

.date-overdue {
    color: var(--danger);
    font-weight: 700;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.6; }
}

/* Action Buttons in Table */
.table-action-btn {
    padding: 5px 10px;
    font-size: var(--text-xs);
    margin: 0;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    white-space: nowrap;
}

.table-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.table-action-btn:active {
    transform: translateY(0);
}

.btn-manage {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-manage:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-update {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
}

.btn-update:hover {
    background: linear-gradient(135deg, var(--success-dark), var(--success));
}

.btn-view {
    background: linear-gradient(135deg, var(--info), var(--info-dark));
    color: white;
}

.btn-view:hover {
    background: linear-gradient(135deg, var(--info-dark), var(--info));
}

.btn-delete {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
}

.btn-delete:hover {
    background: linear-gradient(135deg, var(--danger-dark), var(--danger));
}

/* Recent Activity */
.recent-activity-header {
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}

.activity-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.activity-timeline {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--gray-50);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
}

.activity-item:hover {
  background: var(--gray-100);
  transform: translateX(2px);
}

.activity-item.bom_created {
  border-left-color: var(--success);
}

.activity-item.version_created {
  border-left-color: var(--info);
}

.activity-item.workorder_created {
  border-left-color: var(--warning);
}

.activity-item.workorder_completed {
  border-left-color: var(--gray-500);
}

.activity-icon {
  font-size: 16px;
  margin-right: var(--space-3);
  margin-top: 2px;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--gray-700);
  margin-bottom: 2px;
}

.activity-desc {
  font-size: var(--text-xs);
  color: var(--gray-600);
  margin-bottom: var(--space-1);
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--gray-500);
  font-style: italic;
}

/* Scrollbar styling for activity timeline */
.activity-timeline::-webkit-scrollbar {
  width: 4px;
}

.activity-timeline::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: var(--radius-xl);
}

.activity-timeline::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--radius-xl);
}

.activity-timeline::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* ===== 10. UTILITY CLASSES ===== */
.hidden { display: none !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.gap-1 { gap: var(--space-1) !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }
.gap-5 { gap: var(--space-5) !important; }
.gap-6 { gap: var(--space-6) !important; }

.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.w-100 { width: 100% !important; }
.rounded { border-radius: var(--radius) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow { box-shadow: var(--shadow) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* Spacing Utilities */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }
.mt-6 { margin-top: var(--space-6) !important; }

.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-5 { margin-bottom: var(--space-5) !important; }
.mb-6 { margin-bottom: var(--space-6) !important; }

.p-1 { padding: var(--space-1) !important; }
.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-5 { padding: var(--space-5) !important; }
.p-6 { padding: var(--space-6) !important; }

/* ===== 11. RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
    .table-workorders {
        font-size: var(--text-sm);
    }
    
    .wo-cell-title {
        font-size: var(--text-sm);
    }
    
    .table-action-btn {
        font-size: var(--text-xs);
        padding: 4px 8px;
    }
}

@media (max-width: 1200px) {
    .table-workorders th,
    .table-workorders td {
        padding: 10px 8px;
    }
    
    .wo-cell {
        gap: var(--space-1);
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 var(--space-4);
        flex-wrap: wrap;
    }
    
    .navbar img {
        height: 32px;
        margin-right: var(--space-3);
    }
    
    .nav-content {
        padding: var(--space-3) 0;
        flex-direction: column;
        text-align: center;
    }
    
    .nav-brand {
        font-size: var(--text-lg);
        margin-right: var(--space-3);
    }
    
    .nav-menu {
        order: 3;
        width: 100%;
        margin-top: var(--space-3);
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: var(--space-2);
    }
    
    .nav-user {
        gap: var(--space-3);
    }
    
    .user-name {
        display: none;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: var(--text-xs);
    }
    
    .dropdown-menu {
        right: -10px;
        min-width: 200px;
    }
    
    .dropdown-item {
        padding: var(--space-3) var(--space-4);
    }
    
    .page-header { 
        padding: var(--space-6) var(--space-4); 
    }
    
    .page-header h1 { 
        font-size: var(--text-2xl); 
    }
    
    .page-content { 
        padding: var(--space-4); 
    }
    
    .form-row { 
        grid-template-columns: 1fr; 
    }
    
    .dashboard-grid { 
        grid-template-columns: 1fr; 
        gap: var(--space-4); 
    }
    
    .dashboard-card { 
        padding: var(--space-6); 
        min-height: 120px; 
    }
    
    .dashboard-card h3 { 
        font-size: var(--text-3xl); 
    }
    
    .bom-item, .bom-item-header, .planning-row { 
        grid-template-columns: 1fr; 
        gap: var(--space-3); 
        text-align: center; 
    }
    
    .bom-item-header { 
        display: none; 
    }
    
    .modal-content { 
        width: 95%; 
        margin: 10% auto; 
    }
    
    .card-header { 
        flex-direction: column; 
        align-items: stretch; 
        gap: var(--space-3); 
    }
    
    .table { 
        font-size: var(--text-sm); 
    }
    
    .table th, .table td { 
        padding: var(--space-3); 
    }
    
    .notification { 
        right: var(--space-2); 
        left: var(--space-2); 
        max-width: none; 
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 var(--space-3);
    }
    
    .navbar img {
        height: 28px;
        margin-right: var(--space-2);
    }
    
    .nav-brand {
        font-size: var(--text-base);
    }
    
    .nav-menu {
        gap: var(--space-1);
    }
    
    .nav-user {
        gap: var(--space-2);
    }
    
    .dropdown-menu {
        right: -15px;
        min-width: 180px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    body { 
        font-size: var(--text-base); 
    }
    
    .app-container { 
        padding: var(--space-2); 
    }
    
    .page-header h1 { 
        font-size: var(--text-xl); 
    }
    
    .dashboard-card h3 { 
        font-size: var(--text-2xl); 
    }
    
    .btn, .nav-item { 
        padding: var(--space-3) var(--space-4); 
        font-size: var(--text-sm); 
    }
    
    .modal-body, .modal-header { 
        padding: var(--space-4); 
    }
}

/* Print styles */
@media print {
    .navbar img, .nav-user, .dropdown, .btn-logout {
        display: none !important;
    }
    
    .navbar, .btn:not(.btn-print), .modal, .notification, .loading-overlay { 
        display: none !important; 
    }
    
    .main-content { 
        margin: 0; 
        box-shadow: none; 
        border: none; 
        border-radius: 0; 
    }
    
    .page-header { 
        background: var(--white) !important; 
        color: var(--black) !important; 
        border-bottom: 2px solid var(--gray-300); 
    }
    
    .card { 
        box-shadow: none; 
        border: 1px solid var(--gray-300); 
        break-inside: avoid; 
    }
    
    .table { 
        break-inside: avoid; 
    }
    
    .table th { 
        background: var(--gray-200) !important; 
        color: var(--black) !important; 
    }
    
    body { 
        background: var(--white) !important; 
        color: var(--black) !important; 
    }
    
    a { 
        color: var(--black) !important; 
        text-decoration: underline; 
    }
}

/* ===== 12. ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-contrast: high) {
    :root { 
        --primary: #0000ff; 
        --success: #008000; 
        --danger: #ff0000; 
        --warning: #ffa500; 
    }
    
    .shadow, .shadow-sm, .shadow-md, .shadow-lg, .shadow-xl { 
        box-shadow: 0 0 0 1px var(--black) !important; 
    }
}

/* ===== 13. BATCH DETAILS MODAL ===== */
.batch-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--gray-200);
}

.batch-details-header h3 {
    margin: 0;
    color: var(--gray-800);
    font-size: var(--text-xl);
}

.batch-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
}

.detail-card {
    background: var(--gray-50);
    padding: var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.detail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin-bottom: var(--space-2);
    font-weight: 600;
}

.detail-value {
    font-size: var(--text-base);
    color: var(--gray-800);
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .batch-details-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    
    .batch-details-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
    
    .detail-card {
        padding: var(--space-3);
    }
}



/* ===== PRODUCTION PAGE SPECIFIC STYLES ===== */

/* Production Page Container */
#productionPage {
    background: var(--gray-50);
    min-height: calc(100vh - 72px);
    padding: var(--space-6);
}

#productionPage .main-content {
    background: var(--white);
    max-width: 1400px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

/* Page Header for Production */
#productionPage .page-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    position: relative;
    overflow: hidden;
}

#productionPage .page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="%23ffffff" opacity="0.1"><polygon points="1000,100 1000,0 0,100"></polygon></svg>');
    background-size: cover;
}

#productionPage .page-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    position: relative;
}

#productionPage .page-header p {
    font-size: var(--text-base);
    opacity: 0.9;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

/* Page Content */
#productionPage .page-content {
    padding: var(--space-6);
}

/* Cards in Production Page */
#productionPage .card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition-slow);
}

#productionPage .card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

#productionPage .card-header {
    background: var(--gray-50);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

#productionPage .card-header h3 {
    margin: 0;
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

#productionPage .card-body {
    padding: var(--space-6);
}

/* Form Rows and Groups */
#productionPage .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-5);
}

#productionPage .form-group {
    margin-bottom: var(--space-5);
}

#productionPage .form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--gray-700);
    font-size: var(--text-sm);
}

#productionPage .form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    font-family: inherit;
    transition: var(--transition);
}

#productionPage .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#productionPage .form-control:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

#productionPage .form-control:read-only {
    background: var(--gray-50);
    color: var(--gray-600);
}

#productionPage textarea.form-control {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

#productionPage select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em;
    padding-right: 2.5rem;
}

/* Input Groups for UOM */
#productionPage .input-group {
    display: flex;
    align-items: stretch;
}

#productionPage .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    flex: 1;
}

#productionPage .input-group .form-select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    width: auto;
    min-width: 120px;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    background: var(--white);
    font-size: var(--text-base);
    transition: var(--transition);
}

#productionPage .input-group .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons in Production Page */
#productionPage .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    transition: var(--transition-slow);
}

#productionPage .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#productionPage .btn:hover::before { left: 100%; }
#productionPage .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
#productionPage .btn:active { transform: translateY(0); }
#productionPage .btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
#productionPage .btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Button Variants */
#productionPage .btn-primary { background: var(--primary); color: var(--white); }
#productionPage .btn-primary:hover { background: var(--primary-dark); }

#productionPage .btn-success { background: var(--success); color: var(--white); }
#productionPage .btn-success:hover { background: var(--success-dark); }

#productionPage .btn-secondary { background: var(--gray-500); color: var(--white); }
#productionPage .btn-secondary:hover { background: var(--gray-600); }

/* Form Actions */
#productionPage .form-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-start;
    margin-top: var(--space-5);
    flex-wrap: wrap;
}

/* Batch Information Container */
#batchInfoContainer {
    /* Styles for the container that holds batch info */
}

/* Currently Running Batch Card */
#currentRunningBatchCard {
    border-left: 4px solid var(--info);
    background: linear-gradient(135deg, var(--white), var(--gray-50));
}

#currentRunningBatchCard .card-header {
    background: var(--info-light);
    border-bottom: 1px solid var(--info);
}

#currentRunningBatchCard .card-header h4 {
    color: var(--info-dark);
    font-weight: 600;
}

/* Next Batch Ready Card */
#productionPage .card h4 {
    margin: 0;
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--text-lg);
}

/* Batch Progress Details Table */
#productionPage .table-container {
    overflow-x: auto;
    margin: var(--space-6) 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

#productionPage .table-batches {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    background: var(--white);
}

#productionPage .table-batches th {
    background: var(--gray-50);
    color: var(--gray-700);
    padding: var(--space-4) var(--space-3);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

#productionPage .table-batches td {
    padding: var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-sm);
    vertical-align: middle;
    transition: var(--transition);
}

#productionPage .table-batches tbody tr:hover {
    background: var(--gray-50);
}

#productionPage .table-batches tbody tr:last-child td { border-bottom: none; }

/* Work Order Cell Styles */
#productionPage .wo-cell {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

#productionPage .wo-cell-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: var(--text-sm);
    line-height: 1.3;
}

#productionPage .wo-cell-subtitle {
    font-size: var(--text-xs);
    color: var(--gray-600);
    line-height: 1.3;
}

#productionPage .wo-cell-detail {
    font-size: var(--text-sm);
    color: var(--gray-700);
    line-height: 1.4;
}

/* Status Badges */
#productionPage .status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-xl);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#productionPage .status-pending {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

#productionPage .status-progress {
    background: var(--info-light);
    color: var(--info-dark);
    border: 1px solid var(--info);
}

#productionPage .status-completed {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid var(--success);
}

/* Batch Progress Bar */
#productionPage .batch-progress {
    width: 100%;
    height: 24px;
    background-color: var(--gray-200);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

#productionPage .batch-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--success-dark) 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-xs);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    position: relative;
}

#productionPage .batch-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Table Action Buttons */
#productionPage .table-action-btn {
    padding: 5px 10px;
    font-size: var(--text-xs);
    margin: 0;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    white-space: nowrap;
}

#productionPage .table-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#productionPage .table-action-btn:active {
    transform: translateY(0);
}

#productionPage .btn-manage {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

#productionPage .btn-manage:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

#productionPage .btn-view {
    background: linear-gradient(135deg, var(--info), var(--info-dark));
    color: white;
}

#productionPage .btn-view:hover {
    background: linear-gradient(135deg, var(--info-dark), var(--info));
}

/* Alert for Closed Work Orders */
#productionPage .alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

#productionPage .alert-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning-dark); }

/* Loading States */
#productionPage .btn.loading { pointer-events: none; color: transparent; }
#productionPage .btn.loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive Design for Production Page */
@media (max-width: 1200px) {
    #productionPage .table-batches {
        font-size: var(--text-sm);
    }
    
    #productionPage .wo-cell-title {
        font-size: var(--text-sm);
    }
    
    #productionPage .table-action-btn {
        font-size: var(--text-xs);
        padding: 4px 8px;
    }
}

@media (max-width: 768px) {
    #productionPage {
        padding: var(--space-4);
    }
    
    #productionPage .page-header { 
        padding: var(--space-6) var(--space-4); 
    }
    
    #productionPage .page-header h1 { 
        font-size: var(--text-2xl); 
    }
    
    #productionPage .page-content { 
        padding: var(--space-4); 
    }
    
    #productionPage .form-row { 
        grid-template-columns: 1fr; 
    }
    
    #productionPage .card-header { 
        flex-direction: column; 
        align-items: stretch; 
        gap: var(--space-3); 
    }
    
    #productionPage .table-batches { 
        font-size: var(--text-sm); 
    }
    
    #productionPage .table-batches th, #productionPage .table-batches td { 
        padding: var(--space-3); 
    }
    
    #productionPage .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    #productionPage .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #productionPage .page-header h1 { 
        font-size: var(--text-xl); 
    }
    
    #productionPage .card-body {
        padding: var(--space-4);
    }
    
    #productionPage .form-group {
        margin-bottom: var(--space-4);
    }
}

/* ===== REPORTS PAGE SPECIFIC STYLES ===== */

/* Reports Page Container */
#reportsPage {
    background: var(--gray-50);
    min-height: calc(100vh - 72px);
    padding: var(--space-6);
}

#reportsPage .main-content {
    background: var(--white);
    max-width: 1400px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

/* Page Header for Reports */
#reportsPage .page-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    position: relative;
    overflow: hidden;
}

#reportsPage .page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="%23ffffff" opacity="0.1"><polygon points="1000,100 1000,0 0,100"></polygon></svg>');
    background-size: cover;
}

#reportsPage .page-header h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    position: relative;
    color: var(--white);
}

#reportsPage .page-header p {
    font-size: var(--text-base);
    opacity: 0.9;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    color: #000000;
}

/* Page Content */
#reportsPage .page-content {
    padding: var(--space-6);
}

/* Cards in Reports Page */
#reportsPage .card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition-slow);
}

#reportsPage .card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

#reportsPage .card-header {
    background: var(--gray-50);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

#reportsPage .card-header h3 {
    margin: 0;
    color: var(--gray-800);
    font-weight: 600;
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

#reportsPage .card-body {
    padding: var(--space-6);
}

/* Form Rows and Groups */
#reportsPage .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-5);
}

#reportsPage .form-group {
    margin-bottom: var(--space-5);
}

#reportsPage .form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--gray-700);
    font-size: var(--text-sm);
}

#reportsPage .form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    font-family: inherit;
    transition: var(--transition);
}

#reportsPage .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#reportsPage .form-control:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

#reportsPage .form-control:read-only {
    background: var(--gray-50);
    color: var(--gray-600);
}

#reportsPage textarea.form-control {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

#reportsPage select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em;
    padding-right: 2.5rem;
}

/* Tables */
#reportsPage .table-container {
    overflow-x: auto;
    margin: var(--space-6) 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

#reportsPage .table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    background: var(--white);
}

#reportsPage .table th {
    background: var(--gray-50);
    color: var(--gray-700);
    padding: var(--space-4) var(--space-3);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

#reportsPage .table td {
    padding: var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-sm);
    vertical-align: middle;
    transition: var(--transition);
}

#reportsPage .table tbody tr:hover {
    background: var(--gray-50);
}

#reportsPage .table tbody tr:last-child td { 
    border-bottom: none; 
}

#reportsPage .table-hover tbody tr:hover td { 
    background: var(--primary-light); 
}

#reportsPage .table-bordered,
#reportsPage .table-bordered th,
#reportsPage .table-bordered td { 
    border: 1px solid var(--gray-200); 
}

/* Dashboard Grid */
#reportsPage .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

#reportsPage .dashboard-card {
    color: var(--white);
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition-slow);
}

#reportsPage .dashboard-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
}

#reportsPage .dashboard-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

#reportsPage .dashboard-card:nth-child(1) { 
    background: linear-gradient(135deg, var(--success), var(--success-dark)); 
}

#reportsPage .dashboard-card:nth-child(2) { 
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); 
}

#reportsPage .dashboard-card:nth-child(3) { 
    background: linear-gradient(135deg, var(--warning), var(--warning-dark)); 
}

#reportsPage .dashboard-card:nth-child(4) { 
    background: linear-gradient(135deg, var(--danger), var(--danger-dark)); 
}

#reportsPage .dashboard-card:nth-child(5) { 
    background: linear-gradient(135deg, var(--info), var(--info-dark)); 
}

#reportsPage .dashboard-card:nth-child(6) { 
    background: linear-gradient(135deg, var(--gray-600), var(--gray-700)); 
}

#reportsPage .dashboard-card:nth-child(7) { 
    background: linear-gradient(135deg, var(--gray-500), var(--gray-600)); 
}

#reportsPage .dashboard-card h3 {
    font-size: var(--text-4xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    position: relative;
}

#reportsPage .dashboard-card p {
    font-size: var(--text-base);
    opacity: 0.9;
    font-weight: 500;
    position: relative;
}

/* Pagination */
#reportsPage .pagination {
    display: flex;
    justify-content: center;
    margin-top: var(--space-6);
}

#reportsPage .pagination .page-link {
    color: var(--primary);
    padding: var(--space-2) var(--space-3);
    margin: 0 var(--space-1);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    transition: var(--transition);
}

#reportsPage .pagination .page-link:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

#reportsPage .pagination .page-item.active .page-link {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

#reportsPage .pagination .page-item.disabled .page-link {
    color: var(--gray-500);
    background: var(--gray-100);
    border-color: var(--gray-300);
}

/* Buttons */
#reportsPage .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    transition: var(--transition-slow);
}

#reportsPage .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#reportsPage .btn:hover::before { left: 100%; }
#reportsPage .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
#reportsPage .btn:active { transform: translateY(0); }
#reportsPage .btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
#reportsPage .btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Button Variants */
#reportsPage .btn-primary { 
    background: var(--primary); 
    color: var(--white); 
}

#reportsPage .btn-primary:hover { 
    background: var(--primary-dark); 
}

#reportsPage .btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

/* Responsive Design for Reports Page */
@media (max-width: 1200px) {
    #reportsPage .table {
        font-size: var(--text-sm);
    }
    
    #reportsPage .table th,
    #reportsPage .table td {
        padding: var(--space-3) var(--space-2);
    }
}

@media (max-width: 768px) {
    #reportsPage {
        padding: var(--space-4);
    }
    
    #reportsPage .page-header { 
        padding: var(--space-6) var(--space-4); 
    }
    
    #reportsPage .page-header h1 { 
        font-size: var(--text-2xl); 
    }
    
    #reportsPage .page-content { 
        padding: var(--space-4); 
    }
    
    #reportsPage .form-row { 
        grid-template-columns: 1fr; 
    }
    
    #reportsPage .dashboard-grid { 
        grid-template-columns: 1fr; 
        gap: var(--space-4); 
    }
    
    #reportsPage .dashboard-card { 
        padding: var(--space-6); 
        min-height: 120px; 
    }
    
    #reportsPage .dashboard-card h3 { 
        font-size: var(--text-3xl); 
    }
    
    #reportsPage .card-header { 
        flex-direction: column; 
        align-items: stretch; 
        gap: var(--space-3); 
    }
    
    #reportsPage .table { 
        font-size: var(--text-sm); 
    }
    
    #reportsPage .table th, #reportsPage .table td { 
        padding: var(--space-3); 
    }
}

@media (max-width: 480px) {
    #reportsPage .page-header h1 { 
        font-size: var(--text-xl); 
    }
    
    #reportsPage .dashboard-card h3 { 
        font-size: var(--text-2xl); 
    }
    
    #reportsPage .card-body {
        padding: var(--space-4);
    }
    
    #reportsPage .form-group {
        margin-bottom: var(--space-4);
    }
}


/* In your CSS file */
.activity-item.production_started {
    border-left-color: #28a745; /* Green for start */
}
.activity-item.inventory_adjusted {
    border-left-color: #ffc107; /* Yellow for adjustment */
}
.activity-item.material_created {
    border-left-color: #17a2b8; /* Cyan for new items */
}
.activity-item.batch_assigned {
    border-left-color: #6f42c1; /* Purple for batches */
}

/* Enhanced Action Buttons and Filters - Add to your CSS file */
.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
    padding: var(--space-4) 0;
}

/* Search Box Enhancement */
.search-box {
    position: relative;
    max-width: 300px;
    margin: 0 15px;
}

.search-box input {
    width: 100%;
    padding-left: 40px; /* Space for icon */
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    transition: var(--transition);
    color: var(--gray-700);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box input::placeholder {
    color: var(--gray-500);
    opacity: 1;
}

/* Search Icon */
.search-box::before {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 16px;
}

/* Item Group Filter Dropdown */
.filter-group {
    position: relative;
    margin: 0 15px;
    max-width: 200px;
}

.filter-group select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    appearance: none;
    transition: var(--transition);
    color: var(--gray-700);
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-group select option {
    background: var(--white);
    color: var(--gray-800);
}

/* Dropdown Arrow Styling */
.filter-group::after {
    content: "▼";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--primary);
    font-size: 12px;
}

.filter-group:hover select {
    border-color: var(--primary-dark);
}

/* Excel Button */
#downloadProductsExcel {
    border: 2px solid var(--success);
    color: var(--success);
    font-weight: 600;
    padding: var(--space-3) var(--space-5);
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
}

#downloadProductsExcel:hover {
    background: var(--success);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#downloadProductsExcel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#downloadProductsExcel:hover::before {
    left: 100%;
}

/* PDF Button */
#downloadProductsPDF {
    border: 2px solid var(--danger);
    color: var(--danger);
    font-weight: 600;
    padding: var(--space-3) var(--space-5);
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
}

#downloadProductsPDF:hover {
    background: var(--danger);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#downloadProductsPDF::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

#downloadProductsPDF:hover::before {
    left: 100%;
}

/* Button Icons */
#downloadProductsExcel::before {
    content: "📊";
    font-size: var(--text-lg);
    margin-right: var(--space-2);
    position: relative;
    z-index: 1;
}

#downloadProductsPDF::before {
    content: "📄";
    font-size: var(--text-lg);
    margin-right: var(--space-2);
    position: relative;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-actions {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .search-box,
    .filter-group {
        max-width: 100%;
        margin: 0;
    }
    
    .action-buttons {
        display: flex;
        justify-content: center;
        gap: var(--space-3);
        margin-top: var(--space-3);
    }
}

/* Table Header Styling */
.table th {
    background: var(--gray-50);
    color: var(--gray-700);
    padding: var(--space-4) var(--space-3);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

/* Table Row Styling */
.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-xl);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid var(--success);
}

/* Action Buttons in Table */
.table-action-btn {
    padding: 6px 12px;
    font-size: var(--text-xs);
    margin: 0;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    white-space: nowrap;
}

.table-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.table-action-btn:active {
    transform: translateY(0);
}

.btn-edit {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-edit:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-delete {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
}

.btn-delete:hover {
    background: linear-gradient(135deg, var(--danger-dark), var(--danger));
}



/* ===== PRODUCTS PAGE: SPECIFIC COMPONENT STYLES ===== */

/* --- 1. ITEM GROUP FILTER DROPDOWN --- */
#productsPage .filter-group {
    position: relative;
    min-width: 180px; /* Adjust width as needed */
}

#productsPage .filter-group select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    /* Hide the default browser arrow */
    appearance: none;
    transition: var(--transition);
}

#productsPage .filter-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); /* Uses --primary color */
}

/* Custom dropdown arrow */
#productsPage .filter-group::after {
    content: "▼";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none; /* Allows clicking through the arrow to the select */
    color: var(--gray-500);
    font-size: 12px;
}

#productsPage .filter-group:hover select {
    border-color: var(--primary);
}


/* --- 2. SEARCH BOX --- */
#productsPage .search-box {
    position: relative;
    flex-grow: 1; /* Allows it to take up available space in flexbox */
    max-width: 400px; /* Adjust max-width as needed */
}

#productsPage .search-box input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) 40px; /* Left padding for icon */
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    color: var(--gray-700);
    transition: var(--transition);
}

#productsPage .search-box input::placeholder {
    color: var(--gray-500);
}

#productsPage .search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); /* Uses --primary color */
}

/* Search icon */
#productsPage .search-box::before {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 16px;
}

/* ===== PRODUCTS PAGE: SPECIFIC COMPONENT STYLES ===== */

/* --- 1. ITEM GROUP FILTER DROPDOWN --- */
#productsPage .filter-group {
    position: relative;
    min-width: 180px;
}

#productsPage .filter-group select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    appearance: none;
    transition: var(--transition);
}



/* Custom dropdown arrow */
#productsPage .filter-group::after {
    content: "▼";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--gray-500);
    font-size: 12px;
}

/* --- 2. SEARCH BOX --- */
#productsPage .search-box {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

#productsPage .search-box input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) 40px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--text-base);
    background: var(--white);
    color: var(--gray-700);
    transition: var(--transition);
}

#productsPage .search-box input::placeholder {
    color: var(--gray-500);
}

#productsPage .search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Search icon */
#productsPage .search-box::before {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 16px;
}

/* --- 3. DOWNLOAD BUTTONS (PDF/EXCEL) --- */
#productsPage .btn-outline {
    font-weight: 600;
    padding: var(--space-3) var(--space-5);
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    border: 2px solid transparent; /* Solid but hidden border */
    color: var(--white); /* All buttons use white text by default */
}

/* Hover animation */
#productsPage .btn-outline:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* --- EXCEL BUTTON (SOLID GREEN FROM START) --- */
#productsPage #downloadProductsExcel {
    background-color: var(--success); /* Solid green */
    border-color: var(--success);
    color: var(--white);
}

#productsPage #downloadProductsExcel:hover {
    background-color: var(--success-dark, #0d8f4b);
}

/* --- PDF BUTTON (SOLID BLUE FROM START) --- */
#productsPage #downloadProductsPDF {
    background-color: var(--primary); /* Solid blue */
    border-color: var(--primary);
    color: var(--white);
}

#productsPage #downloadProductsPDF:hover {
    background-color: var(--primary-dark, #004c8c);
}

/* Optional shine effect */
#productsPage .btn-outline::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.25),
        transparent
    );
    transition: left 0.5s ease;
}

#productsPage .btn-outline:hover::before {
    left: 100%;
}


/* DOWNLOAD ALL WORK ORDERS BUTTON */
#workordersPage .action-buttons .btn-outline {
    background-color: var(--success);   /* Solid green */
    border: 2px solid var(--success);
    color: var(--white);
    font-weight: 600;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    transition: var(--transition);
}

#workordersPage .action-buttons .btn-outline:hover {
    background-color: var(--success-dark, #0d8f4b); /* Darker green on hover */
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}


/* ===== NEW: ENHANCED SCROLLBAR STYLING ===== */
/* For Chrome, Safari, and Edge */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: var(--radius);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius);
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* For Firefox */
.table-container {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) var(--gray-100);
}

/* ===== PAGE-SPECIFIC ADJUSTMENTS (Optional but Recommended) ===== */
/* This allows you to set different heights for different pages if needed */
#workordersPage .table-container {
    max-height: 75vh; /* Example: A bit taller on the work orders page */
}

#reportsPage .table-container {
    max-height: 70vh; /* Example: Standard height */
}