/**
 * Ryboa Haima Portal - Global Styles
 * Supports Light and Dark Themes
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme Colors */
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-tertiary: #95a5a6;
    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    
    /* Brand Colors */
    --brand-primary: #3498db;
    --brand-secondary: #2ecc71;
    --brand-danger: #e74c3c;
    --brand-warning: #f39c12;
    --brand-info: #17a2b8;
    --brand-success: #28a745;
    
    /* Primary Theme Colors */
    --primary: #667eea;
    --primary-dark: #764ba2;
    --primary-light: #8b9aef;
    
    /* Sidebar */
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --sidebar-active: #3498db;
    
    /* Header */
    --header-bg: #ffffff;
    --header-text: #2c3e50;
    
    /* Components */
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-focus: #3498db;
    --button-primary: #3498db;
    --button-primary-hover: #2980b9;
    --button-secondary: #6c757d;
    --button-secondary-hover: #5a6268;
    --button-success: #28a745;
    --button-success-hover: #218838;
    --button-danger: #dc3545;
    --button-danger-hover: #c82333;
    
    /* Lightbox */
    --lightbox-overlay: rgba(0, 0, 0, 0.7);
    --lightbox-bg: #ffffff;
    
    /* Spacing */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark Theme */
body.dark-theme {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #383838;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --border-color: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.5);
    
    /* Primary Theme Colors - Same in dark mode */
    --primary: #667eea;
    --primary-dark: #764ba2;
    --primary-light: #8b9aef;
    
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #e0e0e0;
    --sidebar-hover: #2d2d2d;
    --sidebar-active: #3498db;
    
    --header-bg: #2d2d2d;
    --header-text: #e0e0e0;
    
    --input-bg: #383838;
    --input-border: #505050;
    --lightbox-bg: #2d2d2d;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ============================================
   LAYOUT
   ============================================ */
.main-container {
    display: flex;
    min-height: 100vh;
}

.content-wrapper {
    flex: 0 1 auto;
    width: calc(100% - 260px);
    max-width: calc(100% - 260px);
    min-width: 0;
    margin-left: 260px;
    transition: margin-left var(--transition-normal);
}

.content-wrapper.sidebar-collapsed {
    width: calc(100% - 70px);
    max-width: calc(100% - 70px);
    margin-left: 70px;
}

.content {
    padding: var(--spacing-lg);
}

/* ============================================
   PAGE HEADERS
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.page-header > div:first-child {
    flex: 1;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.page-title i {
    color: var(--brand-primary);
    font-size: 26px;
}

.page-description {
    color: var(--text-secondary);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.page-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-shrink: 0;
}

/* Responsive page header */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .page-actions {
        width: 100%;
    }
    
    .page-actions .btn {
        flex: 1;
    }
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: 0 2px 4px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    transition: background-color var(--transition-normal);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-toggle {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 20px;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.header-toggle:hover {
    background-color: var(--bg-tertiary);
}

.header-title {
    font-size: 20px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-icon {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 18px;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    position: relative;
    transition: background-color var(--transition-fast);
}

.header-icon:hover {
    background-color: var(--bg-tertiary);
}

.header-icon .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--brand-danger);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.header-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

.header-user:hover {
    background-color: var(--bg-tertiary);
}

.header-user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.header-user-info {
    display: flex;
    flex-direction: column;
}

.header-user-name {
    font-weight: 500;
    font-size: 13px;
}

.header-user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Theme Toggle Switch */
.theme-toggle {
    position: relative;
    width: 50px;
    height: 25px;
    background-color: var(--input-border);
    border-radius: 25px;
    cursor: pointer;
    transition: background-color var(--transition-normal);
}

.theme-toggle::before {
    content: '☀️';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background-color: white;
    border-radius: 50%;
    transition: transform var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

body.dark-theme .theme-toggle {
    background-color: var(--brand-primary);
}

body.dark-theme .theme-toggle::before {
    content: '🌙';
    transform: translateX(25px);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-normal), background-color var(--transition-normal);
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    opacity: 1;
    transition: opacity var(--transition-fast);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
}

.sidebar-menu {
    list-style: none;
    padding: var(--spacing-md) 0;
    overflow: visible;
    overflow-x: hidden;
    position: relative;
}

.sidebar-menu-item {
    margin-bottom: 4px;
    position: static;
    overflow: visible;
}

.sidebar-menu-item.has-submenu {
    position: relative;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 7px 18px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.2) 0%, transparent 100%);
    transition: width 0.3s ease;
}

.sidebar-menu-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding-left: 24px;
    text-decoration: none;
}

.sidebar-menu-link:hover::before {
    width: 100%;
}

.sidebar-menu-link.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-left: 3px solid #667eea;
    color: #fff;
    font-weight: 500;
}

.sidebar-menu-icon {
    width: 20px;
    margin-right: 14px;
    text-align: center;
    flex-shrink: 0;
    font-size: 16px;
}

.sidebar-menu-text {
    flex: 1;
    opacity: 1;
    transition: opacity var(--transition-fast);
    font-size: 14px;
}

.sidebar.collapsed .sidebar-menu-text {
    opacity: 0;
    width: 0;
}

/* Submenu styles - Popup on Hover */
.sidebar-menu-item.has-submenu {
    position: relative;
}

.sidebar-menu-item.has-submenu::after {
    display: none;
}

.sidebar-menu-item.has-submenu .sidebar-menu-link {
    position: relative;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0.7;
}

.sidebar-menu-item.has-submenu:hover .submenu-arrow {
    opacity: 1;
    transform: translateX(3px);
}

.sidebar-menu-item.has-submenu .sidebar-menu-link.active .submenu-arrow {
    opacity: 1;
}

.sidebar-submenu {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
    position: fixed;
    min-width: 250px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    border-left: 3px solid #667eea;
    z-index: 1100;
    max-height: 80vh;
    overflow-y: auto;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-submenu::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    width: 20px;
    height: 100%;
    background: transparent;
}

.sidebar-submenu.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar-submenu li {
    margin: 0;
}

.sidebar-submenu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar-submenu a::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-submenu a:hover {
    background-color: rgba(102, 126, 234, 0.2);
    color: #fff;
    text-decoration: none;
    border-left: 3px solid rgba(102, 126, 234, 0.5);
}

.sidebar-submenu a:hover::before {
    background: #667eea;
    transform: scale(1.3);
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
}

.sidebar-submenu a.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-left: 3px solid #667eea;
    color: #fff;
    font-weight: 500;
}

.sidebar-submenu a.active::before {
    background: #667eea;
    transform: scale(1.5);
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.8);
}

.sidebar-submenu a i {
    width: 16px;
    font-size: 13px;
    opacity: 0.8;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-submenu {
    border-radius: 8px;
}

.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar-submenu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-submenu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 8px 8px 0;
}

.sidebar-submenu::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.6);
    border-radius: 3px;
}

.sidebar-submenu::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    transition: box-shadow var(--transition-fast), background-color var(--transition-normal);
}

.card:hover {
    box-shadow: 0 4px 8px var(--shadow-hover);
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: var(--spacing-sm) 0;
}

.card-footer {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label,
label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.form-input,
.form-select,
.form-textarea,
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover,
.form-control:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="datetime-local"]:hover,
input[type="search"]:hover,
select:hover,
textarea:hover {
    border-color: var(--brand-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
    background-color: var(--bg-primary);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.form-control:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
}

.form-input::placeholder,
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.form-textarea,
textarea {
    resize: vertical;
    min-height: 100px;
}

.form-checkbox,
.form-radio,
input[type="checkbox"],
input[type="radio"] {
    margin-right: var(--spacing-xs);
    width: auto;
}

.form-error {
    color: var(--brand-danger);
    font-size: 12px;
    margin-top: var(--spacing-xs);
    display: block;
}

.form-text {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Select dropdown styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    min-height: 38px;
    line-height: 1.5;
}

/* Bootstrap form-control select overrides */
.form-control.select,
select.form-control {
    height: auto;
    min-height: 38px;
    padding: 8px 36px 8px 12px;
    color: #495057;
    background-color: #fff;
    line-height: 1.5;
}

/* Modal select specific fixes */
.modal select.form-control,
.modal .form-control.select {
    display: block;
    width: 100%;
    font-size: 14px;
    font-weight: 400;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.modal select.form-control:focus,
.modal .form-control.select:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Ensure select option text is visible */
select option {
    color: #212529;
    background-color: #fff;
    padding: 8px 12px;
}

/* Input sizing variations */
.form-control-sm,
.form-input-sm {
    padding: 6px 10px;
    font-size: 13px;
}

.form-control-lg,
.form-input-lg {
    padding: 14px 18px;
    font-size: 16px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--button-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--button-primary-hover);
}

.btn-secondary {
    background-color: var(--button-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--button-secondary-hover);
}

.btn-success {
    background-color: var(--button-success);
    color: white;
}

.btn-success:hover {
    background-color: var(--button-success-hover);
}

.btn-danger {
    background-color: var(--button-danger);
    color: white;
}

.btn-danger:hover {
    background-color: var(--button-danger-hover);
}

.btn-warning {
    background-color: var(--brand-warning);
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-info {
    background-color: #6c757d;
    color: white;
}

.btn-info:hover {
    background-color: #5a6268;
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--button-primary);
    border: 2px solid var(--button-primary);
}

.btn-outline-primary:hover {
    background-color: var(--button-primary);
    color: white;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: var(--spacing-sm);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.table tr:hover {
    background-color: var(--bg-tertiary);
}

.table-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--lightbox-overlay);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn var(--transition-normal);
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox {
    background-color: var(--lightbox-bg);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp var(--transition-normal);
}

.lightbox-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lightbox-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.lightbox-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-xs);
    line-height: 1;
    transition: color var(--transition-fast);
}

.lightbox-close:hover {
    color: var(--text-primary);
}

.lightbox-body {
    padding: var(--spacing-lg);
}

.lightbox-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error,
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-primary {
    background-color: var(--brand-primary);
    color: white;
}

.badge-success {
    background-color: var(--brand-success);
    color: white;
}

.badge-danger {
    background-color: var(--brand-danger);
    color: white;
}

.badge-warning {
    background-color: var(--brand-warning);
    color: white;
}

.badge-info {
    background-color: var(--brand-info);
    color: white;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   STATISTICS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-hover);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.stat-details {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   BADGE STYLES
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.badge-primary {
    background-color: var(--brand-primary);
    color: white;
}

.badge-success {
    background-color: var(--brand-success);
    color: white;
}

.badge-danger {
    background-color: var(--brand-danger);
    color: white;
}

.badge-warning {
    background-color: var(--brand-warning);
    color: white;
}

.badge-info {
    background-color: var(--brand-info);
    color: white;
}

.badge-secondary {
    background-color: var(--button-secondary);
    color: white;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.action-buttons {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-md);
}

.empty-state h3 {
    margin: var(--spacing-md) 0;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   COMPANY/USER CELL STYLES
   ============================================ */
.company-cell,
.user-cell {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.company-info,
.user-info {
    flex: 1;
}

.company-name,
.user-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.company-name-ar {
    font-size: 13px;
    color: var(--text-secondary);
    direction: rtl;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-fullname {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.user-roles .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================
   STATS GRID (User Management)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: 0 2px 4px var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   FILTER FORMS & ACTION BUTTONS
   ============================================ */
.filter-form .form-row {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-end;
}

.filter-form .form-group {
    flex: 1;
    min-width: 150px;
}

.filter-form .btn {
    height: 42px;
    line-height: 20px;
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ============================================
   DROPDOWN MENUS & BUTTONS
   ============================================ */
.btn-group {
    position: relative;
    display: inline-block;
}

.btn-group .dropdown-toggle {
    cursor: pointer;
    position: relative;
    padding: 10px 40px 10px 20px;
    height: 42px;
    line-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-group .dropdown-toggle:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-group .dropdown-toggle:active {
    transform: translateY(0);
}

.dropdown-toggle::after {
    content: '\f0d7';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    z-index: 9999;
    min-width: 240px;
    max-width: 280px;
    padding: 8px 0;
    margin: 0;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.dropdown-menu.show,
.dropdown-menu.active {
    display: block;
}

.dropdown-menu-right {
    right: 0;
    left: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    clear: both;
    font-weight: 400;
    font-size: 14px;
    color: #333;
    text-align: left;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #007bff;
    background-color: #f8f9fa;
    text-decoration: none;
}

.dropdown-item i {
    width: 20px;
    margin-right: 8px;
    text-align: center;
}

.dropdown-divider {
    height: 0;
    margin: 8px 0;
    overflow: hidden;
    border-top: 1px solid #e9ecef;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
    background-color: transparent;
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

/* ============================================
   GRID LAYOUT SYSTEM
   ============================================ */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
    gap: var(--spacing-lg);
}

.col-md-4,
.col-md-8 {
    padding-left: 10px;
    padding-right: 10px;
}

.col-md-4 {
    flex: 0 0 calc(33.333% - var(--spacing-lg));
    max-width: calc(33.333% - var(--spacing-lg));
}

.col-md-8 {
    flex: 0 0 calc(66.667% - var(--spacing-lg));
    max-width: calc(66.667% - var(--spacing-lg));
}

/* ============================================
   TEXT UTILITIES
   ============================================ */
.text-muted {
    color: var(--text-secondary) !important;
}

.text-danger {
    color: var(--brand-danger) !important;
}

.text-success {
    color: var(--brand-success) !important;
}

.text-warning {
    color: var(--brand-warning) !important;
}

.text-primary {
    color: var(--brand-primary) !important;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .col-md-4,
    .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .content-wrapper {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
    }
    
    .header-user-info {
        display: none;
    }
    
    .lightbox {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .content {
        padding: var(--spacing-sm);
    }
    
    .card {
        padding: var(--spacing-md);
    }
    
    .table th,
    .table td {
        padding: var(--spacing-sm);
        font-size: 12px;
    }
}

/* ============================================
   MODAL STYLES
   ============================================ */
/* Custom modals (backup/restore) - specific selectors to avoid Bootstrap conflicts */
#backupModal,
#restoreModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

#backupModal .modal-content,
#restoreModal .modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

#backupModal .modal-header,
#restoreModal .modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#backupModal .modal-header h3,
#restoreModal .modal-header h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: rotate(90deg);
}

#backupModal .modal-body,
#restoreModal .modal-body {
    padding: var(--spacing-lg);
}

#backupModal .modal-footer,
#restoreModal .modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
    animation: progressPulse 1.5s infinite;
}

@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Success Icon Animation */
#backup-success .fa-check-circle {
    animation: successPop 0.5s ease;
}

/* Alert Styles */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.alert-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    border-left: 4px solid #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-left: 4px solid #667eea;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.08), rgba(255, 152, 0, 0.08));
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-left: 4px solid #ffc107;
}

.alert-success {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08), rgba(56, 142, 60, 0.08));
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-left: 4px solid #4caf50;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.08), rgba(211, 47, 47, 0.08));
    border: 1px solid rgba(244, 67, 54, 0.2);
    border-left: 4px solid #f44336;
}

/* ============================================
   LOGIN / AUTH PAGES
   ============================================ */
body.login-page,
body.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container,
.auth-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    padding: 40px;
}

.login-header,
.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo,
.auth-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    font-weight: bold;
}

.login-header h1,
.auth-header h1 {
    color: #333;
    font-size: 24px;
    margin-bottom: 5px;
}

.login-subtitle,
.auth-subtitle {
    color: #666;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.input-wrapper input {
    padding-left: 45px;
}

.btn-login,
.btn-auth {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover,
.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.login-footer,
.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 13px;
}

/* ============================================
   ADMIN / UTILITY PAGES
   ============================================ */
.utility-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
}

.utility-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.utility-header h1 {
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
}

.utility-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.utility-step {
    background: #f8f9fa;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.utility-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.utility-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.utility-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.utility-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.critical-notice {
    background: #ff5252;
    color: white;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.critical-notice.success {
    background: #4caf50;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.tool-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    transition: all 0.3s;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.tool-card h2 {
    color: #667eea;
    margin-top: 0;
    font-size: 20px;
}

.tool-card .icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.user-info-box {
    background: #667eea;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
}

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 150px 150px 150px 120px 120px;
    gap: 15px;
    align-items: end;
}

.filter-grid .form-group {
    margin-bottom: 0 !important;
}

.filter-grid .form-control,
.filter-grid input,
.filter-grid select {
    height: 42px !important;
    min-height: 42px !important;
    padding: 10px 14px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

.filter-grid select {
    padding-right: 36px !important;
}

.filter-grid .form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-grid .btn {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    white-space: nowrap;
}

.page-actions .btn {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-grid .btn {
        width: 100%;
    }
}

/* ============================================
   EMPLOYEE / HR TABLES
   ============================================ */
.employees-table,
.certificates-table,
.transfers-table,
.documents-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
}

.employees-table table,
.certificates-table table,
.transfers-table table,
.documents-table table {
    width: 100%;
    border-collapse: collapse;
}

.employees-table th,
.certificates-table th,
.transfers-table th,
.documents-table th {
    background: var(--bg-tertiary);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.employees-table td,
.certificates-table td,
.transfers-table td,
.documents-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.employees-table tr:hover,
.certificates-table tr:hover,
.transfers-table tr:hover,
.documents-table tr:hover {
    background-color: var(--bg-tertiary);
}

/* Employee cell */
.employee-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.employee-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.employee-info {
    flex: 1;
}

.employee-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.employee-name-ar {
    font-size: 12px;
    color: var(--text-secondary);
    direction: rtl;
}

.employee-code {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: monospace;
}

/* Status badges in tables */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.expired {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.expiring {
    background: #fff3cd;
    color: #856404;
}

.status-badge.valid {
    background: #d1ecf1;
    color: #0c5460;
}

/* ============================================
   APPROVAL LEVEL BADGES
   ============================================ */
.approval-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.approval-badge.level-0 {
    background: #6c757d;
    color: white;
}

.approval-badge.level-1 {
    background: #17a2b8;
    color: white;
}

.approval-badge.level-2 {
    background: #6f42c1;
    color: white;
}

.approval-badge.level-3 {
    background: #ffc107;
    color: #000;
}

.approval-badge.level-4 {
    background: #dc3545;
    color: white;
}

/* ============================================
   COMPANY DETAILS
   ============================================ */
.company-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 30px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin: -20px -20px 20px -20px;
}

.company-name-main {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.company-name-arabic {
    font-size: 20px;
    direction: rtl;
    opacity: 0.9;
}

.company-nav {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.company-nav .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.company-nav .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.company-nav .btn.active {
    background: white;
    color: #667eea;
}

.company-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--radius-sm);
}

.info-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 600;
}

.info-value {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   DOCUMENTS SECTION
   ============================================ */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.document-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.document-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.document-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.document-icon.pdf { color: #e74c3c; }
.document-icon.image { color: #3498db; }
.document-icon.word { color: #2980b9; }
.document-icon.excel { color: #27ae60; }
.document-icon.default { color: #95a5a6; }

.document-name {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
    word-break: break-word;
}

.document-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.document-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 10px;
}

/* ============================================
   EXPIRY TRACKING
   ============================================ */
.expiry-alert {
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.expiry-alert.expired {
    background: #f8d7da;
    color: #721c24;
}

.expiry-alert.expiring-soon {
    background: #fff3cd;
    color: #856404;
}

.expiry-alert.valid {
    background: #d1ecf1;
    color: #0c5460;
}

/* ============================================
   ORG CHART STYLES
   ============================================ */
.org-chart-container {
    overflow-x: auto;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    min-height: 400px;
}

.org-node {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 15px;
    min-width: 200px;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow);
    transition: all 0.3s;
}

.org-node:hover {
    border-color: var(--brand-primary);
    transform: scale(1.05);
    z-index: 10;
}

.org-node-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin: 0 auto 10px;
}

.org-node-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.org-node-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.org-node-code {
    font-size: 10px;
    color: var(--text-tertiary);
    font-family: monospace;
}

/* ============================================
   PAYROLL STYLES
   ============================================ */
.payroll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.payroll-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.3s;
}

.payroll-card:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

.payroll-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.payroll-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-primary);
}

.payroll-breakdown {
    display: grid;
    gap: 10px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.breakdown-label {
    color: var(--text-secondary);
}

.breakdown-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   REPORTS & ANALYTICS
   ============================================ */
.report-filters {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.chart-container {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 20px;
}

.chart-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* ============================================
   USERS & ROLES
   ============================================ */
.role-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.3s;
}

.role-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.role-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.role-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.role-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

.role-badge.system {
    background: #667eea;
    color: white;
}

.role-badge.custom {
    background: #6c757d;
    color: white;
}

.role-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 15px;
}

.role-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
}

.role-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
}

.permissions-grid {
    display: grid;
    gap: 15px;
}

.permission-module {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--radius-sm);
}

.permission-module-name {
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.permission-checks {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.permission-check {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.setting-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.setting-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.setting-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 15px;
}

.setting-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.setting-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================
   IMPORT / EXPORT PAGES
   ============================================ */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    background: var(--bg-tertiary);
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--brand-primary);
    background: var(--bg-primary);
}

.upload-icon {
    font-size: 64px;
    color: var(--text-tertiary);
    margin-bottom: 15px;
}

.upload-text {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.import-preview {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.import-preview table {
    width: 100%;
    font-size: 13px;
}

.import-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.summary-item {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--brand-primary);
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ============================================
   CERTIFICATE GENERATION
   ============================================ */
.certificate-preview {
    background: white;
    padding: 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--shadow);
    max-width: 800px;
    margin: 20px auto;
}

.certificate-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 3px solid var(--brand-primary);
    padding-bottom: 20px;
}

.certificate-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
}

.certificate-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 10px;
}

.certificate-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

.certificate-body {
    line-height: 1.8;
    font-size: 15px;
    color: var(--text-primary);
}

.certificate-footer {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.certificate-signature {
    text-align: center;
}

.signature-line {
    border-top: 2px solid var(--text-primary);
    width: 200px;
    margin: 40px auto 10px;
}

.signature-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   ACTIVITY LOGS
   ============================================ */
.activity-timeline {
    position: relative;
    padding-left: 30px;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.activity-item {
    position: relative;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px var(--shadow);
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-primary);
    border: 3px solid var(--bg-primary);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.activity-user {
    font-weight: 600;
    color: var(--text-primary);
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.activity-action {
    font-size: 14px;
    color: var(--text-primary);
}

.activity-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.pagination-btn:hover {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.pagination-btn.active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .header,
    .page-actions,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
    }
    
    .certificate-preview,
    .printable-content {
        box-shadow: none !important;
        border: none !important;
    }
    
    body {
        background: white !important;
    }
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius-md);
    text-align: center;
}

.loading-content .loading-spinner {
    width: 50px;
    height: 50px;
    border-width: 5px;
    border-top-color: var(--brand-primary);
    margin-bottom: 15px;
}

/* ============================================
   TOOLTIPS
   ============================================ */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: var(--radius-sm);
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--spacing-md);
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item a {
    color: var(--brand-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-tertiary);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* Custom tabs (not Bootstrap tabs) - specific selector to avoid Bootstrap conflicts */
.custom-tabs .tab-content {
    display: none;
}

.custom-tabs .tab-content.active {
    display: block;
}

/* ============================================
   DROPDOWN MENU
   ============================================ */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px var(--shadow);
    min-width: 240px;
    max-width: 280px;
    z-index: 9999;
    display: none;
    margin: 0;
}

.dropdown-menu.show,
.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--brand-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

/* ============================================
   SELECT2 CUSTOM STYLING
   ============================================ */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    height: 42px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    background-color: var(--input-bg);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    padding-left: 0;
    color: var(--text-primary);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 5px;
}

.select2-dropdown {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    z-index: 10000 !important;
    background-color: var(--bg-secondary);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.select2-container--default .select2-results__option--highlighted {
    background-color: var(--brand-primary) !important;
    color: white !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--brand-primary) !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.select2-results__option {
    padding: 8px 12px;
    color: var(--text-primary);
}

.select2-results__option:hover {
    background-color: var(--brand-primary) !important;
    color: white !important;
}

.select2-employee-option {
    padding: 5px 0;
}

.select2-employee-option .employee-name {
    font-weight: 500;
    color: inherit;
}

.select2-employee-option .employee-code {
    font-size: 12px;
    opacity: 0.8;
}

/* Salary Certificate Specific */
.cert-number {
    font-weight: 600;
    color: var(--brand-primary);
    font-family: 'Courier New', monospace;
}

.salary-amount {
    color: var(--brand-success);
    font-weight: 600;
    font-size: 15px;
}

.salary-breakdown {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    display: none;
}

.salary-breakdown.show {
    display: block;
}

/* ============================================
   EMPLOYEE FILTERS & STATUS
   ============================================ */
.employee-filters {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow);
}

.filter-grid.employee-filter-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr auto auto;
}

.employee-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.status-on-leave {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-terminated {
    background: #e2e3e5;
    color: #383d41;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-current {
    padding: 0 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   DEPARTMENTS MODULE
   ============================================ */
.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.department-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
}

.department-card:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

.department-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    color: white;
}

.department-header h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: white;
}

.department-code {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
    margin-top: 5px;
}

.department-body {
    padding: 20px;
}

.department-info {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-primary);
}

.info-row i {
    width: 24px;
    color: var(--primary);
}

.department-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* List View Styles */
.departments-list {
    display: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
    margin-top: 20px;
}

.departments-list.active {
    display: block;
}

.departments-grid.list-view {
    display: none;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.list-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.list-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.list-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.list-dept-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.list-dept-code {
    font-family: 'Courier New', monospace;
    color: var(--primary);
    font-size: 13px;
    margin-left: 10px;
}

.list-actions {
    display: flex;
    gap: 5px;
}

/* ============================================
   DESIGNATIONS MODULE
   ============================================ */
.designations-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
}

.designations-table table {
    width: 100%;
    border-collapse: collapse;
}

.designations-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.designations-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.designations-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.designations-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.designation-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.designation-code {
    background: #e7f3ff;
    color: #0066cc;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.designation-level {
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
}

.salary-range {
    color: var(--success);
    font-weight: 600;
    font-size: 13px;
}

/* ============================================
   HR DOCUMENTS MODULE
   ============================================ */
.documents-container {
    max-width: 1400px;
    margin: 0 auto;
}

.employee-info-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 30px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.employee-info h2 {
    margin: 0 0 5px 0;
    color: white;
}

.employee-meta {
    font-size: 0.9em;
    opacity: 0.9;
}

.upload-section {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 25px;
}

.upload-section h3 {
    margin-top: 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

/* Enhanced document card for HR module */
.document-card.hr-document {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
    text-align: left;
    padding: 0;
}

.document-card.hr-document:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

.document-header {
    background: var(--bg-tertiary);
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
}

.document-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 5px;
}

.doc-type-passport { background: #e3f2fd; color: #1976d2; }
.doc-type-civil-id { background: #f3e5f5; color: #7b1fa2; }
.doc-type-visa { background: #e8f5e9; color: #388e3c; }
.doc-type-certificate { background: #fff3e0; color: #f57c00; }
.doc-type-contract { background: #fce4ec; color: #c2185b; }
.doc-type-other { background: #e0e0e0; color: #424242; }

.document-body {
    padding: 15px;
}

.document-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9em;
}

.document-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.document-info-item i {
    width: 20px;
    color: var(--primary);
}

.expiry-warning {
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expiry-danger {
    background: #f8d7da;
    color: #721c24;
}

.document-actions {
    padding: 15px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

/* ============================================
   SALARY TRANSFERS MODULE
   ============================================ */
.transfers-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
}

.transfers-table table {
    width: 100%;
    border-collapse: collapse;
}

.transfers-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.transfers-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.transfers-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.transfers-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.bank-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   PAYROLL MODULE
   ============================================ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
}

.summary-card h3 {
    margin: 0 0 10px 0;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.summary-card .amount {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.summary-card.gross .amount { color: var(--success); }
.summary-card.deductions .amount { color: var(--danger); }
.summary-card.net .amount { color: var(--primary); }

.payroll-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow-x: auto;
}

.payroll-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.payroll-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.payroll-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.payroll-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.payroll-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.amount-positive {
    color: var(--success);
    font-weight: 600;
}

.amount-negative {
    color: var(--danger);
    font-weight: 600;
}

.amount-neutral {
    color: var(--text-primary);
    font-weight: 600;
}

.calculation-summary {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
}

.calculation-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.calculation-row:last-child {
    border-bottom: none;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    padding-top: 15px;
}

@media (max-width: 1200px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   REPORTS MODULE
   ============================================ */
.reports-nav {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.report-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.report-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
}

.report-container {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.report-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    border-radius: var(--radius-md);
    color: white;
    text-align: center;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    opacity: 0.9;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

.stat-card.green { background: linear-gradient(135deg, #28a745 0%, #20c997 100%); }
.stat-card.blue { background: linear-gradient(135deg, #007bff 0%, #17a2b8 100%); }
.stat-card.orange { background: linear-gradient(135deg, #fd7e14 0%, #ffc107 100%); }
.stat-card.red { background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%); }

.chart-container {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   FORM SECTIONS (Add/Edit Employee)
   ============================================ */
.form-section {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow);
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

.edit-form-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    padding: 30px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    color: var(--primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

input[type="file"] {
    padding: 8px;
    border: 1px dashed var(--border-color);
    background: var(--bg-tertiary);
}

input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--primary-light, #f0f1ff);
}

/* ============================================
   EMPLOYEE PROFILE VIEW
   ============================================ */
.employee-profile {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
}

.profile-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    color: white;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.profile-photo-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.9);
    object-fit: cover;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.profile-main-info h1 {
    margin: 0 0 10px 0;
    font-size: 2em;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.profile-meta {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95em;
}

.profile-meta-item i {
    opacity: 0.9;
}

.profile-meta-item strong {
    font-weight: 600;
}

.profile-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-tertiary);
}

.profile-tab {
    padding: 15px 30px;
    cursor: pointer;
    border: none;
    background: transparent;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.profile-tab.active {
    color: #667eea;
    border-bottom: 3px solid #667eea;
    background: var(--bg-secondary);
}

.profile-tab:hover {
    color: var(--primary);
}

.profile-content {
    padding: 30px;
}

/* Custom tabs (not Bootstrap tabs) - specific selector to avoid Bootstrap conflicts */
.profile-content .tab-content {
    display: none;
}

.profile-content .tab-content.active {
    display: block;
}

.info-card {
    background: var(--bg-tertiary);
    padding: 0;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    overflow: hidden;
}

.info-card h3 {
    margin: 0;
    padding: 15px 20px;
    font-size: 1.1em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.info-card h3 i {
    font-size: 1.2em;
    opacity: 0.8;
}

.info-card > .info-item {
    margin: 15px 20px;
}

.info-card > .info-item:last-child {
    margin-bottom: 20px;
}

.certificates-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px var(--shadow-hover);
    min-width: 220px;
    z-index: 1000;
    margin-top: 5px;
}

.certificates-dropdown a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.certificates-dropdown a:last-child {
    border-bottom: none;
}

.certificates-dropdown a:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    padding-left: 25px;
}

.certificates-dropdown a i {
    margin-right: 10px;
    width: 20px;
}

/* Certificate Modal */
.cert-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.cert-modal-content {
    background-color: var(--bg-secondary);
    margin: auto;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 700px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cert-modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cert-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.cert-modal-header h2 i {
    margin-right: 10px;
}

.cert-modal-header .close {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cert-modal-header .close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.cert-modal-body {
    padding: 25px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Form Section Headers */
.form-section-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin: 25px 0 15px 0;
    padding: 12px 15px;
    background: linear-gradient(to right, rgba(102, 126, 234, 0.1), transparent);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
}

.form-section-header:first-of-type {
    margin-top: 5px;
}

.form-section-header i {
    margin-right: 8px;
}

/* Modal Form Rows */
.cert-modal-body .form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.cert-modal-body .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.cert-modal-body .form-group {
    margin-bottom: 20px;
}

.cert-modal-body .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.cert-modal-body .form-group label .required {
    color: #e53e3e;
    margin-left: 3px;
}

.cert-modal-body .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.cert-modal-body .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cert-modal-body textarea.form-control {
    resize: vertical;
    min-height: 60px;
}

.cert-modal-body .form-control::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.cert-modal-body .form-actions {
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
}

.cert-modal-body .form-actions button {
    min-width: 150px;
}

/* Responsive Form Layout */
@media (max-width: 768px) {
    .cert-modal-body .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .cert-modal-body .form-row .form-group {
        margin-bottom: 20px;
    }
}

.employee-info-box {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.employee-info-box strong {
    font-size: 18px;
    font-weight: 600;
}

.employee-info-box span {
    font-size: 14px;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .cert-modal-content {
        width: 95%;
        margin: 20px auto;
    }
}

/* ============================================
   HR DASHBOARD
   ============================================ */
.hr-dashboard {
    padding: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.green { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-icon.red { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.stat-icon.teal { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.stat-icon.indigo { background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%); }
.stat-icon.pink { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }

.stat-content h3 {
    font-size: 32px;
    font-weight: bold;
    margin: 0 0 5px 0;
    color: var(--text-primary);
}

.stat-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Modern Dashboard Statistics Cards */
.dashboard-stat-card {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 20px;
}

.dashboard-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--stat-color-from), var(--stat-color-to));
}

.dashboard-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.dashboard-stat-card .stat-icon-modern {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--stat-color-from), var(--stat-color-to));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dashboard-stat-card .stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-stat-card .stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -1px;
}

.dashboard-stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-stat-card .stat-change {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.dashboard-stat-card .stat-change.up {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.dashboard-stat-card .stat-change.down {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Color variations for different stat cards */
.dashboard-stat-card.users {
    --stat-color-from: #667eea;
    --stat-color-to: #764ba2;
}

.dashboard-stat-card.employees {
    --stat-color-from: #f093fb;
    --stat-color-to: #f5576c;
}

.dashboard-stat-card.fleet {
    --stat-color-from: #4facfe;
    --stat-color-to: #00f2fe;
}

.dashboard-stat-card.candidates {
    --stat-color-from: #43e97b;
    --stat-color-to: #38f9d7;
}

.dashboard-stat-card.warnings {
    --stat-color-from: #fa709a;
    --stat-color-to: #fee140;
}

.dashboard-stat-card.pending {
    --stat-color-from: #30cfd0;
    --stat-color-to: #330867;
}

.dashboard-stat-card.messages {
    --stat-color-from: #a8edea;
    --stat-color-to: #fed6e3;
}

.dashboard-stat-card.tasks {
    --stat-color-from: #ffecd2;
    --stat-color-to: #fcb69f;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.quick-action-btn {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-hover);
}

.quick-action-btn i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--primary);
}

.quick-action-btn span {
    display: block;
    font-weight: 500;
}

/* ============================================
   BANK DETAILS MODULE
   ============================================ */
.bank-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px var(--shadow);
    position: relative;
}

.bank-card.primary {
    border-left: 4px solid var(--success);
}

.primary-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.bank-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.bank-card-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.bank-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.bank-info-item {
    display: flex;
    flex-direction: column;
}

.bank-info-item label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.bank-info-item .value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.bank-card-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.no-bank-details {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-bank-details i {
    font-size: 48px;
    color: var(--border-color);
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .bank-card-body {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   EXPIRY TRACKING MODULE
   ============================================ */
.stat-card.expired { border-left: 4px solid var(--danger); }
.stat-card.expired .count { color: var(--danger); }
.stat-card.expiring-soon { border-left: 4px solid #ffc107; }
.stat-card.expiring-soon .count { color: #ffc107; }
.stat-card.expiring-60 { border-left: 4px solid #fd7e14; }
.stat-card.expiring-60 .count { color: #fd7e14; }
.stat-card.expiring-90 { border-left: 4px solid #17a2b8; }
.stat-card.expiring-90 .count { color: #17a2b8; }

.documents-table {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    overflow: hidden;
}

.documents-table table {
    width: 100%;
    border-collapse: collapse;
}

.documents-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.documents-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.documents-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.documents-table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.doc-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.doc-badge.id {
    background: #e7f3ff;
    color: #0066cc;
}

.doc-badge.passport {
    background: #e8f5e9;
    color: #2e7d32;
}

.expiry-status {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.expiry-status.expired {
    background: var(--danger);
    color: white;
}

.expiry-status.critical {
    background: #ffc107;
    color: #000;
}

.expiry-status.warning {
    background: #fd7e14;
    color: white;
}

.expiry-status.notice {
    background: #17a2b8;
    color: white;
}

.days-count {
    font-size: 18px;
    font-weight: 700;
}

@media (max-width: 1200px) {
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   EXPERIENCE CERTIFICATES
   ============================================ */
.duration-badge {
    background: #e7f3ff;
    color: #0066cc;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
}

/* ============================================
   TERMINATION LETTERS
   ============================================ */
.letter-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow);
    border-left: 4px solid var(--danger);
}

.letter-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.letter-number {
    font-size: 20px;
    font-weight: 600;
    color: var(--danger);
}

.letter-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.resignation-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.resignation-voluntary { background: #ffc107; color: #000; }
.resignation-involuntary { background: var(--danger); color: white; }
.resignation-mutual { background: #17a2b8; color: white; }
.resignation-contract { background: #6c757d; color: white; }
.settlement-pending { background: #ffc107; color: #000; }
.settlement-completed { background: var(--success); color: white; }

/* ============================================
   IMPORT/EXPORT MODULES
   ============================================ */
.import-container {
    max-width: 1200px;
    margin: 0 auto;
}

.import-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.import-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px var(--shadow);
    padding: 30px;
}

.import-card h3 {
    margin-top: 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-area {
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    background: var(--primary-light, #f8f9ff);
    margin: 20px 0;
}

.upload-area i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.instructions-list {
    list-style: none;
    padding: 0;
}

.instructions-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: start;
    gap: 10px;
}

.instructions-list li:last-child {
    border-bottom: none;
}

.instructions-list i {
    color: var(--primary);
    margin-top: 3px;
}

.csv-format {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 15px 0;
}

.results-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.results-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.results-box li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.results-box li:last-child {
    border-bottom: none;
}

.warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    border-radius: var(--radius-sm);
    margin: 20px 0;
}

@media (max-width: 992px) {
    .import-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   CERTIFICATE VIEWER & PRINT STYLES
   ============================================ */

/* Toolbar for Print/Back buttons */
.toolbar {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

/* Certificate Container - A4 size for proper printing */
.certificate-container {
    background: white;
    max-width: 210mm;
    margin: 0 auto;
    padding: 40mm 25mm;
    box-shadow: var(--shadow-md);
    min-height: 297mm;
    border-radius: var(--radius-md);
}

/* Letterhead Section */
.letterhead {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary);
}

.company-name {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.company-details,
.company-address {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

/* Certificate Metadata */
.cert-number {
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.cert-date,
.date {
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 30px;
}

/* Certificate Title */
.title,
.subject {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    text-decoration: underline;
    color: var(--primary);
    margin: 30px 0;
}

/* Certificate Content */
.content {
    text-align: justify;
    line-height: 1.8;
    font-size: 14px;
    color: var(--text-primary);
    margin: 20px 0;
}

.content p {
    margin: 15px 0;
}

/* Details Table in Certificates */
.details-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.details-table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.details-table td:first-child {
    background: var(--bg-secondary);
    font-weight: 600;
    width: 35%;
}

/* Employee Details Box */
.employee-details {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
}

.employee-details table {
    width: 100%;
    border-collapse: collapse;
}

.employee-details td {
    padding: 8px 0;
}

.employee-details .label {
    font-weight: bold;
    width: 200px;
    color: var(--text-secondary);
}

/* Reason/Warning Boxes */
.reason-box {
    margin: 20px 0;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
}

/* Signature Section */
.signature-section {
    margin-top: 60px;
    display: flex;
    justify-content: space-between;
    gap: 40px;
}

.signature-block {
    text-align: center;
    width: 45%;
}

.signature {
    margin-top: 80px;
    text-align: center;
}

.signature-line {
    border-top: 2px solid #333;
    width: 200px;
    margin: 60px auto 0;
    padding-top: 10px;
}

/* Certificate Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
}

/* Print Button (fixed position) */
.print-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 16px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.print-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Termination Letter Specific Styles */
body.termination-letter .letterhead {
    border-bottom-color: #dc3545;
}

body.termination-letter .company-name,
body.termination-letter .cert-number,
body.termination-letter .title {
    color: #dc3545;
}

body.termination-letter .employee-details {
    border-left-color: #dc3545;
}

/* Print Media Queries */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    .toolbar,
    .print-button,
    .no-print {
        display: none !important;
    }
    
    .certificate-container {
        box-shadow: none;
        border-radius: 0;
        padding: 20mm 15mm;
        max-width: 100%;
        margin: 0;
        min-height: 0;
    }
    
    .content {
        page-break-inside: avoid;
    }
    
    .signature-section {
        page-break-inside: avoid;
    }
}

/* ============================================
   CSV IMPORT WITH RESULTS MODULE
   ============================================ */

.import-instructions {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: var(--radius-md);
    height: fit-content;
}

.import-instructions h3 {
    margin-top: 0;
    color: var(--primary);
    font-size: 16px;
    margin-bottom: 15px;
}

.import-instructions ol,
.import-instructions ul {
    margin: 10px 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.6;
}

.import-instructions ol li,
.import-instructions ul li {
    margin-bottom: 5px;
}

.import-instructions p {
    margin: 10px 0;
    font-size: 13px;
}

.import-instructions strong {
    color: var(--text-primary);
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
}

.import-instructions code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: var(--primary);
}

/* Import Results Section */
.import-results {
    margin-top: 20px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    text-align: center;
}

.result-card h2 {
    font-size: 36px;
    margin: 0 0 10px 0;
    font-weight: bold;
}

.result-card.success h2 {
    color: #28a745;
}

.result-card.warning h2 {
    color: #ffc107;
}

.result-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Error List for Import */
.error-list {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    max-height: 400px;
    overflow-y: auto;
}

.error-list h3 {
    margin-top: 0;
    color: #dc3545;
    font-size: 18px;
}

.error-item {
    padding: 10px;
    border-left: 3px solid #dc3545;
    background: #f8d7da;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #721c24;
}

/* ============================================
   ORGANIZATIONAL CHART MODULE
   ============================================ */

/* View Toggles and Config */
.view-toggles {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-config-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-config-selector select {
    min-width: 200px;
}

/* Hierarchy Level Borders & Badges */
.level-1 {
    border-left: 4px solid #007bff;
}

.level-2 {
    border-left: 4px solid #28a745;
}

.level-3 {
    border-left: 4px solid #ffc107;
}

.level-4 {
    border-left: 4px solid #fd7e14;
}

.level-5 {
    border-left: 4px solid #e83e8c;
}

.badge-level-1 {
    background-color: #007bff;
    color: white;
}

.badge-level-2 {
    background-color: #28a745;
    color: white;
}

.badge-level-3 {
    background-color: #ffc107;
    color: #000;
}

.badge-level-4 {
    background-color: #fd7e14;
    color: white;
}

.badge-level-5 {
    background-color: #e83e8c;
    color: white;
}

/* Employee Type Badges */
.badge-executive {
    background-color: #6f42c1;
    color: white;
}

.badge-management {
    background-color: #007bff;
    color: white;
}

.badge-supervisor {
    background-color: #28a745;
    color: white;
}

.badge-staff {
    background-color: #6c757d;
    color: white;
}

.badge-temporary {
    background-color: #fd7e14;
    color: white;
}

/* Employee Info Display */
.employee-info {
    font-size: 13px;
    line-height: 1.5;
}

/* Org Chart SVG Container */
#orgChartContainer {
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 600px;
}

#orgChartSvg {
    cursor: grab;
    width: 100%;
    height: 100%;
}

#orgChartSvg:active {
    cursor: grabbing;
}

/* SVG Node Styles */
.org-node {
    fill: white;
    stroke: #007bff;
    stroke-width: 2;
    rx: 5;
    ry: 5;
    transition: all 0.3s;
}

.org-node:hover {
    filter: brightness(0.95);
}

.org-node.executive {
    stroke: #6f42c1;
    fill: #f8f5ff;
}

.org-node.management {
    stroke: #007bff;
    fill: #e7f3ff;
}

.org-node.supervisor {
    stroke: #28a745;
    fill: #e8f5e9;
}

.org-node.staff {
    stroke: #6c757d;
    fill: #f8f9fa;
}

.org-node.temporary {
    stroke: #fd7e14;
    fill: #fff3e0;
}

/* SVG Text Styles */
.org-node-text {
    font-family: Arial, sans-serif;
    font-size: 12px;
    text-anchor: middle;
    dominant-baseline: middle;
    fill: #333;
    pointer-events: none;
}

.org-node-title {
    font-weight: bold;
    font-size: 13px;
}

/* SVG Link Lines */
.org-link {
    fill: none;
    stroke: #6c757d;
    stroke-width: 2;
}

/* Tree Text View Container */
#orgTreeContainer {
    font-family: 'Courier New', monospace;
    white-space: pre-line;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-height: 600px;
    overflow: auto;
    line-height: 1.6;
}

.tree-node {
    margin: 5px 0;
    padding: 5px;
    border-radius: 3px;
}

.tree-node.level-1 {
    background: rgba(0, 123, 255, 0.1);
}

.tree-node.level-2 {
    background: rgba(40, 167, 69, 0.1);
}

.tree-node.level-3 {
    background: rgba(255, 193, 7, 0.1);
}

.tree-node.level-4 {
    background: rgba(253, 126, 20, 0.1);
}

.tree-node.level-5 {
    background: rgba(232, 62, 140, 0.1);
}

/* Org Chart Designer Specific Styles */
#designerCanvas {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: crosshair;
    overflow: hidden;
    min-height: 600px;
}

#canvasOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.canvas-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.color-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.color-input-group label {
    font-size: 12px;
    margin: 0;
    flex: 1;
}

.color-input {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.org-node-designer {
    fill: white;
    stroke: #007bff;
    stroke-width: 2;
    cursor: move;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.1));
}

.org-node-designer:hover {
    stroke-width: 3;
    filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.2));
}

/* Org Chart Analytics Styles */
.analytics-container {
    padding: 20px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.analytics-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.analytics-card h3 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.metric-item:last-child {
    border-bottom: none;
}

.metric-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.metric-value {
    font-weight: bold;
    color: var(--primary);
    font-size: 16px;
}

/* Feature Cards (Setup) */
.feature-card {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    border-left: 4px solid var(--primary);
    min-height: 120px;
}

.feature-card h6 {
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ============================================
   COMPANY DETAILS MODULE
   ============================================ */

/* Company Info Groups */
.info-group {
    margin-bottom: 15px;
}

.info-group label {
    font-weight: bold;
    color: var(--text-primary);
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.info-group p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Company Document Expiry Warning */
.border-warning {
    border: 2px solid #ffc107 !important;
    background-color: #fff9e6;
}

.expiry-info {
    margin-top: 10px;
    padding: 10px;
    background-color: var(--bg-secondary);
    border-left: 3px solid #17a2b8;
    font-size: 0.9em;
    border-radius: var(--radius-sm);
}

/* ============================================
   USERS & SETTINGS MODULES
   ============================================ */

/* Permissions Grid & Cards */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.permission-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    background: white;
}

.permission-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.permission-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: white;
}

.permission-icon.admin {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.permission-icon.module {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.permission-icon.user {
    background: linear-gradient(135deg, #48c774 0%, #38a169 100%);
}

.permission-card h5 {
    margin: 15px 0 10px;
    color: var(--text-primary);
    font-size: 18px;
}

.permission-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 15px;
}

/* Permission Lists */
.permission-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.permission-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

.permission-list li:last-child {
    border-bottom: none;
}

.permission-list i {
    margin-right: 10px;
    color: var(--primary);
}

/* User Lists */
.user-list {
    max-height: 400px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.user-item:last-child {
    border-bottom: none;
}

/* Activity Logs Filter */
.filter-form .form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-form .form-group {
    flex: 1;
    min-width: 150px;
}

/* Toggle Switch for Permissions */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #28a745;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Settings Navigation */
.settings-container {
    padding: 20px;
}

.settings-nav {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.settings-nav-item {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.settings-nav-item:last-child {
    border-right: none;
}

.settings-nav-item:hover:not(.active) {
    background: linear-gradient(to bottom, var(--bg-tertiary), var(--bg-secondary));
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-weight: 600;
    box-shadow: inset 0 -3px 0 0 rgba(255, 255, 255, 0.3);
    position: relative;
}

.settings-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
}

.settings-nav-item i {
    font-size: 22px;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.settings-nav-item.active i {
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.settings-nav-item span {
    font-size: 13px;
    font-weight: 500;
}

.settings-nav-item.active span {
    font-weight: 600;
    letter-spacing: 0.3px;
}

.settings-section {
    display: none;
    background: white;
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.settings-section.active {
    display: block;
}

.settings-form-group {
    margin-bottom: 20px;
}

.settings-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-form-group input,
.settings-form-group select,
.settings-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.settings-form-group input:focus,
.settings-form-group select:focus,
.settings-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.settings-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.settings-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.settings-col {
    flex: 1;
    min-width: 0;
}

/* Section Header with improved active tab styling */
.section-header {
    border-bottom: 3px solid var(--primary);
    padding-bottom: 15px;
    margin-bottom: 25px;
    background: linear-gradient(to right, var(--bg-tertiary), transparent);
    padding: 15px;
    border-radius: var(--radius-sm);
}

.section-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h3 i {
    font-size: 24px;
}

.section-header p {
    margin: 8px 0 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Save Button - Premium Style (All Settings Save Buttons) */
.btn-save,
.settings-section button[type="submit"],
.settings-section .btn-primary,
button[name*="save"],
button[name*="update"] {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
    text-transform: none;
    letter-spacing: 0.3px;
}

.btn-save:hover,
.settings-section button[type="submit"]:hover,
.settings-section .btn-primary:hover,
button[name*="save"]:hover,
button[name*="update"]:hover {
    background: linear-gradient(135deg, #2980b9 0%, #2471a3 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(52, 152, 219, 0.4);
}

.btn-save:active,
.settings-section button[type="submit"]:active,
.settings-section .btn-primary:active,
button[name*="save"]:active,
button[name*="update"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.btn-save:disabled,
.settings-section button[type="submit"]:disabled,
button[name*="save"]:disabled,
button[name*="update"]:disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

.btn-save i,
.settings-section button[type="submit"] i,
button[name*="save"] i,
button[name*="update"] i {
    font-size: 16px;
    margin-right: 4px;
}

/* Settings Form Actions */
.settings-form-actions,
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    align-items: center;
    flex-wrap: wrap;
}

/* Cancel/Reset Buttons */
.settings-section .btn-secondary,
.settings-section button[type="reset"],
button[name*="cancel"],
button[name*="reset"] {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 12px 30px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 140px;
}

.settings-section .btn-secondary:hover,
.settings-section button[type="reset"]:hover,
button[name*="cancel"]:hover,
button[name*="reset"]:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Settings Checkbox & Toggle */
.settings-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.settings-checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
}

.settings-checkbox label {
    margin: 0;
    cursor: pointer;
    user-select: none;
}

/* Info Box */
.info-box {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 15px 20px;
    margin-bottom: 20px;
}

.info-box h5 {
    margin: 0 0 8px 0;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
}

.info-box p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Responsive Layout for Settings */
@media (max-width: 992px) {
    .settings-nav {
        flex-wrap: wrap;
    }
    
    .settings-nav-item {
        flex: 1 1 calc(33.333% - 2px);
        border-right: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
    }
    
    .settings-nav-item:nth-child(3n) {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .settings-nav-item {
        flex: 1 1 calc(50% - 1px);
        padding: 14px 16px;
    }
    
    .settings-nav-item:nth-child(3n) {
        border-right: 1px solid var(--border-color);
    }
    
    .settings-nav-item:nth-child(2n) {
        border-right: none;
    }
    
    .settings-nav-item:nth-last-child(-n+2) {
        border-bottom: none;
    }
    
    .settings-nav-item i {
        font-size: 20px;
    }
    
    .settings-nav-item span {
        font-size: 12px;
    }
    
    .settings-section {
        padding: 15px;
    }
    
    .settings-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .section-header {
        padding: 12px;
    }
    
    .section-header h3 {
        font-size: 18px;
    }
    
    .btn-save,
    .settings-section button[type="submit"],
    .settings-section .btn-primary,
    button[name*="save"],
    button[name*="update"] {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }
    
    .settings-section .btn-secondary,
    .settings-section button[type="reset"],
    button[name*="cancel"],
    button[name*="reset"] {
        width: 100%;
        padding: 14px 20px;
    }
    
    .settings-form-actions,
    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .settings-nav-item {
        flex: 1 1 100%;
        padding: 12px 16px;
        flex-direction: row;
        justify-content: center;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
    }
    
    .settings-nav-item:last-child {
        border-bottom: none;
    }
    
    .settings-nav-item i {
        font-size: 18px;
    }
    
    .settings-nav-item span {
        font-size: 13px;
    }
}

/* System Info Cards */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.info-card-header {
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    font-weight: 600;
}

.info-card-body {
    padding: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-ok {
    background-color: #28a745;
}

.status-warning {
    background-color: #ffc107;
}

.status-error {
    background-color: #dc3545;
}

/* System Actions */
.system-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ============================================
   UTILITY PAGES (Install, Setup, Debug, Test)
   ============================================ */

/* Standalone utility pages with gradient backgrounds */
body.utility-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
}

.utility-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 900px;
    width: 100%;
    padding: 40px;
}

.utility-container h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 28px;
    text-align: center;
}

.utility-container .subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
    text-align: center;
}

.utility-container h2 {
    color: #555;
    margin: 25px 0 15px;
    background: #f8f9fa;
    padding: 10px;
    border-left: 4px solid #667eea;
    font-size: 20px;
}

/* Utility Alert Messages */
.critical {
    background: #ff5252;
    color: white;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.step {
    background: #e7f3ff;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
}

.highlight {
    background: #ffeb3b;
    font-weight: bold;
    padding: 2px 5px;
}

/* Utility Buttons */
.btn-danger {
    background: #dc3545 !important;
}

.btn-danger:hover {
    background: #c82333 !important;
}

.btn-warning {
    background: #ffc107 !important;
    color: #000 !important;
}

.btn-warning:hover {
    background: #e0a800 !important;
}

/* Table Grid for Utility Pages */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.table-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    transition: all 0.3s;
}

.table-card:hover {
    background: #e9ecef;
    border-color: #667eea;
}

/* Test/Debug Status Indicators */
.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Setup Progress */
.progress-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.progress-bar {
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

/* Code Blocks in Utility Pages */
pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 400px;
    border: 1px solid #dee2e6;
    line-height: 1.6;
    font-size: 14px;
}

code {
    background: #f4f4f4;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* ============================================
   RH MAP STYLES
   ============================================ */

/* RH Map Button */
.rh-map-btn {
    color: var(--primary) !important;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    position: relative;
    display: flex !important;
    align-items: center;
}

.rh-map-btn:hover {
    background: var(--primary-light) !important;
    -webkit-text-fill-color: white;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.rh-map-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: -1;
}

.rh-map-btn:hover:before {
    opacity: 1;
}

/* RH Map Modal Styles */
#rhMapModal .modal-dialog {
    max-width: 95vw;
}

#rhMapModal .modal-body {
    padding: 0;
}

#rhMapContainer {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    position: relative;
}

#rhMapStats .card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform var(--transition-fast);
}

#rhMapStats .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#rhMapLocations .list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
}

#rhMapLocations .list-group-item:hover {
    background-color: var(--bg-tertiary);
}

/* Dark theme adjustments for RH Map */
.dark-theme .rh-map-btn {
    color: var(--primary-light) !important;
}

.dark-theme #rhMapContainer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.dark-theme #rhMapStats .card {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

