/* ========================================
   نظام السلامة المهنية - أمريكانا HSE
   تصميم حديث ومتجاوب
   ======================================== */

/* ===== Font Awesome Fallback ===== */
/* Fallback mechanism للأيقونات في حالة فشل تحميل Font Awesome */
.fas,
.far,
.fal,
.fab,
.fa {
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands', 'Font Awesome 6 Pro', Arial, sans-serif;
    font-weight: 900;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fallback icons using Unicode symbols if Font Awesome fails */
.fa-th-large::before {
    content: '☰';
    font-family: Arial, sans-serif;
    display: inline-block;
}

.fa-arrow-right::before {
    content: '→';
    font-family: Arial, sans-serif;
    display: inline-block;
}

.fa-check::before {
    content: '✓';
    font-family: Arial, sans-serif;
    display: inline-block;
}

.fa-sync-alt::before {
    content: '↻';
    font-family: Arial, sans-serif;
    display: inline-block;
}

.fa-exclamation-triangle::before {
    content: '⚠';
    font-family: Arial, sans-serif;
    display: inline-block;
}

/* Ensure icons are visible even if Font Awesome fails */
i[class*="fa-"] {
    display: inline-block;
    min-width: 1em;
    text-align: center;
}

/* ===== CSS Variables ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #aa3636;
    --info-color: #06b6d4;
    --purple-color: #8b5cf6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 280px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Light Mode Colors */
    --bg-primary: #ffffff;
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    --text-primary: var(--gray-800);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --border-color: var(--gray-200);
    --card-bg: #ffffff;
    --sidebar-bg: linear-gradient(180deg, #003865 0%, #004C8C 50%, #003865 100%);
    --login-bg: linear-gradient(135deg, #003865 0%, #004C8C 100%);
}

/* ===== Dark Mode Variables ===== */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --bg-tertiary: #2d2d2d;
    --text-primary: #f5f5f5;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
    --border-color: #3a3a3a;
    --card-bg: #252525;
    --sidebar-bg: linear-gradient(180deg, #001a31 0%, #003865 50%, #001a33 100%);
    --login-bg: linear-gradient(135deg, #001a33 0%, #003865 100%);

    /* Adjust shadows for dark mode */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial', 'Helvetica', sans-serif;
    background: var(--login-bg);
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-weight: 400;
    line-height: 1.6;
}

body.app-active {
    background: var(--bg-secondary);
}

/* Improve text rendering on mobile */
@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        font-size: 16px;
        line-height: 1.5;
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    /* Prevent text size adjustment on iOS */
    * {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}



.font-cairo {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, 'Arial', 'Helvetica', sans-serif;
}

/* ===== Login Screen ===== */
.login-screen {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    /* iOS Safari fix */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--login-bg);
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease;
}

/* Mobile login screen adjustments */
@media (max-width: 480px) {
    .login-screen {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .login-container {
        width: 100%;
        max-width: 100%;
    }
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s infinite linear;
    opacity: 0.5;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(-50px, -50px) rotate(360deg);
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.5s ease;
    transition: background-color 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-wrapper {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 120px;
}

.logo-wrapper img {
    max-width: 180px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    background: transparent;
}

.logo-wrapper img:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logo-wrapper i {
    display: inline-block;
    padding: 1.5rem;
    background: linear-gradient(135deg, #28408f63 0%, #764ba2 100%);
    border-radius: 50%;
    color: white;
    animation: pulse 2s infinite;
}

[data-theme="dark"] .logo-wrapper i {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ===== Form Styles ===== */
.form-input {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.form-input[type="password"] {
    padding-left: 2.5rem;
    padding-right: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

[data-theme="dark"] .form-input:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

/* ===== Password Toggle Button ===== */
.password-toggle-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    border-radius: 6px;
    z-index: 10;
}

.password-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.password-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.password-toggle-btn i {
    transition: transform 0.2s ease;
}

.password-toggle-btn:hover i {
    transform: scale(1.1);
}

[data-theme="dark"] .password-toggle-btn {
    color: var(--text-secondary);
}

[data-theme="dark"] .password-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ===== Buttons ===== */
.btn-primary {
    background: linear-gradient(135deg, #003865 0%, #004C8C 100%);
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 56, 101, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #004C8C 0%, #003865 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 56, 101, 0.3);
    color: #ffffff;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 56, 101, 0.25);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 56, 101, 0.3);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.875rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

[data-theme="dark"] .btn-secondary {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-light);
    color: var(--primary-light);
}

/* ===== Additional Button Variants ===== */
.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, var(--success-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    color: #ffffff;
}

.btn-success:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #991b1b 100%);
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(170, 54, 54, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #991b1b 0%, var(--danger-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(170, 54, 54, 0.3);
    color: #ffffff;
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(170, 54, 54, 0.25);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706 0%, var(--warning-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    color: #ffffff;
}

.btn-warning:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #0891b2 100%);
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.2);
}

.btn-info:hover {
    background: linear-gradient(135deg, #0891b2 0%, var(--info-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
    color: #ffffff;
}

.btn-info:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}

/* Button sizes */
.btn-sm {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

.btn-xs {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: 12px;
}

/* ===== Login Error Contact Info ===== */
.login-error-contact {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

.login-error-contact p {
    line-height: 1.6;
}

.login-error-contact a {
    transition: var(--transition);
    word-break: break-word;
}

.login-error-contact a:hover {
    text-decoration: underline;
}

[data-theme="dark"] .login-error-contact {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .login-error-contact p {
    color: var(--text-tertiary);
}

[data-theme="dark"] .login-error-contact a {
    color: var(--primary-light);
}

/* ===== Main App Layout ===== */
.main-app {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

.app-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    margin-right: var(--sidebar-width);
    background: var(--bg-secondary);
    transition: margin-right 0.3s ease;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* على الموبايل، إزالة margin-right */
@media (max-width: 1024px) {
    .app-shell {
        margin-right: 0 !important;
    }
}

/* إخفاء القائمة الجانبية على سطح المكتب عند إغلاقها */
@media (min-width: 1025px) {

    /* القائمة الجانبية مخفية افتراضياً إلا إذا كانت مفتوحة */
    .sidebar:not(.open) {
        transform: translateX(100%) !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    /* تعديل margin-right للـ app-shell بناءً على حالة القائمة */
    .app-shell {
        margin-right: 0 !important;
        transition: margin-right 0.3s ease;
    }

    /* عندما تكون القائمة مفتوحة، نضيف margin للـ app-shell */
    .sidebar.open~.app-shell {
        margin-right: var(--sidebar-width) !important;
    }

    /* إظهار زر القائمة على سطح المكتب */
    .mobile-topbar {
        display: flex !important;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .sidebar-toggle {
        display: inline-flex !important;
        z-index: 101;
    }

    /* إخفاء الـ overlay على سطح المكتب (يستخدم فقط على الموبايل) */
    .sidebar-overlay {
        display: none !important;
    }
}

/* ===== Sidebar ===== */
/* ألوان شعار الشركة: أزرق (#003865), أحمر (#C8102E), ذهبي (#FFC72C) */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #003865 0%, #004C8C 50%, #003865 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 20px rgba(0, 56, 101, 0.3);
    z-index: 1000;
    right: 0;
    top: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    border-left: 3px solid #FFC72C;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
}

/* User Profile */
.user-profile {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004C8C 0%, #003865 100%);
    border: 3px solid #FFC72C;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(255, 199, 44, 0.3);
    transition: transform 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 199, 44, 0.5);
}

.user-info {
    margin-top: 1rem;
}

.user-name {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.user-email {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Navigation */
.navigation {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 4px solid transparent;
    margin: 0.25rem 0.5rem;
    border-radius: 8px 0 0 8px;
    position: relative;
    overflow: hidden;
    min-height: 48px;
    /* Touch-friendly minimum height */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 199, 44, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

.nav-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 199, 44, 0.1);
    transition: width 0.3s ease;
}

.nav-item:hover::before,
.nav-item.active::before {
    width: 100%;
}

.nav-item i {
    width: 24px;
    margin-left: 1rem;
    font-size: 1.125rem;
    transition: transform 0.3s ease, color 0.3s ease;
    color: rgba(255, 255, 255, 0.9);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-right-color: #FFC72C;
    transform: translateX(-3px);
}

.nav-item:hover i {
    transform: scale(1.1);
    color: #FFC72C;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255, 199, 44, 0.2) 0%, rgba(255, 199, 44, 0.05) 100%);
    color: white;
    border-right-color: #FFC72C;
    font-weight: 600;
    box-shadow: -2px 0 10px rgba(255, 199, 44, 0.3);
}

.nav-item.active i {
    color: #FFC72C;
    transform: scale(1.1);
}

/* Logout Button */
.logout-btn {
    padding: 1rem 1.5rem;
    background: rgba(200, 16, 46, 0.15);
    color: #ffffff;
    border: none;
    border-top: 2px solid rgba(255, 199, 44, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    margin: 0.5rem;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.logout-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(200, 16, 46, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.logout-btn:hover::before {
    width: 300px;
    height: 300px;
}

.logout-btn i {
    margin-left: 0.75rem;
    position: relative;
    z-index: 1;
}

.logout-btn span {
    position: relative;
    z-index: 1;
}

.logout-btn:hover {
    background: rgba(200, 16, 46, 0.25);
    color: #FFC72C;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.4);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--bg-secondary);
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    transition: background-color 0.3s ease;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative;
    margin-right: 0;
    margin-left: 0;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    touch-action: none;
    will-change: opacity;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Prevent body scroll when sidebar is open on mobile */
@media (max-width: 1024px) {
    body.sidebar-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
    }

    body.sidebar-open .app-shell {
        overflow: hidden;
    }
}

.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: calc(0.9rem + env(safe-area-inset-top) / 2) 1.25rem;
    padding-top: calc(0.9rem + env(safe-area-inset-top));
    box-shadow: var(--shadow-md);
    align-items: center;
    gap: 1rem;
    min-height: 60px;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #003865 0%, #004C8C 100%);
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 56, 101, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.sidebar-toggle:active {
    transform: translateY(0) scale(0.95);
}

.sidebar-toggle:focus {
    outline: 2px solid rgba(255, 199, 44, 0.5);
    outline-offset: 2px;
}

.mobile-topbar-title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    text-align: right;
}

#mobile-company-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-user-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
}

.mobile-topbar-actions {
    display: none;
    align-items: center;
    gap: 0.75rem;
}

.mobile-icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-icon-btn:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mobile-icon-btn:active {
    transform: translateY(0) scale(0.95);
}

.mobile-icon-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.mobile-icon-btn.has-notifications {
    color: var(--danger-color);
    border-color: rgba(200, 16, 46, 0.35);
}

.header-notifications-btn.has-notifications,
.notifications-btn.has-notifications {
    color: var(--danger-color);
}

.mobile-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--danger-color);
    color: white;
    border-radius: 9999px;
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Body scroll lock handled in media query below */

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.section-header {
    margin-bottom: 2rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Navigation Icons Container */
.navigation-icons-container {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    z-index: 1000;
    flex-shrink: 0;
}

/* Main Menu Icon (القائمة الرئيسية) */
.main-menu-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: none;
    font-size: 1.25rem;
    flex-shrink: 0;
    position: relative;
    padding: 0;
    margin: 0;
}

.main-menu-icon i {
    font-size: 1.25rem;
}

.main-menu-icon:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.main-menu-icon:active {
    transform: translateY(0) scale(0.95);
    box-shadow: var(--shadow-sm);
}

.main-menu-icon:focus {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    outline-offset: 2px;
}

[data-theme="dark"] .main-menu-icon {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
}

[data-theme="dark"] .main-menu-icon:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

/* Back Menu Icon (العودة للقائمة السابقة) */
.back-menu-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border-color) !important;
    font-size: 1.25rem !important;
    flex-shrink: 0 !important;
    position: relative !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

.back-menu-icon i {
    font-size: 1.25rem;
}

.back-menu-icon:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.back-menu-icon:active {
    transform: translateY(0) scale(0.95);
    box-shadow: var(--shadow-sm);
}

.back-menu-icon:focus {
    outline: 2px solid rgba(37, 99, 235, 0.5);
    outline-offset: 2px;
}

[data-theme="dark"] .back-menu-icon {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .back-menu-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-light);
}

/* Back/Home Icon Button (Legacy - للتوافق مع الكود القديم) */
.back-home-icon {
    position: absolute;
    right: 0;
    top: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: none;
    z-index: 10;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.back-home-icon i {
    font-size: 1.25rem;
}

.back-home-icon:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.back-home-icon:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .back-home-icon {
    background: var(--primary-light);
}

[data-theme="dark"] .back-home-icon:hover {
    background: var(--primary-color);
}

/* Responsive Back Icon */
@media (max-width: 768px) {
    .back-home-icon {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .back-home-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .section-header {
        padding-right: 0;
    }
}

/* Adjust section-title when navigation icons are present */
.section-header:has(.navigation-icons-container) .section-title,
.section-header:has(.back-home-icon) .section-title {
    padding-right: 110px;
    /* مساحة لاثنين من الأيقونات + الفجوة */
}

@media (max-width: 768px) {

    .section-header:has(.navigation-icons-container) .section-title,
    .section-header:has(.back-home-icon) .section-title {
        padding-right: 104px;
    }

    .main-menu-icon,
    .back-menu-icon {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {

    .section-header:has(.navigation-icons-container) .section-title,
    .section-header:has(.back-home-icon) .section-title {
        padding-right: 98px;
    }

    .main-menu-icon,
    .back-menu-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        border-radius: 8px;
    }

    .navigation-icons-container {
        gap: 0.375rem;
    }
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    letter-spacing: -0.01em;
}

[data-theme="dark"] .section-title {
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    transition: color 0.3s ease;
    margin-top: 0.25rem;
    line-height: 1.5;
    font-weight: 500;
}

[data-theme="dark"] .section-subtitle {
    color: var(--text-secondary);
}

/* Responsive section titles */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.5rem;
        line-height: 1.4;
    }

    .section-subtitle {
        font-size: 0.9375rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 1.375rem;
        line-height: 1.4;
    }

    .section-subtitle {
        font-size: 0.875rem;
        line-height: 1.5;
    }
}

.section-content {
    padding: 1.5rem 0;
    animation: fadeIn 0.3s ease;
}

.section-content .content-card {
    margin-bottom: 1.5rem;
}

.section-content .content-card:last-child {
    margin-bottom: 0;
}

.section-subtitle:lang(en) {
    color: #2563eb;
    font-weight: 500;
}

/* ===== KPI Cards ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Base KPI Card Style - Applies to all kpi-card elements */
.kpi-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

/* Override for cards with kpi- prefix classes (kpi-danger, kpi-success, etc.) */
/* These have higher specificity and will override the legacy styles below */

/* Subtle background colors for each KPI card type */
.kpi-card.kpi-primary {
    background: linear-gradient(135deg, rgba(0, 56, 101, 0.03) 0%, rgba(0, 76, 140, 0.05) 100%);
}

.kpi-card.kpi-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.03) 0%, rgba(5, 150, 105, 0.05) 100%);
}

.kpi-card.kpi-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.03) 0%, rgba(217, 119, 6, 0.05) 100%);
}

.kpi-card.kpi-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.03) 0%, rgba(8, 145, 178, 0.05) 100%);
}

.kpi-card.kpi-danger {
    background: linear-gradient(135deg, rgba(170, 54, 54, 0.03) 0%, rgba(153, 27, 27, 0.05) 100%);
}

.kpi-card.kpi-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(124, 58, 237, 0.05) 100%);
}

[data-theme="dark"] .kpi-card.kpi-primary {
    background: linear-gradient(135deg, rgba(0, 56, 101, 0.15) 0%, rgba(0, 76, 140, 0.2) 100%);
}

[data-theme="dark"] .kpi-card.kpi-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.2) 100%);
}

[data-theme="dark"] .kpi-card.kpi-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.2) 100%);
}

[data-theme="dark"] .kpi-card.kpi-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(8, 145, 178, 0.2) 100%);
}

[data-theme="dark"] .kpi-card.kpi-danger {
    background: linear-gradient(135deg, rgba(170, 54, 54, 0.15) 0%, rgba(153, 27, 27, 0.2) 100%);
}

[data-theme="dark"] .kpi-card.kpi-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(124, 58, 237, 0.2) 100%);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: var(--primary-color);
    z-index: 1;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

/* KPI Card Color Variants - Border */
.kpi-card.kpi-primary::before {
    background: linear-gradient(180deg, #003865 0%, #004C8C 100%);
    width: 5px;
    box-shadow: 0 0 10px rgba(0, 56, 101, 0.3);
}

.kpi-card.kpi-primary:hover {
    border-color: #003865;
    box-shadow: 0 8px 20px rgba(0, 56, 101, 0.25);
}

.kpi-card.kpi-success::before {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    width: 5px;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.kpi-card.kpi-success:hover {
    border-color: #10b981;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.kpi-card.kpi-warning::before {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    width: 5px;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.kpi-card.kpi-warning:hover {
    border-color: #f59e0b;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
}

.kpi-card.kpi-info::before {
    background: linear-gradient(180deg, #06b6d4 0%, #0891b2 100%);
    width: 5px;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.kpi-card.kpi-info:hover {
    border-color: #06b6d4;
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.25);
}

.kpi-card.kpi-danger::before {
    background: linear-gradient(180deg, #aa3636 0%, #991b1b 100%);
    width: 5px;
    box-shadow: 0 0 10px rgba(170, 54, 54, 0.3);
}

.kpi-card.kpi-danger:hover {
    border-color: #aa3636;
    box-shadow: 0 8px 20px rgba(170, 54, 54, 0.25);
}

.kpi-card.kpi-purple::before {
    background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
    width: 5px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.kpi-card.kpi-purple:hover {
    border-color: #8b5cf6;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25);
}

/* KPI Icon - تم نقل التعريفات المحسّنة إلى الأسفل مع vendor prefixes */
/* التعريفات القديمة تم استبدالها بالتعريفات الجديدة المحسّنة في السطر 8000 */

.kpi-content {
    flex: 1;
    position: relative;
    z-index: 2;
}

.kpi-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
}

/* KPI Label Colors by Type */
.kpi-primary .kpi-label {
    color: #003865;
    font-weight: 700;
}

.kpi-success .kpi-label {
    color: #059669;
    font-weight: 700;
}

.kpi-warning .kpi-label {
    color: #d97706;
    font-weight: 700;
}

.kpi-info .kpi-label {
    color: #0891b2;
    font-weight: 700;
}

.kpi-danger .kpi-label {
    color: #aa3636;
    font-weight: 700;
}

.kpi-purple .kpi-label {
    color: #7c3aed;
    font-weight: 700;
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    transition: color 0.3s ease;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Cairo', sans-serif;
}

/* KPI Value Colors by Type */
.kpi-primary .kpi-value {
    color: #003865;
    text-shadow: 0 2px 6px rgba(0, 56, 101, 0.2);
}

.kpi-success .kpi-value {
    color: #059669;
    text-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.kpi-warning .kpi-value {
    color: #d97706;
    text-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.kpi-info .kpi-value {
    color: #0891b2;
    text-shadow: 0 2px 6px rgba(6, 182, 212, 0.2);
}

.kpi-danger .kpi-value {
    color: #aa3636;
    text-shadow: 0 2px 6px rgba(170, 54, 54, 0.2);
}

.kpi-purple .kpi-value {
    color: #7c3aed;
    text-shadow: 0 2px 6px rgba(139, 92, 246, 0.2);
}

.kpi-description {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* KPI Description Colors by Type */
.kpi-primary .kpi-description {
    color: #4b5563;
    font-weight: 600;
}

.kpi-success .kpi-description {
    color: #4b5563;
    font-weight: 600;
}

.kpi-warning .kpi-description {
    color: #4b5563;
    font-weight: 600;
}

.kpi-info .kpi-description {
    color: #4b5563;
    font-weight: 600;
}

.kpi-danger .kpi-description {
    color: #4b5563;
    font-weight: 600;
}

.kpi-purple .kpi-description {
    color: #4b5563;
    font-weight: 600;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .kpi-label {
    color: var(--text-secondary);
}

[data-theme="dark"] .kpi-primary .kpi-label {
    color: #60a5fa;
}

[data-theme="dark"] .kpi-success .kpi-label {
    color: #34d399;
}

[data-theme="dark"] .kpi-warning .kpi-label {
    color: #fbbf24;
}

[data-theme="dark"] .kpi-info .kpi-label {
    color: #22d3ee;
}

[data-theme="dark"] .kpi-danger .kpi-label {
    color: #f87171;
}

[data-theme="dark"] .kpi-purple .kpi-label {
    color: #a78bfa;
}

[data-theme="dark"] .kpi-value {
    color: var(--text-primary);
}

[data-theme="dark"] .kpi-primary .kpi-value {
    color: #60a5fa;
}

[data-theme="dark"] .kpi-success .kpi-value {
    color: #34d399;
}

[data-theme="dark"] .kpi-warning .kpi-value {
    color: #fbbf24;
}

[data-theme="dark"] .kpi-info .kpi-value {
    color: #22d3ee;
}

[data-theme="dark"] .kpi-danger .kpi-value {
    color: #f87171;
}

[data-theme="dark"] .kpi-purple .kpi-value {
    color: #a78bfa;
}

[data-theme="dark"] .kpi-description {
    color: var(--text-tertiary);
}

/* Safety Metrics Cards - Enhanced styling to match previous design */
/* These styles override the base kpi-card styles for safety metrics cards */
/* استخدام selector أكثر تحديداً لضمان الأولوية */
.content-card .kpi-card.kpi-danger,
.section-content .kpi-card.kpi-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%) !important;
    border: 1px solid #fecaca !important;
    border-radius: 0.5rem !important;
}

.content-card .kpi-card.kpi-warning,
.section-content .kpi-card.kpi-warning {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%) !important;
    border: 1px solid #fed7aa !important;
    border-radius: 0.5rem !important;
}

.content-card .kpi-card.kpi-info,
.section-content .kpi-card.kpi-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 0.5rem !important;
}

.content-card .kpi-card.kpi-purple,
.section-content .kpi-card.kpi-purple {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%) !important;
    border: 1px solid #ddd6fe !important;
    border-radius: 0.5rem !important;
}

/* Override kpi-card default styles for safety metrics cards */
.content-card .kpi-card.kpi-danger::before,
.content-card .kpi-card.kpi-warning::before,
.content-card .kpi-card.kpi-info::before,
.content-card .kpi-card.kpi-purple::before,
.section-content .kpi-card.kpi-danger::before,
.section-content .kpi-card.kpi-warning::before,
.section-content .kpi-card.kpi-info::before,
.section-content .kpi-card.kpi-purple::before {
    display: none !important;
}

.content-card .kpi-card.kpi-danger::after,
.content-card .kpi-card.kpi-warning::after,
.content-card .kpi-card.kpi-info::after,
.content-card .kpi-card.kpi-purple::after,
.section-content .kpi-card.kpi-danger::after,
.section-content .kpi-card.kpi-warning::after,
.section-content .kpi-card.kpi-info::after,
.section-content .kpi-card.kpi-purple::after {
    display: none !important;
}

[data-theme="dark"] .content-card .kpi-card.kpi-danger,
[data-theme="dark"] .section-content .kpi-card.kpi-danger {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.2) 0%, rgba(153, 27, 27, 0.25) 100%) !important;
    border: 1px solid rgba(185, 28, 28, 0.3) !important;
}

[data-theme="dark"] .content-card .kpi-card.kpi-warning,
[data-theme="dark"] .section-content .kpi-card.kpi-warning {
    background: linear-gradient(135deg, rgba(146, 64, 14, 0.2) 0%, rgba(154, 52, 18, 0.25) 100%) !important;
    border: 1px solid rgba(217, 119, 6, 0.3) !important;
}

[data-theme="dark"] .content-card .kpi-card.kpi-info,
[data-theme="dark"] .section-content .kpi-card.kpi-info {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.2) 0%, rgba(29, 78, 216, 0.25) 100%) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

[data-theme="dark"] .content-card .kpi-card.kpi-purple,
[data-theme="dark"] .section-content .kpi-card.kpi-purple {
    background: linear-gradient(135deg, rgba(107, 33, 168, 0.2) 0%, rgba(124, 58, 237, 0.25) 100%) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

/* Clinic Cards - Enhanced styling */
.content-card .w-12.h-12.rounded-xl {
    transition: all 0.3s ease;
}

.content-card:hover .w-12.h-12.rounded-xl {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== Content Cards ===== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.content-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Activity List ===== */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.activity-item:hover {
    background: var(--bg-tertiary);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
    font-size: 1rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    transition: color 0.3s ease;
}

.activity-time {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-item {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-content .stat-value {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.stat-content .stat-label {
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* ===== Stats Cards Grid (Reports Widget) - Square Cards Design ===== */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* الكروت المربعة */
.stats-cards-grid .square-stat-card {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
}

/* Mobile First - Small Screens */
@media (max-width: 479px) {
    .stats-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stats-cards-grid .square-stat-card {
        padding: 1rem 0.875rem;
        border-radius: 16px;
    }
    
    .stats-cards-grid .stat-card-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.25rem !important;
    }
    
    .stats-cards-grid .stat-card-value {
        font-size: 1.5rem !important;
    }
    
    .stats-cards-grid .stat-card-label {
        font-size: 0.75rem !important;
    }
}

/* Small Tablets */
@media (min-width: 480px) and (max-width: 767px) {
    .stats-cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.875rem;
    }
    
    .stats-cards-grid .square-stat-card {
        padding: 1.25rem 1rem;
    }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1023px) {
    .stats-cards-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
    
    .stats-cards-grid .square-stat-card {
        padding: 1.5rem 1.25rem;
    }
}

/* Desktop - عرض أفقي (صف واحد) */
@media (min-width: 1024px) {
    .stats-cards-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 1rem;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
        padding-bottom: 0.5rem;
    }
    
    .stats-cards-grid::-webkit-scrollbar {
        height: 8px;
    }
    
    .stats-cards-grid::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 4px;
    }
    
    .stats-cards-grid::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }
    
    .stats-cards-grid::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }
    
    .stats-cards-grid .square-stat-card {
        flex: 0 0 auto;
        min-width: 140px;
        max-width: 180px;
        width: 140px;
        padding: 1.5rem 1.25rem;
    }
}

/* Large Desktop */
@media (min-width: 1280px) {
    .stats-cards-grid .square-stat-card {
        min-width: 160px;
        max-width: 200px;
        width: 160px;
        padding: 1.75rem 1.5rem;
    }
}

/* Extra Large Desktop */
@media (min-width: 1600px) {
    .stats-cards-grid .square-stat-card {
        min-width: 180px;
        max-width: 220px;
        width: 180px;
        padding: 2rem 1.75rem;
    }
    
    .stats-cards-grid .stat-card-icon {
        width: 64px !important;
        height: 64px !important;
        font-size: 1.75rem !important;
    }
    
    .stats-cards-grid .stat-card-value {
        font-size: 2.25rem !important;
    }
}

/* Ultra Wide Screens */
@media (min-width: 1920px) {
    .stats-cards-grid .square-stat-card {
        min-width: 200px;
        max-width: 240px;
        width: 200px;
        padding: 2.25rem 2rem;
    }
}

/* ضمان عرض صحيح في جميع الأحجام */
.stats-cards-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stats-cards-grid .stat-card,
.stats-cards-grid .enhanced-stat-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* تحسين عرض الأرقام في الكروت */
.stat-value-number,
.stat-card-value {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    direction: ltr;
    text-align: center;
    display: inline-block;
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* تحسينات للكروت المحسّنة */
.stats-cards-grid .enhanced-stat-card {
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animations للكروت المحسّنة */
@keyframes fadeInUpStatCard {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* تأثيرات Hover للكروت المحسّنة */
.stats-cards-grid .enhanced-stat-card:hover {
    transform: translateY(-12px) scale(1.03) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

.stats-cards-grid .enhanced-stat-card:hover .stat-card-top-bar {
    height: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.stats-cards-grid .enhanced-stat-card:hover .stat-card-icon {
    transform: scale(1.15) rotate(5deg) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.stats-cards-grid .enhanced-stat-card:hover .icon-shine {
    transform: rotate(225deg) translate(100%, 100%) !important;
}

.stats-cards-grid .enhanced-stat-card:hover .stat-card-hover-effect {
    width: 300px !important;
    height: 300px !important;
    opacity: 0.3 !important;
}

.stats-cards-grid .enhanced-stat-card:hover .stat-card-bg-pattern {
    opacity: 0.2 !important;
}

.stats-cards-grid .enhanced-stat-card:active {
    transform: translateY(-8px) scale(1.01) !important;
}

.stats-cards-grid .enhanced-stat-card:active .stat-card-touch-effect {
    opacity: 0.1 !important;
}

/* تحسينات للشاشات اللمسية */
@media (hover: none) and (pointer: coarse) {
    .stats-cards-grid .enhanced-stat-card:active {
        transform: translateY(-4px) scale(1.01) !important;
    }
    
    .stats-cards-grid .enhanced-stat-card:hover {
        transform: translateY(-6px) scale(1.02) !important;
    }
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 768px) {
    .stats-cards-grid .enhanced-stat-card:hover {
        transform: translateY(-6px) scale(1.02) !important;
    }
}

@media (max-width: 480px) {
    .stats-cards-grid .enhanced-stat-card:hover {
        transform: translateY(-4px) scale(1.01) !important;
    }
}

/* لشاشات كبيرة جداً، حد أقصى 7 أعمدة */
@media (min-width: 1600px) {
    .stats-cards-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 1.25rem;
    }
}

/* Stat Card Styles for Reports Widget - Scoped to stats-cards-grid */
.stats-cards-grid .stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    min-height: 140px;
    min-width: 0;
    /* يسمح للكارت بالانكماش بشكل صحيح */
    position: relative;
    overflow: hidden;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* تحسينات للأداء لمنع الاهتزاز */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* تم إزالة hover effects من CSS - يتم التعامل معها من خلال JavaScript فقط لتجنب التضارب والاهتزاز */

.stats-cards-grid .stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.stats-cards-grid .stat-card-top-bar {
    transition: height 0.3s ease;
}

.stats-cards-grid .stat-card-label {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.4em;
    line-height: 1.2;
}

.stats-cards-grid .stat-card-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* تم إزالة hover effect للآيقونة - يتم التعامل معه من خلال JavaScript لتجنب التضارب */

.stats-cards-grid .stat-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    /* يسمح بالانكماش بشكل صحيح */
    box-sizing: border-box;
}

.stats-cards-grid .stat-card-value {
    /* Fallback للمتصفحات التي لا تدعم clamp() */
    font-size: 1.75rem;
    /* حجم خط متجاوب - المتصفحات الحديثة ستستخدم هذه القيمة */
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

/* تحسين حجم الخط للشاشات الكبيرة */
@media (min-width: 1280px) and (max-width: 1399px) {
    .stats-cards-grid .stat-card {
        padding: 1.125rem 0.875rem;
        min-height: 130px;
    }

    .stats-cards-grid .stat-card-value {
        font-size: 1.75rem;
    }

    .stats-cards-grid .stat-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
}

@media (min-width: 1400px) and (max-width: 1599px) {
    .stats-cards-grid .stat-card {
        padding: 1.25rem 1rem;
        min-height: 135px;
    }

    .stats-cards-grid .stat-card-value {
        font-size: 1.875rem;
    }
}

@media (min-width: 1600px) {
    .stats-cards-grid .stat-card {
        padding: 1.25rem 0.875rem;
        min-height: 140px;
    }

    .stats-cards-grid .stat-card-value {
        font-size: 1.75rem;
        /* حجم أصغر قليلاً لعرض 7 أعمدة */
    }

    .stats-cards-grid .stat-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .stats-cards-grid .stat-card-label {
        font-size: 0.8125rem;
    }
}

.stats-cards-grid .stat-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

/* Stat Card Color Variants */
.stats-cards-grid .stat-card-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.stats-cards-grid .stat-card-red::before {
    background: #ef4444;
}

.stats-cards-grid .stat-card-red .stat-card-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.stats-cards-grid .stat-card-red .stat-card-value {
    color: #dc2626;
}

.stats-cards-grid .stat-card-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.stats-cards-grid .stat-card-blue::before {
    background: #3b82f6;
}

.stats-cards-grid .stat-card-blue .stat-card-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.stats-cards-grid .stat-card-blue .stat-card-value {
    color: #2563eb;
}

.stats-cards-grid .stat-card-green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-color: rgba(34, 197, 94, 0.2);
}

.stats-cards-grid .stat-card-green::before {
    background: #22c55e;
}

.stats-cards-grid .stat-card-green .stat-card-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.stats-cards-grid .stat-card-green .stat-card-value {
    color: #16a34a;
}

.stats-cards-grid .stat-card-yellow {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.05) 100%);
    border-color: rgba(234, 179, 8, 0.2);
}

.stats-cards-grid .stat-card-yellow::before {
    background: #eab308;
}

.stats-cards-grid .stat-card-yellow .stat-card-icon {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}

.stats-cards-grid .stat-card-yellow .stat-card-value {
    color: #ca8a04;
}

.stats-cards-grid .stat-card-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-color: rgba(139, 92, 246, 0.2);
}

.stats-cards-grid .stat-card-purple::before {
    background: #8b5cf6;
}

.stats-cards-grid .stat-card-purple .stat-card-icon {
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
}

.stats-cards-grid .stat-card-purple .stat-card-value {
    color: #7c3aed;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .stats-cards-grid .stat-card-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.08) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .stats-cards-grid .stat-card-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.08) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .stats-cards-grid .stat-card-green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.08) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .stats-cards-grid .stat-card-yellow {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(234, 179, 8, 0.08) 100%);
    border-color: rgba(234, 179, 8, 0.3);
}

[data-theme="dark"] .stats-cards-grid .stat-card-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-color: rgba(139, 92, 246, 0.3);
}

/* Responsive Adjustments for Stat Cards */
@media (max-width: 480px) {
    .stats-cards-grid .stat-card {
        padding: 1rem;
        min-height: 120px;
    }

    .stats-cards-grid .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .stats-cards-grid .stat-card-value {
        font-size: 1.75rem;
    }

    .stats-cards-grid .stat-card-label {
        font-size: 0.8125rem;
    }
}

/* ===== Enhanced Reports Widget Styles ===== */
.reports-widget-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.reports-widget-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* تم إزالة animation لتحسين الأداء */

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    }
}

/* Animations for Reports Widget */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Skeleton Loader Styles */
.skeleton-icon,
.skeleton-text {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton-icon,
[data-theme="dark"] .skeleton-text {
    background: linear-gradient(90deg, #2d2d2d 25%, #3a3a3a 50%, #2d2d2d 75%);
    background-size: 200% 100%;
}

/* Reports Stat Card Enhancements */
.reports-stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

/* إزالة hover effect من CSS لتجنب التضارب مع JavaScript */
.reports-stat-card {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* تم إزالة hover effect - يتم التعامل معه من خلال JavaScript فقط لتجنب التضارب والاهتزاز */

.reports-stat-card .stat-card-hover-effect {
    transition: width 0.6s ease, height 0.6s ease;
}

/* Refresh Button Animation */
.reports-refresh-btn {
    transition: all 0.3s ease;
}

.reports-refresh-btn:hover {
    background: var(--bg-tertiary);
    transform: rotate(180deg);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.reports-refresh-btn:hover i {
    color: var(--primary-color);
}

.reports-refresh-btn:active {
    transform: scale(0.95);
}

/* Report Export Buttons */
.report-export-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.report-export-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    opacity: 0;
}

.report-export-btn:hover::before {
    width: 200px;
    height: 200px;
    opacity: 1;
}

.report-export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.report-export-btn-incidents:hover {
    border-color: rgba(220, 38, 38, 0.4) !important;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.15) 100%) !important;
}

.report-export-btn-training:hover {
    border-color: rgba(37, 99, 235, 0.4) !important;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.15) 100%) !important;
}

.report-export-btn-full:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.report-export-btn:active {
    transform: translateY(0);
}

/* Grid for export buttons */
.reports-export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    .reports-export-grid {
        grid-template-columns: 1fr;
    }
}

/* Medication Alert Items */
.medication-alert-item {
    transition: all 0.3s ease;
}

.medication-alert-item:hover {
    transform: translateX(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Reports Actions Section */
.reports-actions-section {
    animation: fadeInUp 0.6s ease 0.3s backwards;
}

/* Medications Alerts Section */
.medications-alerts-section {
    animation: fadeInUp 0.6s ease 0.4s backwards;
}

/* Responsive Adjustments for Reports Widget */
@media (max-width: 768px) {
    .reports-widget-card .card-header {
        padding: 2rem 1.5rem !important;
    }

    .reports-widget-card .card-header h2 {
        font-size: 1.75rem !important;
    }

    .reports-widget-card .card-header .reports-icon-wrapper {
        width: 60px !important;
        height: 60px !important;
    }

    .reports-widget-card .card-header .reports-icon-wrapper i {
        font-size: 1.75rem !important;
    }

    .reports-widget-card .card-body {
        padding: 2.5rem 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .stats-cards-grid {
        gap: 1rem !important;
        margin-bottom: 2.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .reports-stat-card {
        min-height: 150px !important;
        padding: 1.25rem 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .reports-stat-card .stat-card-icon {
        width: 52px !important;
        height: 52px !important;
        font-size: 1.4rem !important;
        margin-top: 0.625rem !important;
    }

    .reports-stat-card .stat-card-value {
        font-size: 2rem !important;
    }

    .reports-stat-card .stat-card-label {
        font-size: 0.8125rem !important;
    }

    .report-export-btn {
        padding: 1.25rem 1.5rem !important;
        font-size: 1rem !important;
    }

    .reports-actions-section {
        padding: 2.5rem 1.5rem !important;
        margin-top: 2.5rem !important;
    }

    .reports-actions-section h3 {
        font-size: 1.25rem !important;
        margin-bottom: 1.75rem !important;
    }
}

@media (max-width: 480px) {
    .reports-widget-card .card-header {
        padding: 1.75rem 1.25rem !important;
    }

    .reports-widget-card .card-header h2 {
        font-size: 1.5rem !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .reports-widget-card .card-header h2 span:last-child {
        font-size: 0.875rem !important;
    }

    .reports-widget-card .card-body {
        padding: 2rem 1.25rem !important;
    }

    .reports-icon-wrapper {
        width: 56px !important;
        height: 56px !important;
    }

    .reports-icon-wrapper i {
        font-size: 1.5rem !important;
    }

    .stats-cards-grid {
        gap: 0.875rem !important;
        margin-bottom: 2rem !important;
    }

    .reports-stat-card {
        min-height: 140px !important;
        padding: 1.125rem 0.875rem !important;
    }

    .reports-stat-card .stat-card-icon {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.3rem !important;
        margin-top: 0.5rem !important;
    }

    .reports-stat-card .stat-card-value {
        font-size: 1.75rem !important;
    }

    .reports-stat-card .stat-card-label {
        font-size: 0.75rem !important;
        line-height: 1.3 !important;
        max-height: 2.6em !important;
        padding: 0 0.25rem !important;
    }

    .report-export-btn {
        padding: 1.125rem 1.25rem !important;
        font-size: 0.9375rem !important;
        flex-direction: column;
        gap: 0.625rem;
    }

    .reports-actions-section {
        padding: 2rem 1.25rem !important;
        margin-top: 2rem !important;
    }

    .reports-actions-section h3 {
        font-size: 1.125rem !important;
        margin-bottom: 1.5rem !important;
    }

    .medication-alert-item {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .medication-alert-item .badge {
        margin-right: 0;
        align-self: flex-end;
    }
}

/* Dark Mode Adjustments for Reports Widget */
/* تحسينات إضافية للشاشات الكبيرة جداً */
/* تحسينات إضافية للشاشات الكبيرة - منع overflow */
@media (min-width: 1280px) {
    .reports-widget-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .reports-widget-card .card-body {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .stats-cards-grid {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .stats-cards-grid .stat-card {
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
}

[data-theme="dark"] .reports-widget-bg {
    opacity: 0.05;
}

[data-theme="dark"] .reports-refresh-btn {
    border-color: var(--border-color);
    background: var(--bg-tertiary);
}

[data-theme="dark"] .reports-refresh-btn:hover {
    background: var(--bg-secondary);
}

[data-theme="dark"] .report-export-btn {
    border-color: var(--border-color);
    background: var(--card-bg);
}

[data-theme="dark"] .report-export-btn:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .medication-alert-item {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .medication-alert-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

/* ===== Tabs ===== */
.tabs-container {
    margin-bottom: 1.5rem;
}

.tabs-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 12px 12px 0 0;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    padding: 0.875rem 1.75rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    font-family: 'Cairo', sans-serif;
    border-radius: 8px 8px 0 0;
    position: relative;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--bg-tertiary);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.tab-btn.active::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.tab-btn i {
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تحسينات خاصة لتبويبات قسم الطوارئ */
#emergency-section .tabs-nav {
    margin-bottom: 0;
}

#emergency-section .tab-content {
    padding-top: 1.5rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

/* ===== Notifications ===== */
.notification-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 450px;
    width: calc(100vw - 2.5rem);
}

.notification {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-width: 300px;
    max-width: 100%;
    border-right: 4px solid;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(-100px);
    position: relative;
    overflow: hidden;
}

.notification.notification-visible {
    opacity: 1;
    transform: translateX(0);
    animation: slideInLeft 0.3s ease;
}

.notification.notification-dismissing {
    animation: slideOutLeft 0.3s ease;
    opacity: 0;
    transform: translateX(-100px);
}

/* ألوان الحدود حسب النوع */
.notification.notification-success {
    border-right-color: var(--success-color);
    background: linear-gradient(to left, rgba(34, 197, 94, 0.05), var(--card-bg));
}

.notification.notification-error {
    border-right-color: var(--danger-color);
    background: linear-gradient(to left, rgba(239, 68, 68, 0.05), var(--card-bg));
}

.notification.notification-warning {
    border-right-color: var(--warning-color);
    background: linear-gradient(to left, rgba(234, 179, 8, 0.05), var(--card-bg));
}

.notification.notification-info {
    border-right-color: var(--info-color);
    background: linear-gradient(to left, rgba(59, 130, 246, 0.05), var(--card-bg));
}

.notification.notification-emergency {
    border-right-color: #dc2626;
    background: linear-gradient(to left, rgba(220, 38, 38, 0.1), var(--card-bg));
    border-right-width: 6px;
}

/* تأثير النبض للتنبيهات الحرجة */
.notification-critical-pulse {
    animation: criticalPulse 2s ease-in-out infinite;
}

@keyframes criticalPulse {

    0%,
    100% {
        box-shadow: var(--shadow-xl);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2), var(--shadow-xl);
    }
}

/* الأولويات */
.notification-priority-critical {
    border-right-width: 6px;
    box-shadow: 0 10px 25px rgba(220, 38, 38, 0.3);
}

.notification-priority-high {
    border-right-width: 5px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* أيقونة الإشعار */
.notification-icon-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
}

.notification-icon {
    font-size: 1.5rem;
}

.notification.notification-success .notification-icon-wrapper {
    background: rgba(34, 197, 94, 0.1);
}

.notification.notification-success .notification-icon {
    color: var(--success-color);
}

.notification.notification-error .notification-icon-wrapper {
    background: rgba(239, 68, 68, 0.1);
}

.notification.notification-error .notification-icon {
    color: var(--danger-color);
}

.notification.notification-warning .notification-icon-wrapper {
    background: rgba(234, 179, 8, 0.1);
}

.notification.notification-warning .notification-icon {
    color: var(--warning-color);
}

.notification.notification-info .notification-icon-wrapper {
    background: rgba(59, 130, 246, 0.1);
}

.notification.notification-info .notification-icon {
    color: var(--info-color);
}

.notification.notification-emergency .notification-icon-wrapper {
    background: rgba(220, 38, 38, 0.15);
    animation: iconPulse 1.5s ease-in-out infinite;
}

.notification.notification-emergency .notification-icon {
    color: #dc2626;
    font-size: 1.75rem;
}

@keyframes iconPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* محتوى الإشعار */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.notification-message {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.notification-description {
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.5rem;
}

/* أزرار الإشعار */
.notification-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.notification-action {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.notification-action:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.notification-action-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.notification-action-primary:hover {
    background: var(--primary-color-dark, #2563eb);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.notification-action-secondary {
    background: transparent;
}

.notification-action-secondary:hover {
    background: var(--bg-secondary);
}

/* زر الإغلاق */
.notification-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    transform: scale(1.1);
}

/* تأثيرات الحركة */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-100px);
    }
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 640px) {
    .notification-container {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }

    .notification {
        min-width: auto;
        padding: 1rem;
    }

    .notification-actions {
        flex-direction: column;
    }

    .notification-action {
        width: 100%;
    }
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    text-align: center;
    color: white;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-width: 350px;
}

.loading-spinner i {
    color: #3b82f6;
    margin-bottom: 20px;
}

.loading-spinner .loading-message {
    color: #1f2937;
    font-weight: 600;
    font-size: 16px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.loading-progress-bar {
    width: 100%;
    max-width: 300px;
    height: 10px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 5px;
    margin: 20px auto 10px;
    overflow: hidden;
    position: relative;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb, #1d4ed8);
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.loading-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.loading-progress-text {
    text-align: center;
    color: #3b82f6;
    font-weight: bold;
    font-size: 20px;
    margin-top: 10px;
    font-family: 'Cairo', sans-serif;
}

/* ===== Improved Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card {
    animation: fadeInUp 0.5s ease backwards;
}

.kpi-card:nth-child(1) {
    animation-delay: 0s;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.1s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.2s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.3s;
}

.content-card {
    animation: fadeInUp 0.5s ease 0.2s backwards;
}

/* ===== Enhanced Hover Effects ===== */
.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1));
    transition: width 0.3s ease;
}

.nav-item:hover::before {
    width: 100%;
}

/* ===== Improved Card Shadows ===== */
.kpi-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-xl);
}

.content-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* ===== Responsive Design ===== */

/* ===== Large Tablets and Small Desktops (768px - 1024px) ===== */
@media (max-width: 1024px) and (min-width: 769px) {
    .app-shell {
        margin-right: 0 !important;
        width: 100%;
    }

    .sidebar {
        width: 280px;
        max-width: 85vw;
        transform: translateX(100%);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .sidebar-toggle {
        display: inline-flex;
        z-index: 101;
    }

    .mobile-topbar-actions {
        display: flex;
    }

    .main-content {
        padding: calc(4.75rem + env(safe-area-inset-top)) 1.5rem 2rem;
        width: 100%;
        margin-right: 0;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }

    .theme-toggle {
        display: none;
    }

    #company-logo-header {
        display: none !important;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .card-title {
        font-size: 1.125rem;
    }
}

/* ===== Tablets Portrait (481px - 768px) ===== */
@media (max-width: 768px) and (min-width: 481px) {
    .app-shell {
        margin-right: 0 !important;
        width: 100%;
    }

    .sidebar {
        width: 280px;
        max-width: 80vw;
        transform: translateX(100%);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .sidebar-toggle {
        display: inline-flex;
        width: 44px;
        height: 44px;
        z-index: 101;
    }

    .mobile-topbar-actions {
        display: flex;
    }

    .main-content {
        padding: calc(4.5rem + env(safe-area-inset-top)) 1.25rem 1.75rem;
        width: 100%;
        margin-right: 0;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .theme-toggle {
        display: none;
    }

    #company-logo-header {
        display: none !important;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .card-title {
        font-size: 1.125rem;
    }

    .kpi-value {
        font-size: 1.75rem;
    }

    .kpi-icon {
        width: 55px;
        height: 55px;
        font-size: 1.375rem;
    }

    /* Tables - Enable horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .table-wrapper::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        height: 100%;
        background: linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent);
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .data-table {
        min-width: 600px;
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Forms - Stack vertically */
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    /* Buttons - Touch friendly */
    .btn-primary,
    .btn-secondary {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }

    /* Login form buttons should be full width on mobile */
    .login-card .btn-primary,
    .login-card .btn-secondary {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Modals */
    .modal-content {
        max-width: 95vw;
        margin: 1rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem;
    }
}

/* ===== Mobile Phones Landscape (481px - 768px landscape) ===== */
@media (max-width: 768px) and (min-width: 481px) and (orientation: landscape) {
    .main-content {
        padding: calc(3.5rem + env(safe-area-inset-top)) 1.25rem 1.5rem;
    }

    .mobile-topbar {
        padding: calc(0.75rem + env(safe-area-inset-top) / 2) 1.25rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.875rem;
    }

    .kpi-card {
        padding: 1.25rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }
}

/* ===== Mobile Phones Portrait (320px - 480px) ===== */
@media (max-width: 480px) {
    .app-shell {
        margin-right: 0 !important;
        width: 100%;
        overflow-x: hidden;
    }

    .sidebar {
        width: 85%;
        max-width: 320px;
        min-width: 280px;
        transform: translateX(100%);
        z-index: 1000;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
        padding: calc(0.8rem + env(safe-area-inset-top) / 2) 1rem;
        padding-top: calc(0.8rem + env(safe-area-inset-top));
        position: sticky;
        top: 0;
        z-index: 100;
        width: 100%;
    }

    .sidebar-toggle {
        display: inline-flex;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        z-index: 101;
        flex-shrink: 0;
    }

    .mobile-topbar-actions {
        display: flex;
        flex-shrink: 0;
    }

    .mobile-icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .main-content {
        padding: calc(4.5rem + env(safe-area-inset-top)) 1rem 1.5rem;
        width: 100%;
        margin-right: 0;
        overflow-x: hidden;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .theme-toggle {
        display: none;
    }

    #company-logo-header {
        display: none !important;
    }

    /* تحسين عرض القائمة الجانبية على الموبايل */
    .sidebar {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .navigation {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* منع التمرير الأفقي غير المرغوب فيه */
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
        max-width: 100vw;
    }

    .main-app,
    .app-shell,
    .main-content {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* منع التمرير الأفقي في جميع العناصر */
    img,
    video,
    iframe,
    embed,
    object {
        max-width: 100%;
        height: auto;
    }

    /* تحسين عرض الجداول */
    .table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Typography */
    .section-title {
        font-size: 1.375rem;
        margin-bottom: 0.75rem;
    }

    .section-subtitle {
        font-size: 0.875rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .kpi-value {
        font-size: 1.75rem;
    }

    .kpi-label {
        font-size: 0.8125rem;
    }

    .kpi-description {
        font-size: 0.6875rem;
    }

    .kpi-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
        margin-left: 0.75rem;
    }

    .kpi-card {
        padding: 1.25rem;
    }

    /* Login Screen */
    .login-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
        border-radius: 16px;
    }

    .login-container {
        padding: 0;
    }

    #login-title {
        font-size: 1.5rem;
    }

    /* Tables - Full width horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
        position: relative;
    }

    .table-wrapper::before,
    .table-wrapper::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        pointer-events: none;
        z-index: 1;
    }

    .table-wrapper::before {
        right: 0;
        background: linear-gradient(to right, var(--bg-secondary), transparent);
    }

    .table-wrapper::after {
        left: 0;
        background: linear-gradient(to left, var(--bg-secondary), transparent);
    }

    .data-table {
        min-width: 100%;
        font-size: 0.8125rem;
        border-radius: 0;
    }

    .data-table th,
    .data-table td {
        padding: 0.625rem 0.5rem;
        white-space: nowrap;
        font-size: 0.8125rem;
    }

    .data-table th {
        font-size: 0.75rem;
        padding: 0.75rem 0.5rem;
    }

    /* Forms - Full vertical stack */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    /* Form inputs - Touch friendly */
    .form-input {
        min-height: 44px;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        -webkit-appearance: none;
        appearance: none;
    }

    textarea.form-input {
        min-height: 100px;
    }

    /* Buttons - Touch friendly minimum size */
    .btn-primary,
    .btn-secondary,
    .btn-icon-primary,
    .btn-icon-danger,
    .btn-icon-success,
    .btn-icon-info {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
        touch-action: manipulation;
    }

    .btn-sm {
        min-height: 40px;
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }

    /* Cards */
    .content-card {
        border-radius: 12px;
    }

    .card-header {
        padding: 1.25rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    /* Modals - Full screen on mobile */
    .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 1.25rem;
        flex-shrink: 0;
    }

    .modal-body {
        padding: 1.25rem;
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        padding: 1.25rem;
        flex-shrink: 0;
        border-top: 1px solid var(--border-color);
    }

    .modal-close {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Navigation items - Touch friendly */
    .nav-item {
        padding: 1rem 1.25rem;
        min-height: 48px;
    }

    /* User profile in sidebar */
    .user-profile {
        padding: 1.5rem 1.25rem;
    }

    .user-avatar {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }

    .user-name {
        font-size: 1rem;
    }

    .user-email {
        font-size: 0.8125rem;
    }

    /* Logout button */
    .logout-btn {
        padding: 1rem 1.25rem;
        min-height: 48px;
        margin: 0.5rem;
    }

    /* Mobile topbar title */
    #mobile-company-name {
        font-size: 0.9375rem;
    }

    .mobile-user-name {
        font-size: 0.6875rem;
    }

    /* Activity list */
    .activity-item {
        padding: 0.875rem;
    }

    .activity-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9375rem;
    }

    /* Notifications */
    .notification {
        min-width: auto;
        max-width: calc(100vw - 2rem);
        padding: 1rem;
    }

    /* Section header */
    .section-header {
        margin-bottom: 1.5rem;
    }

    /* PTW Form sections */
    .ptw-form-section {
        padding: 1.25rem;
    }

    .ptw-checklist-grid {
        grid-template-columns: 1fr;
    }

    /* Stats */
    .stat-item {
        padding: 0.875rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.8125rem;
    }
}

/* ===== Very Small Phones (max-width: 360px) ===== */
@media (max-width: 360px) {
    .main-content {
        padding: calc(4rem + env(safe-area-inset-top)) 0.875rem 1.25rem;
    }

    .mobile-topbar {
        padding: calc(0.75rem + env(safe-area-inset-top) / 2) 0.875rem;
    }

    .sidebar {
        max-width: 100%;
    }

    .kpi-card {
        padding: 1rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .card-title {
        font-size: 0.9375rem;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }

    #login-title {
        font-size: 1.375rem;
    }
}

/* ===== Desktop - Hide mobile elements ===== */
@media (min-width: 1025px) {
    .sidebar-overlay {
        display: none !important;
    }

    .mobile-topbar {
        display: none !important;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .mobile-topbar-actions {
        display: none !important;
    }

    /* إعادة تعيين القائمة الجانبية على سطح المكتب */
    .sidebar {
        transform: translateX(0) !important;
        position: fixed;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }

    body.sidebar-open {
        overflow: auto !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
    }
}

/* ===== Landscape Orientation Adjustments ===== */
@media (max-width: 1024px) and (orientation: landscape) {
    .main-content {
        padding-top: calc(3.5rem + env(safe-area-inset-top));
    }

    .mobile-topbar {
        padding: calc(0.75rem + env(safe-area-inset-top) / 2) 1.25rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ===== Print Styles ===== */
@media print {

    .sidebar,
    .mobile-topbar,
    .sidebar-toggle,
    .theme-toggle,
    .notifications-btn,
    .user-ai-assistant-btn,
    .user-ai-assistant-chat,
    .sidebar-overlay {
        display: none !important;
    }

    .app-shell {
        margin-right: 0 !important;
    }

    .main-content {
        padding: 0 !important;
    }

    .table-wrapper {
        overflow-x: visible !important;
    }

    .data-table {
        width: 100% !important;
        min-width: auto !important;
    }
}

/* ===== Settings Section Styling ===== */
.settings-group {
    margin-bottom: 3rem;
}

.settings-group-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.settings-group-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.settings-group-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

.settings-group-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Responsive settings groups */
@media (max-width: 768px) {
    .settings-group {
        margin-bottom: 2rem;
    }

    .settings-group-title {
        font-size: 1.25rem;
    }

    .settings-group-subtitle {
        font-size: 0.875rem;
    }

    .settings-group-header {
        margin-bottom: 1.25rem;
        padding-bottom: 0.875rem;
    }
}

/* ===== Additional Utility Classes for Responsive Design ===== */
@media (max-width: 768px) {

    /* Hide on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Show only on mobile */
    .show-mobile {
        display: block !important;
    }

    /* Full width on mobile */
    .full-width-mobile {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

@media (min-width: 769px) {

    /* Hide on desktop */
    .hide-desktop {
        display: none !important;
    }

    /* Show only on desktop */
    .show-desktop {
        display: block !important;
    }
}

/* ===== Safe Area Insets for Notched Devices ===== */
@supports (padding: max(0px)) {
    .main-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .mobile-topbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(calc(0.9rem + env(safe-area-inset-top) / 2), env(safe-area-inset-top));
    }

    .sidebar {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        padding-top: max(0px, env(safe-area-inset-top));
    }

    .navigation {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ===== Cross-Browser Compatibility Fixes ===== */
/* Fix for Safari iOS viewport height */
@supports (-webkit-touch-callout: none) {

    .sidebar,
    .main-content,
    .app-shell,
    .main-app {
        min-height: -webkit-fill-available;
    }

    @media (max-width: 1024px) {
        body.sidebar-open {
            height: -webkit-fill-available;
        }
    }
}

/* Fix for Firefox mobile */
@-moz-document url-prefix() {
    @media (max-width: 1024px) {
        .sidebar {
            scrollbar-width: thin;
            scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
        }
    }
}

/* Fix for Edge/IE */
@media screen and (-ms-high-contrast: active),
(-ms-high-contrast: none) {
    .sidebar {
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Mobile scrollbar - thinner and more subtle */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--gray-400);
        border-radius: 2px;
    }

    /* Better scrollbar for sidebar on mobile */
    .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.3);
        border-radius: 3px;
    }

    .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }

    /* تحسين التمرير على الموبايل */
    .main-content {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    .app-shell {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
}

/* ===== Dark Mode Toggle Button ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle {
    background: var(--card-bg);
    border-color: var(--border-color);
}

/* Theme toggle in sidebar */
.sidebar .theme-toggle {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.sidebar .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: none;
}

.sidebar .theme-toggle span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== Notifications Badge ===== */
.notifications-btn {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    height: auto;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.notifications-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: none;
}

.notifications-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== Sync Button ===== */
.sync-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.sync-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.sync-btn.syncing {
    animation: spin 1s linear infinite;
}

.sync-btn.connected {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

.sync-btn.disconnected {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.sync-btn #sync-icon {
    font-size: 1rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== User Connection Status Button ===== */
.user-connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    cursor: default;
    transition: var(--transition);
    width: 100%;
    justify-content: center;
}

.user-connection-status:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-connection-status #user-connection-icon {
    font-size: 0.5rem;
    transition: var(--transition);
}

.user-connection-status.connected #user-connection-icon {
    color: #10b981;
    animation: pulse 2s infinite;
}

.user-connection-status.disconnected #user-connection-icon {
    color: #ef4444;
}

.user-connection-status #user-connection-text {
    font-size: 0.75rem;
    font-weight: 500;
}

.user-connection-status.connected #user-connection-text {
    color: #10b981;
}

.user-connection-status.disconnected #user-connection-text {
    color: #ef4444;
}

/* Header Actions Styles */
.header-theme-toggle,
.header-notifications-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.125rem;
}

.header-theme-toggle:hover,
.header-notifications-btn:hover {
    background: var(--bg-secondary);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.header-notifications-btn {
    position: relative;
}

.header-notifications-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--card-bg);
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

.notifications-badge.show {
    display: flex;
}

/* ===== Notifications Dropdown Panel ===== */
.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: unset !important;
    /* إزالة أي left مُعرّف */
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: 500px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.3s ease;
    direction: rtl;
    text-align: right;
    visibility: visible;
    opacity: 1;
    transform: translateY(0) translateX(0) !important;
    /* منع أي translation */
    margin-right: 0 !important;
    /* إزالة أي margin */
    margin-left: auto;
}

[data-theme="dark"] .notifications-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.notifications-dropdown.show {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notifications-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.notifications-dropdown-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-notifications-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 1rem;
}

.close-notifications-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notifications-list {
    overflow-y: auto;
    flex: 1;
    max-height: 400px;
}

.notifications-list::-webkit-scrollbar {
    width: 6px;
}

.notifications-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.notifications-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.notifications-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--bg-secondary);
}

.notification-item:active {
    background: var(--bg-tertiary);
    transform: scale(0.98);
}

.notification-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.notification-item-icon.emergency {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.notification-item-icon.warning {
    background: rgba(251, 191, 36, 0.1);
    color: var(--warning-color);
}

.notification-item-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.notification-item-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.notification-item-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

.notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.notifications-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.notifications-empty p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Mobile notifications dropdown positioning */
.mobile-notifications-dropdown {
    right: auto;
    left: 0;
    width: 320px;
    z-index: 10000;
    direction: rtl;
}

/* Header notifications dropdown positioning */
#header-notifications-dropdown {
    right: 0;
    left: auto;
    top: calc(100% + 8px);
    z-index: 10000;
    direction: rtl;
}

/* Sidebar notifications dropdown positioning */
#notifications-dropdown {
    right: 0;
    left: auto;
    top: calc(100% + 10px);
    position: absolute;
    z-index: 10000;
    direction: rtl;
    text-align: right;
    visibility: visible;
    opacity: 1;
}

/* Ensure parent container has relative positioning */
#notifications-btn {
    position: relative;
}

.notifications-btn+.notifications-dropdown,
.notifications-btn~.notifications-dropdown {
    position: absolute;
    right: 0 !important;
    left: unset !important;
}

/* Responsive styles for notifications dropdown */
@media (max-width: 768px) {
    .notifications-dropdown {
        width: calc(100vw - 40px) !important;
        max-width: 380px;
        max-height: 400px;
        right: 0 !important;
        left: unset !important;
        transform: translateX(0) !important;
    }

    .mobile-notifications-dropdown {
        width: calc(100vw - 20px);
        max-width: 320px;
        right: auto !important;
        left: 0 !important;
    }

    #header-notifications-dropdown {
        width: calc(100vw - 40px);
        max-width: 380px;
        right: 0 !important;
        left: auto !important;
    }
}

@media (max-width: 480px) {
    .notifications-dropdown {
        width: calc(100vw - 32px) !important;
        max-height: 350px;
        right: 0 !important;
        left: unset !important;
    }

    .mobile-notifications-dropdown {
        width: calc(100vw - 32px);
        right: auto !important;
        left: 0 !important;
    }

    #header-notifications-dropdown {
        width: calc(100vw - 32px);
        right: 0 !important;
        left: auto !important;
    }

    .notifications-dropdown-header h3 {
        font-size: 1rem;
    }

    .notification-item {
        padding: 0.875rem 1rem;
    }

    .notification-item-title {
        font-size: 0.875rem;
    }

    .notification-item-message {
        font-size: 0.8125rem;
    }
}

/* ===== Language Switcher ===== */
.language-switcher {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .language-switcher {
    background: var(--card-bg);
    border-color: var(--border-color);
}

.language-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 1rem;
    gap: 0.5rem;
}

.language-toggle-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.language-toggle-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.language-toggle-btn i {
    color: var(--text-secondary);
    transition: var(--transition);
}

.language-toggle-btn:hover i {
    color: var(--text-primary);
}

.language-toggle-btn span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

[data-theme="dark"] .language-toggle-btn {
    color: var(--text-primary);
}

[data-theme="dark"] .language-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Animation for notifications ===== */
@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-100px);
    }
}

/* ===== Activity Colors ===== */
.text-red-500 {
    color: var(--danger-color);
}

.text-blue-500 {
    color: var(--primary-color);
}

.text-green-500 {
    color: var(--success-color);
}

.text-yellow-500 {
    color: var(--warning-color);
}

.bg-gray-100 {
    background-color: var(--gray-100);
}

/* ===== Data Tables ===== */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    min-width: 100%;
}

.data-table thead {
    background: var(--bg-secondary);
    transition: background-color 0.3s ease;
}

.data-table th {
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ===== Button Icons ===== */
.btn-icon {
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.btn-icon-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.btn-icon-primary:hover {
    background: rgba(37, 99, 235, 0.2);
}

.btn-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-icon-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.btn-icon-success:hover {
    background: rgba(16, 185, 129, 0.2);
}

.btn-icon-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.btn-icon-secondary:hover {
    background: rgba(107, 114, 128, 0.2);
    color: #4b5563;
}

/* ===== Grid Layout ===== */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.grid-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive Grid Utilities (Tailwind-like) */
@media (min-width: 768px) {
    .md\:grid-cols-1 {
        grid-template-columns: repeat(1, 1fr);
    }

    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .md\:col-span-2 {
        grid-column: span 2 / span 2;
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-1 {
        grid-template-columns: repeat(1, 1fr);
    }

    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .lg\:grid-cols-5 {
        grid-template-columns: repeat(5, 1fr);
    }

    .lg\:col-span-2 {
        grid-column: span 2 / span 2;
    }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .xl\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .xl\:grid-cols-5 {
        grid-template-columns: repeat(5, 1fr);
    }

    .xl\:col-span-1 {
        grid-column: span 1 / span 1;
    }
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.ml-3 {
    margin-left: 0.75rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.text-4xl {
    font-size: 2.25rem;
}

.text-gray-300 {
    color: var(--gray-300);
}

.text-gray-500 {
    color: var(--gray-500);
}

.space-y-6>*+* {
    margin-top: 1.5rem;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.modal-close {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 1.25rem;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--bg-secondary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .modal-footer {
    background: var(--bg-secondary);
    border-top-color: var(--border-color);
}

/* ===== Textarea ===== */
textarea.form-input {
    resize: vertical;
    min-height: 100px;
    font-family: 'Cairo', sans-serif;
}

/* ===== Badge Info ===== */
.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.btn-icon-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.btn-icon-info:hover {
    background: rgba(6, 182, 212, 0.2);
}

/* ===== Additional Dark Mode Styles ===== */
[data-theme="dark"] .login-card h1 {
    color: var(--text-primary);
}

[data-theme="dark"] .login-card p {
    color: var(--text-secondary);
}

[data-theme="dark"] .empty-state p {
    color: var(--text-secondary);
}

[data-theme="dark"] .empty-state i {
    color: var(--text-tertiary);
}

[data-theme="dark"] .modal-close {
    color: var(--text-secondary);
}

[data-theme="dark"] .modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-footer {
    background: var(--bg-secondary);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .card-body {
    color: var(--text-primary);
}

.header-company-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .header-company-name {
        font-size: 0.875rem;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

[data-theme="dark"] .company-logo-header {
    background: var(--card-bg);
    border-bottom-color: var(--border-color);
}

.ptw-form-section {
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: var(--card-bg);
    padding: 1.5rem;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.05);
}

.ptw-form-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ptw-checklist-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .ptw-checklist-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.ptw-checklist-group {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 1rem;
}

.ptw-checklist-group h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.ptw-check-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.ptw-check-option:last-child {
    margin-bottom: 0;
}

.ptw-check-input {
    width: 1.1rem;
    height: 1.1rem;
}

.ptw-other-input {
    margin-top: 0.5rem;
}

.ptw-other-input.hidden {
    display: none;
}

.ptw-team-members {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ptw-team-member-row {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--bg-secondary);
    padding: 0.75rem;
}

.ptw-closure-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ptw-closure-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Enhanced Table Wrapper for Horizontal Scroll ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    position: relative;
    margin: 1rem 0;
    scroll-behavior: smooth;
}

/* Add scroll shadow indicators */
.table-wrapper {
    background: var(--bg-secondary);
    border-radius: 8px;
}

/* Ensure tables don't break layout */
.table-wrapper table {
    margin: 0;
}

/* Scroll indicator for tables on mobile */
@media (max-width: 768px) {
    .table-wrapper {
        margin: 0 -1rem;
        padding: 0 1rem;
    }

    .table-wrapper.has-scroll::before,
    .table-wrapper.has-scroll::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        pointer-events: none;
        z-index: 1;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .table-wrapper.has-scroll.scroll-right::before {
        opacity: 1;
        right: 0;
        background: linear-gradient(to right, var(--bg-secondary), transparent);
    }

    .table-wrapper.has-scroll.scroll-left::after {
        opacity: 1;
        left: 0;
        background: linear-gradient(to left, var(--bg-secondary), transparent);
    }
}

/* ===== Form Grid Responsive Improvements ===== */
@media (max-width: 768px) {

    /* All grid columns stack on mobile */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-5,
    .grid-cols-6 {
        grid-template-columns: 1fr !important;
    }

    /* Form groups stack vertically */
    .form-group,
    .form-row {
        flex-direction: column;
    }

    /* Labels and inputs full width */
    .form-group label,
    .form-row label {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-row input,
    .form-row select,
    .form-row textarea {
        width: 100%;
    }
}

/* ===== Touch-Friendly Interactive Elements ===== */
@media (max-width: 1024px) {

    /* Ensure all clickable elements are touch-friendly */
    a,
    button,
    input[type="button"],
    input[type="submit"],
    input[type="checkbox"],
    input[type="radio"],
    select,
    .nav-item,
    .btn-primary,
    .btn-secondary,
    .btn-icon-primary,
    .btn-icon-danger,
    .btn-icon-success,
    .btn-icon-info {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }

    /* Remove double-tap zoom on buttons */
    button,
    a.btn-primary,
    a.btn-secondary {
        touch-action: manipulation;
    }

    /* Improve checkbox and radio button sizes */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }

    /* Better spacing for form elements */
    .form-group {
        margin-bottom: 1.25rem;
    }

    label {
        margin-bottom: 0.5rem;
        display: block;
        font-weight: 600;
    }
}

/* ===== Update Management Styles ===== */
.form-select {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    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='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: 12px;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    resize: vertical;
    min-height: 100px;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.settings-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

@media (max-width: 768px) {
    .settings-container {
        padding: 1rem;
    }
}

/* ===== User AI Assistant Chat Interface ===== */
.user-ai-assistant-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: var(--transition);
    animation: pulse 2s infinite;
}

.user-ai-assistant-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.user-ai-assistant-btn:active {
    transform: scale(0.95);
}

.user-ai-assistant-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

.user-ai-assistant-chat {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.user-ai-assistant-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-ai-assistant-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-ai-assistant-header-content i {
    font-size: 24px;
}

.user-ai-assistant-header-content h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.user-ai-assistant-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-ai-assistant-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.user-ai-assistant-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-ai-assistant-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.user-ai-assistant-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.user-ai-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-secondary);
}

.user-ai-assistant-messages::-webkit-scrollbar {
    width: 6px;
}

.user-ai-assistant-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.user-ai-assistant-messages::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.user-ai-assistant-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.user-ai-message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-ai-message-user {
    flex-direction: row-reverse;
}

.user-ai-message-assistant {
    flex-direction: row;
}

.user-ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.user-ai-message-user .user-ai-message-avatar {
    background: var(--primary-color);
    color: white;
}

.user-ai-message-assistant .user-ai-message-avatar {
    background: var(--gray-200);
    color: var(--gray-700);
}

.user-ai-message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-ai-message-user .user-ai-message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.user-ai-message-assistant .user-ai-message-content {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.user-ai-message-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.user-ai-message-text {
    width: 100%;
}

.user-ai-message-text p {
    margin: 4px 0;
}

.user-ai-message-text p:first-child {
    margin-top: 0;
}

.user-ai-message-text p:last-child {
    margin-bottom: 0;
}

.user-ai-message-list-item {
    padding-right: 16px;
    position: relative;
}

.user-ai-message-heading {
    font-weight: 600;
    margin: 8px 0 4px 0 !important;
}

.user-ai-message-meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 11px;
}

.user-ai-message-content .user-ai-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.user-ai-quick-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-ai-quick-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.user-ai-quick-button i {
    font-size: 12px;
}

.user-ai-assistant-input-container {
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    padding: 12px;
}

.user-ai-assistant-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.user-ai-quick-action-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.user-ai-quick-action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.user-ai-quick-action-btn i {
    font-size: 12px;
}

.user-ai-assistant-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-ai-assistant-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.user-ai-assistant-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.user-ai-assistant-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.user-ai-assistant-send:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.user-ai-assistant-send:active {
    transform: scale(0.95);
}

.user-ai-assistant-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.user-ai-loading {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.user-ai-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
    animation: bounce 1.4s infinite ease-in-out both;
}

.user-ai-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.user-ai-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Responsive Design for AI Assistant */
@media (max-width: 768px) {
    .user-ai-assistant-chat {
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
        bottom: 80px;
        height: calc(100vh - 120px);
        max-width: none;
        max-height: none;
    }

    .user-ai-assistant-btn {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .user-ai-assistant-quick-actions {
        display: none;
    }

    .user-ai-assistant-header {
        padding: 12px;
    }

    .user-ai-assistant-header-content h3 {
        font-size: 16px;
    }

    .user-ai-assistant-input-container {
        padding: 10px;
    }

    .user-ai-assistant-input {
        padding: 10px 14px;
        font-size: 14px;
    }

    .user-ai-assistant-send {
        width: 40px;
        height: 40px;
    }
}

/* Additional Mobile Optimizations */
@media (max-width: 480px) {
    .user-ai-assistant-chat {
        width: 100vw;
        left: 0;
        right: 0;
        bottom: 70px;
        height: calc(100vh - 70px);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .user-ai-assistant-btn {
        bottom: 15px;
        left: 15px;
        width: 48px;
        height: 48px;
    }
}

/* ===== Safety & Health Management Module Styles ===== */
.shm-tab-btn {
    transition: all 0.3s ease;
    position: relative;
}

.shm-tab-btn:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.shm-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

/* Team Member Cards */
#team-members-list .bg-white {
    transition: all 0.3s ease;
}

#team-members-list .bg-white:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* KPI Cards - Legacy style for safetyhealthmanagement module only */
/* This style applies only to .kpi-card with single class modifiers (success, warning, etc.) */
/* and does not affect .kpi-card with kpi- prefix classes (kpi-danger, kpi-success, etc.) */
/* Using more specific selector to avoid conflicts */
.kpi-card:not(.kpi-primary):not(.kpi-success):not(.kpi-warning):not(.kpi-info):not(.kpi-danger):not(.kpi-purple) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.kpi-card:not(.kpi-primary):not(.kpi-success):not(.kpi-warning):not(.kpi-info):not(.kpi-danger):not(.kpi-purple):hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.kpi-card.success:not(.kpi-success) {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.kpi-card.warning:not(.kpi-warning) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.kpi-card.danger:not(.kpi-danger) {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.kpi-card.info:not(.kpi-info) {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Performance Chart Container */
.performance-chart-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

/* Attendance Calendar */
.attendance-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.attendance-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.attendance-day.present {
    background-color: #10b981;
    color: white;
}

.attendance-day.absent {
    background-color: #ef4444;
    color: white;
}

.attendance-day.late {
    background-color: #f59e0b;
    color: white;
}

.attendance-day.field-work {
    background-color: #06b6d4;
    color: white;
}

.attendance-day:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* Organizational Structure Tree */
.org-structure-tree {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.org-node {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.org-node:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.org-node::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 12px;
    background-color: var(--border-color);
}

.org-node:first-child::before {
    display: none;
}

/* Responsive adjustments for Safety Health Management */
@media (max-width: 768px) {
    .shm-tab-btn {
        padding: 10px 12px !important;
        font-size: 0.875rem;
    }

    #team-members-list {
        grid-template-columns: 1fr !important;
    }

    .attendance-calendar {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 0.25rem;
    }

    .attendance-day {
        font-size: 0.75rem;
    }
}

/* Dropdown Menu Styles - Enhanced for Mobile */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    display: none;
    overflow: hidden;
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile dropdown adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
        animation: slideUpFromBottom 0.3s ease;
    }

    @keyframes slideUpFromBottom {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }
}

[data-theme="dark"] .dropdown-menu {
    background: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
    /* Touch-friendly */
    touch-action: manipulation;
}

[data-theme="dark"] .dropdown-item {
    border-bottom-color: var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--gray-100);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--gray-700);
}

.dropdown-item i {
    margin-left: 8px;
}

/* Modal improvements for action details */
.modal-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-header .modal-close:hover {
    background-color: var(--gray-100);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header .modal-close:hover {
    background-color: var(--gray-700);
}

/* ===== Additional Mobile Enhancements ===== */

/* Prevent zoom on input focus (iOS) */
@media (max-width: 768px) {

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents auto-zoom on iOS */
    }
}

/* Better select dropdowns on mobile */
@media (max-width: 768px) {
    select.form-select {
        background-position: left 1rem center;
        padding-right: 1rem;
        padding-left: 3rem;
    }
}

/* ===== Mobile File Input & Image Upload Enhancements ===== */
@media (max-width: 768px) {

    /* File input styling for mobile */
    input[type="file"] {
        width: 100%;
        min-height: 48px;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        border: 2px solid var(--border-color);
        border-radius: 10px;
        background: var(--bg-primary);
        color: var(--text-primary);
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
        touch-action: manipulation;
    }

    input[type="file"]:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    /* File input label wrapper */
    label:has(input[type="file"]),
    .file-input-wrapper {
        display: block;
        width: 100%;
        position: relative;
    }

    /* Image preview containers */
    .attachment-preview,
    #observation-attachments-preview,
    #incident-attachments-list,
    [id*="attachments-preview"],
    [id*="attachment-preview"] {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
        margin-top: 1rem;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    /* Image preview cards */
    .attachment-card,
    [class*="attachment-preview-card"],
    .attachment-item {
        position: relative;
        width: 100%;
        max-width: 100%;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid var(--border-color);
        background: var(--card-bg);
    }

    /* Image preview images */
    .attachment-card img,
    .attachment-preview img,
    [id*="attachments-preview"] img,
    img[class*="preview"],
    img[id*="preview"] {
        width: 100%;
        height: auto;
        max-width: 100%;
        object-fit: cover;
        display: block;
        border-radius: 8px 8px 0 0;
    }

    /* Attachment action buttons */
    .attachment-card button,
    [data-remove-attachment],
    [data-open-attachment],
    [data-attachment-remove],
    [data-attachment-download] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.625rem;
        font-size: 0.875rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }

    /* Photo preview containers */
    #user-photo-preview,
    #employee-photo-preview,
    [id*="photo-preview"],
    [id*="photo-input"] {
        max-width: 100%;
        width: 100%;
    }

    /* Photo input wrapper */
    label:has(#user-photo-input),
    label:has(#employee-photo-input),
    label:has([id*="photo-input"]) {
        width: 100%;
        display: block;
    }
}

/* Improved table responsiveness */
@media (max-width: 768px) {
    .data-table {
        display: block;
        width: 100%;
        border-collapse: collapse;
    }

    .data-table thead {
        display: none;
        /* Hide headers on mobile for card-style view */
    }

    .data-table tbody {
        display: block;
        width: 100%;
    }

    .data-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 1rem;
        background: var(--card-bg);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
        text-align: right;
    }

    .data-table td:before {
        content: attr(data-label);
        font-weight: 600;
        margin-left: 1rem;
        color: var(--text-secondary);
    }

    /* Table wrapper improvements - prevent horizontal scroll */
    .table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    /* Visual scroll indicator for tables */
    .table-wrapper::after {
        content: '→';
        position: absolute;
        top: 50%;
        left: 10px;
        transform: translateY(-50%);
        font-size: 1.5rem;
        color: var(--primary-color);
        opacity: 0.3;
        pointer-events: none;
        display: none;
    }

    .table-wrapper.scrollable::after {
        display: block;
    }
}

/* ===== Comprehensive Horizontal Scroll Prevention ===== */
@media (max-width: 1024px) {

    /* Ensure no element exceeds viewport width */
    * {
        max-width: 100vw;
    }

    /* Prevent horizontal scroll on all containers */
    .section,
    .content-card,
    .card-body,
    .card-header,
    .modal-body,
    .modal-content {
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* Prevent images from causing overflow */
    img,
    video,
    iframe,
    embed,
    object,
    canvas,
    svg {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Ensure form elements don't overflow */
    .form-group,
    .form-row,
    .grid,
    .flex {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Prevent overflow in nested elements */
    .content-grid,
    .kpi-grid,
    .stats-grid {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* ===== Enhanced Touch Interactions ===== */
@media (max-width: 1024px) {

    /* All interactive elements should be touch-friendly */
    button,
    a,
    input,
    select,
    textarea,
    [role="button"],
    [onclick],
    [tabindex="0"] {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
        touch-action: manipulation;
    }

    /* Prevent double-tap zoom on buttons */
    button,
    a.btn-primary,
    a.btn-secondary,
    .nav-item,
    .btn-icon {
        touch-action: manipulation;
        -ms-touch-action: manipulation;
    }

    /* Better touch targets for small screens */
    @media (max-width: 480px) {

        button,
        .btn-primary,
        .btn-secondary,
        .nav-item,
        .dropdown-item,
        .btn-icon {
            min-height: 48px;
            min-width: 48px;
        }

        input[type="checkbox"],
        input[type="radio"] {
            width: 24px;
            height: 24px;
            min-width: 24px;
            min-height: 24px;
        }

        label {
            min-height: 44px;
            display: flex;
            align-items: center;
            padding: 0.5rem 0;
        }
    }
}

/* ===== Form Input Improvements for Mobile ===== */
@media (max-width: 768px) {

    /* Prevent zoom on input focus (iOS Safari) */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 10px;
    }

    /* Better date/time inputs on mobile */
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"] {
        min-height: 48px;
        padding: 0.875rem 1rem;
        font-size: 16px;
    }

    /* Textarea improvements */
    textarea {
        resize: vertical;
        min-height: 120px;
        font-size: 16px;
        line-height: 1.5;
    }

    /* Better dropdown styling */
    select {
        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='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: left 0.75rem center;
        background-size: 12px;
        padding-left: 3rem;
        padding-right: 1rem;
    }
}

/* ===== Modal Improvements for Mobile ===== */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
    }

    .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal-header {
        flex-shrink: 0;
        padding: 1.25rem;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        background: var(--card-bg);
        z-index: 10;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.25rem;
        overscroll-behavior: contain;
    }

    .modal-footer {
        flex-shrink: 0;
        padding: 1.25rem;
        border-top: 1px solid var(--border-color);
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        z-index: 10;
        display: flex;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .modal-footer button {
        flex: 1;
        min-width: 0;
    }

    .modal-close {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 896px) and (orientation: landscape) {
    .mobile-topbar {
        min-height: 50px;
        padding: 0.5rem 1rem;
    }

    .sidebar {
        max-width: 60vw;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Reduce padding in landscape */
    .main-content {
        padding-top: calc(3.5rem + env(safe-area-inset-top));
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    /* Optimize modal height in landscape */
    .modal-content {
        max-height: 100vh;
        height: 100vh;
    }

    .modal-body {
        max-height: calc(100vh - 140px);
    }
}

/* ===== Enhanced Portrait/Landscape Responsiveness ===== */
@media (max-width: 480px) {
    /* Portrait optimizations */
    @media (orientation: portrait) {
        .main-content {
            padding-top: calc(4.5rem + env(safe-area-inset-top));
        }

        .kpi-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }

        .content-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }
    }

    /* Landscape optimizations for small phones */
    @media (orientation: landscape) {
        .main-content {
            padding-top: calc(3rem + env(safe-area-inset-top));
            padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
        }

        .mobile-topbar {
            min-height: 48px;
            padding: 0.5rem 0.875rem;
        }

        .section-header {
            margin-bottom: 1rem;
        }

        .section-title {
            font-size: 1.25rem;
            margin-bottom: 0.5rem;
        }

        .kpi-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 0.75rem;
        }

        .kpi-card {
            padding: 1rem;
        }

        .kpi-value {
            font-size: 1.5rem;
        }

        .card-header {
            padding: 1rem;
        }

        .card-body {
            padding: 1rem;
        }

        .modal-header {
            padding: 1rem;
        }

        .modal-body {
            padding: 1rem;
            max-height: calc(100vh - 120px);
        }

        .modal-footer {
            padding: 1rem;
        }
    }
}

/* ===== Typography & Icon Improvements for Mobile ===== */
@media (max-width: 768px) {

    /* Ensure readable font sizes */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    /* Icon sizing */
    i.fas,
    i.far,
    i.fab,
    i.fa {
        font-size: 1em;
        line-height: 1;
        vertical-align: middle;
    }

    /* Section titles */
    .section-title {
        font-size: 1.375rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }

    .section-subtitle {
        font-size: 0.875rem;
        line-height: 1.5;
    }

    /* Card titles */
    .card-title {
        font-size: 1rem;
        line-height: 1.4;
    }

    /* KPI values */
    .kpi-value {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .kpi-label {
        font-size: 0.8125rem;
        line-height: 1.4;
    }

    .kpi-description {
        font-size: 0.6875rem;
        line-height: 1.4;
    }

    /* Better spacing for mobile */
    .section-header {
        margin-bottom: 1.5rem;
    }

    .content-card {
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    /* Icon button improvements */
    .btn-icon i,
    .mobile-icon-btn i,
    .nav-item i {
        font-size: 1.125rem;
    }
}

/* ===== Very Small Screen Optimizations ===== */
@media (max-width: 360px) {
    .section-title {
        font-size: 1.25rem;
    }

    .card-title {
        font-size: 0.9375rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .kpi-icon {
        width: 45px;
        height: 45px;
        font-size: 1.125rem;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.9375rem;
        padding: 0.75rem 1rem;
    }

    /* Compact spacing */
    .main-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card-header,
    .card-body {
        padding: 1rem 0.875rem;
    }
}

/* High DPI displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .kpi-icon,
    .user-avatar {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode improvements for mobile */
@media (max-width: 768px) {
    [data-theme="dark"] .mobile-topbar {
        background: var(--card-bg);
        border-bottom-color: var(--border-color);
    }

    [data-theme="dark"] .sidebar {
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.8);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .btn-primary,
    .btn-secondary {
        border: 2px solid currentColor;
    }

    .nav-item {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}

/* Hover capability detection */
@media (hover: none) {

    .btn-primary:hover,
    .btn-secondary:hover,
    .nav-item:hover {
        transform: none;
        /* Disable hover transforms on touch devices */
    }
}

/* Pointer coarse (touch devices) */
@media (pointer: coarse) {

    /* Increase tap targets */
    .nav-item,
    .btn-icon,
    .dropdown-item {
        min-height: 48px;
        min-width: 48px;
    }
}

/* ========================================
   مصفوفة تقييم المخاطر 5×5 - تصميم مدمج وتفاعلي
   Risk Assessment Matrix 5x5 - Compact & Interactive
   ======================================== */

.risk-matrix-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    margin: 0.75rem 0;
    border: 1px solid var(--border-color);
    max-width: 500px;
}

.risk-matrix-container.full-width {
    max-width: 100%;
}

.risk-matrix-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.risk-matrix-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.risk-matrix-title i {
    color: var(--primary-color);
    font-size: 1rem;
}

.risk-matrix-subtitle {
    color: var(--text-tertiary);
    font-size: 0.7rem;
    margin-top: 0.15rem;
}

/* Legend Compact */
.risk-matrix-legend {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.65rem;
}

.risk-legend-item {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.2rem 0.4rem;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.risk-legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Matrix Layout */
.risk-matrix-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.risk-matrix-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.risk-matrix-y-label {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    font-weight: 600;
    font-size: 0.65rem;
    color: var(--primary-color);
    letter-spacing: 1px;
}

.risk-matrix-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Grid - Compact Design */
.risk-matrix-grid {
    display: grid;
    grid-template-columns: 40px repeat(5, 1fr);
    gap: 2px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--border-color);
    padding: 2px;
}

/* Cells - Compact & Interactive */
.risk-matrix-cell {
    aspect-ratio: 1;
    min-height: 36px;
    max-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 700;
    font-size: 0.85rem;
    user-select: none;
}

.risk-matrix-cell:not(.risk-matrix-header-cell):hover {
    transform: scale(1.12);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.risk-matrix-cell:not(.risk-matrix-header-cell):active {
    transform: scale(0.95);
}

.risk-matrix-cell.selected {
    outline: 2px solid #fff;
    outline-offset: -2px;
    box-shadow: 0 0 0 3px var(--primary-color), 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 15;
}

.risk-matrix-cell-value {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.risk-matrix-cell-label {
    display: none;
}

/* Risk Level Colors - Gradient Based */
.risk-level-1,
.risk-level-2 {
    background: #22c55e;
    color: #fff;
}

.risk-level-3,
.risk-level-4 {
    background: #84cc16;
    color: #1a1a1a;
}

.risk-level-5,
.risk-level-6 {
    background: #eab308;
    color: #1a1a1a;
}

.risk-level-8,
.risk-level-9 {
    background: #f97316;
    color: #fff;
}

.risk-level-10,
.risk-level-12 {
    background: #ef4444;
    color: #fff;
}

.risk-level-15,
.risk-level-16 {
    background: #dc2626;
    color: #fff;
}

.risk-level-20,
.risk-level-25 {
    background: #991b1b;
    color: #fff;
}

/* Header Cells - Compact */
.risk-matrix-header-cell {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.7rem;
    cursor: default;
    text-align: center;
    padding: 0.25rem;
    min-height: 36px !important;
}

.risk-matrix-header-cell:hover {
    transform: none !important;
    box-shadow: none !important;
}

.risk-matrix-header-cell .header-num {
    font-size: 0.85rem;
    font-weight: 800;
    display: block;
    line-height: 1;
}

.risk-matrix-header-cell .header-txt {
    font-size: 0.55rem;
    opacity: 0.9;
    display: block;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.risk-matrix-corner {
    background: var(--bg-tertiary) !important;
    cursor: default;
}

.risk-matrix-corner i {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* X-Axis Label */
.risk-matrix-x-axis {
    text-align: center;
    margin-top: 0.35rem;
}

.risk-matrix-x-label {
    font-weight: 600;
    font-size: 0.65rem;
    color: var(--primary-color);
    letter-spacing: 1px;
}

/* Selection Info - Compact */
.risk-matrix-selection-info {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: none;
}

.risk-matrix-selection-info.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.risk-selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.risk-selection-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.risk-selection-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1rem;
    min-width: 45px;
}

.risk-selection-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.risk-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.risk-detail-label {
    font-size: 0.6rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.risk-detail-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Action Text */
.risk-action-text {
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .risk-matrix-container {
        padding: 0.75rem;
        max-width: 100%;
    }

    .risk-matrix-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .risk-matrix-legend {
        width: 100%;
        justify-content: flex-start;
    }

    .risk-matrix-grid {
        grid-template-columns: 32px repeat(5, 1fr);
    }

    .risk-matrix-cell {
        min-height: 32px;
        max-height: 38px;
    }

    .risk-matrix-cell-value {
        font-size: 0.8rem;
    }

    .risk-matrix-header-cell .header-txt {
        display: none;
    }

    .risk-selection-details {
        grid-template-columns: 1fr 1fr;
    }
}

/* Dark Mode */
[data-theme="dark"] .risk-matrix-container {
    background: var(--card-bg);
}

[data-theme="dark"] .risk-matrix-header-cell {
    background: #334155;
}

[data-theme="dark"] .risk-legend-item {
    background: var(--bg-tertiary);
}

/* ===== Clinic Tabs ===== */
.clinic-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.clinic-tab-btn {
    padding: 0.75rem 1.25rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #374151;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-family: 'Cairo', sans-serif;
    white-space: nowrap;
    position: relative;
}

.clinic-tab-btn i {
    margin-left: 0.5rem;
    font-size: 1rem;
    color: #374151;
    transition: color 0.2s ease;
}

.clinic-tab-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.clinic-tab-btn.active {
    background: #1e40af;
    border-color: #1e40af;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(30, 64, 175, 0.25);
    font-weight: 600;
}

.clinic-tab-btn.active i {
    color: #ffffff;
}

.clinic-tab-btn.active:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
    box-shadow: 0 3px 8px rgba(30, 64, 175, 0.3);
}

/* Badge داخل التبويب */
.clinic-tab-btn .badge {
    margin-right: 0.5rem;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
}

/* Dark mode support */
[data-theme="dark"] .clinic-tab-btn {
    background: #1f2937;
    border-color: #374151;
    color: #d1d5db;
}

[data-theme="dark"] .clinic-tab-btn i {
    color: #d1d5db;
}

[data-theme="dark"] .clinic-tab-btn:hover {
    background: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] .clinic-tab-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

[data-theme="dark"] .clinic-tab-btn.active i {
    color: #ffffff;
}

/* ========================================
   تحسينات نهائية شاملة للموبايل
   Final Comprehensive Mobile Enhancements
   ======================================== */

@media (max-width: 1024px) {

    /* Ensure all containers respect viewport */
    .app-shell,
    .main-app,
    .main-content,
    .section,
    .content-card,
    .card-body,
    .modal-content,
    .modal-body {
        max-width: 100vw;
        box-sizing: border-box;
    }

    /* Better handling for nested scroll containers */
    .card-body,
    .modal-body,
    .section {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Safe area insets for notched devices */
    .main-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .mobile-topbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Better button groups on mobile */
    .btn-group,
    .form-actions {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .btn-group button,
    .form-actions button {
        width: 100%;
        margin: 0;
    }

    /* Improve dropdown menus on mobile */
    .dropdown-menu {
        max-width: calc(100vw - 2rem);
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
    }

    /* Ensure images don't overflow */
    .content-card img,
    .card-body img,
    .attachment-preview img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    /* Risk matrix mobile optimizations */
    .risk-matrix-container {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .risk-matrix-grid {
        min-width: 350px;
    }
}

/* ========================================
   تحسينات التوافق مع مستويات التكبير (Zoom)
   ======================================== */

/* منع انزلاق العناصر عند التكبير */
* {
    box-sizing: border-box;
}

/* ضمان عدم ظهور Scroll أفقي عند التكبير */
html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

/* حماية العناصر من الخروج عن الحدود */
.app-shell,
.main-content,
.sidebar,
.content-card,
.modal-content {
    max-width: 100%;
    overflow-x: hidden;
}

/* حماية الجداول من التكسر عند التكبير */
.table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    min-width: 100%;
    table-layout: auto;
}

/* حماية النماذج من التكسر */
.form-group,
.form-row {
    max-width: 100%;
    overflow-x: hidden;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-row input,
.form-row select,
.form-row textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* حماية Grid من التكسر */
.content-grid,
.kpi-grid,
.stats-grid {
    max-width: 100%;
    overflow-x: hidden;
}

/* حماية الأزرار من التكسر */
.btn-primary,
.btn-secondary,
.btn-icon-primary,
.btn-icon-danger {
    white-space: nowrap;
    min-width: fit-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* حماية Modals من الخروج عن الشاشة */
.modal-content {
    max-width: min(95vw, 600px);
    max-height: min(90vh, 800px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* حماية Sidebar من التكسر */
.sidebar {
    max-width: 100%;
    overflow-x: hidden;
}

/* حماية Navigation من التكسر */
.navigation {
    max-width: 100%;
    overflow-x: hidden;
}

.nav-item {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* تحسينات خاصة لمستويات التكبير المختلفة */

/* عند التكبير 80% */
@media screen {

    /* ضمان أن العناصر تبقى قابلة للقراءة */
    body {
        font-size: clamp(12px, 1rem, 16px);
    }
}

/* عند التكبير 125% */
@media screen {

    /* ضمان أن العناصر لا تتداخل */
    .content-card {
        padding: clamp(1rem, 2vw, 2rem);
    }

    .section-title {
        font-size: clamp(1.25rem, 3vw, 2rem);
    }
}

/* حماية الصور من التكسر */
img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* حماية الأيقونات */
i[class*="fa-"] {
    display: inline-block;
    flex-shrink: 0;
}

/* منع انزلاق العناصر المطلقة */
.absolute,
.fixed {
    max-width: 100vw;
    left: auto;
    right: auto;
}

/* حماية Cards من التكسر */
.card,
.content-card {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* حماية النصوص الطويلة */
p,
span,
div,
label {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* حماية Tables من التكسر عند التكبير */
@media screen {

    .data-table th,
    .data-table td {
        white-space: nowrap;
        min-width: fit-content;
    }

    /* على Mobile، السماح بالتمرير الأفقي */
    @media (max-width: 768px) {

        .data-table th,
        .data-table td {
            white-space: normal;
            word-wrap: break-word;
        }
    }
}

/* تحسينات للتوافق مع جميع المتصفحات عند التكبير */

/* Chrome/Edge */
@supports (-webkit-appearance: none) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Firefox */
@-moz-document url-prefix() {
    * {
        -moz-font-smoothing: grayscale;
    }
}

/* Safari */
@supports (-webkit-touch-callout: none) {
    * {
        -webkit-font-smoothing: antialiased;
    }
}

/* منع مشاكل التكبير في Mobile */
@media (max-width: 1024px) {
    * {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* منع التكبير التلقائي في حقول الإدخال على iOS */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* حماية Layout من التكسر عند أي مستوى تكبير */
.main-app,
.app-shell {
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ضمان أن جميع العناصر القابلة للتمرير تعمل بشكل صحيح */
.scrollable,
.overflow-auto,
.overflow-y-auto {
    overflow-x: hidden !important;
}

/* حماية Flexbox containers */
.flex,
.d-flex {
    min-width: 0;
    max-width: 100%;
}

.flex>* {
    min-width: 0;
    flex-shrink: 1;
}

/* حماية Grid containers */
.grid {
    min-width: 0;
    max-width: 100%;
}

/* منع overflow في جميع الاتجاهات غير المرغوبة */
.container,
.container-fluid {
    max-width: 100%;
    overflow-x: hidden;
    padding-left: clamp(1rem, 2vw, 2rem);
    padding-right: clamp(1rem, 2vw, 2rem);
}

/* حماية Login Screen */
.login-screen {
    max-width: 100vw;
    overflow-x: hidden;
}

.login-card {
    max-width: min(95vw, 420px);
    overflow-x: hidden;
}

/* تحسينات نهائية للتوافق */
@media screen {

    /* ضمان أن جميع العناصر تبقى داخل Viewport */
    * {
        box-sizing: border-box;
    }

    /* منع أي عنصر من الخروج عن الحدود */
    body>* {
        max-width: 100vw;
    }
}

/* ========================================
   تحسينات خاصة لكل متصفح
   ======================================== */

/* ===== Firefox Specific Fixes ===== */
@-moz-document url-prefix() {

    /* تحسين عرض الخطوط */
    * {
        -moz-font-smoothing: grayscale;
        -moz-osx-font-smoothing: grayscale;
    }

    /* إصلاح مشكلة overflow في Firefox */
    html,
    body {
        overflow-x: hidden;
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    }

    /* تحسين Sidebar scrollbar */
    .sidebar {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }

    /* إصلاح مشكلة backdrop-filter في Firefox */
    .modal-overlay {
        background: rgba(0, 0, 0, 0.5);
    }

    /* تحسين Grid في Firefox */
    .content-grid,
    .kpi-grid,
    .stats-grid {
        display: grid;
        grid-template-columns: inherit;
    }

    /* إصلاح مشكلة RTL في Firefox */
    [dir="rtl"] {
        direction: rtl;
        text-align: right;
    }

    /* تحسين Forms في Firefox */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        -moz-appearance: none;
        appearance: none;
    }

    /* إصلاح مشكلة focus في Firefox */
    *:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* ===== Edge Specific Fixes ===== */
@supports (-ms-ime-align: auto) {

    /* Edge القديم (EdgeHTML) */
    html,
    body {
        -ms-overflow-style: -ms-autohiding-scrollbar;
        overflow-x: hidden;
    }

    .sidebar {
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }

    /* إصلاح Grid في Edge القديم */
    .content-grid,
    .kpi-grid {
        display: -ms-grid;
        -ms-grid-columns: inherit;
    }
}

/* Edge الجديد (Chromium-based) */
@supports (selector(:has(*))) {

    /* Edge Chromium يدعم :has() */
    .content-card:has(.table-wrapper) {
        overflow-x: auto;
    }
}

/* ===== Safari Specific Fixes ===== */
@supports (-webkit-touch-callout: none) {
    /* Safari على macOS و iOS */

    /* إصلاح Viewport Height */
    html,
    body,
    .sidebar,
    .main-content,
    .app-shell,
    .main-app {
        min-height: -webkit-fill-available;
    }

    /* إصلاح Safe Area Insets */
    @supports (padding: max(0px)) {
        .main-content {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
            padding-top: max(1rem, env(safe-area-inset-top));
            padding-bottom: max(1rem, env(safe-area-inset-bottom));
        }

        .mobile-topbar {
            padding-top: max(0.9rem, env(safe-area-inset-top));
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
    }

    /* إصلاح مشكلة Scroll في Safari */
    .sidebar,
    .main-content {
        -webkit-overflow-scrolling: touch;
    }

    /* إصلاح مشكلة backdrop-filter في Safari */
    .modal-overlay {
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }

    /* تحسين الخطوط في Safari */
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* إصلاح مشكلة RTL في Safari */
    [dir="rtl"] {
        direction: rtl;
    }

    /* إصلاح مشكلة Forms في Safari */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        -webkit-appearance: none;
        appearance: none;
    }

    /* منع التكبير التلقائي في حقول الإدخال على iOS */
    @media (max-width: 1024px) {

        input,
        select,
        textarea {
            font-size: 16px !important;
        }
    }

    /* إصلاح مشكلة position: sticky في Safari */
    .mobile-topbar {
        position: -webkit-sticky;
        position: sticky;
    }
}

/* ===== Mobile WebView Specific Fixes ===== */
@media (max-width: 1024px) {

    /* تحسينات عامة لـ WebView */
    html,
    body {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    /* تحسين Touch Events */
    * {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }

    /* إصلاح Safe Area في WebView */
    @supports (padding: max(0px)) {

        .main-content,
        .mobile-topbar,
        .sidebar {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
    }
}

/* ===== Brave Browser Specific Fixes ===== */
/* Brave يستخدم Blink engine مثل Chrome، لكن قد يحتاج تحسينات خاصة */
@supports (selector(:has(*))) {

    /* Brave يدعم الميزات الحديثة */
    .content-card:has(.table-wrapper) {
        overflow-x: auto;
    }
}

/* ===== Opera Specific Fixes ===== */
@supports (-o-appearance: none) {

    /* Opera القديم */
    html,
    body {
        overflow-x: hidden;
    }
}

/* Opera الجديد (Chromium-based) - نفس Chrome */

/* ===== Samsung Internet Specific Fixes ===== */
/* Samsung Internet يستخدم Chromium، لكن قد يحتاج تحسينات */
@media (max-width: 1024px) {

    /* تحسينات خاصة لـ Samsung Internet */
    * {
        -webkit-text-size-adjust: 100%;
    }
}

/* ===== Yandex Browser Specific Fixes ===== */
/* Yandex Browser يستخدم Chromium */

/* ===== UC Browser Specific Fixes ===== */
@media (max-width: 1024px) {

    /* UC Browser قد يحتاج تحسينات خاصة */
    * {
        -webkit-text-size-adjust: 100%;
    }
}

/* ===== Internet Explorer (Legacy Support) ===== */
@media screen and (-ms-high-contrast: active),
(-ms-high-contrast: none) {

    /* IE 10+ */
    html,
    body {
        -ms-overflow-style: -ms-autohiding-scrollbar;
        overflow-x: hidden;
    }

    .sidebar {
        -ms-overflow-style: -ms-autohiding-scrollbar;
    }

    /* Fallback للـ Grid في IE */
    .content-grid,
    .kpi-grid {
        display: -ms-grid;
        display: grid;
    }

    /* Fallback للـ Flexbox في IE */
    .flex,
    .d-flex {
        display: -ms-flexbox;
        display: flex;
    }
}

/* ===== متصفحات غير معروفة - تحسينات عامة ===== */
/* ضمان التوافق الأساسي مع أي متصفح */
* {
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Fallback للـ CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #aa3636;
}

/* Fallback للـ Grid */
@supports not (display: grid) {

    .content-grid,
    .kpi-grid,
    .stats-grid {
        display: flex;
        flex-wrap: wrap;
    }

    .content-grid>*,
    .kpi-grid>*,
    .stats-grid>* {
        flex: 1 1 auto;
        min-width: 200px;
    }
}

/* Fallback للـ Flexbox */
@supports not (display: flex) {

    .flex,
    .d-flex {
        display: block;
    }
}

/* Fallback للـ backdrop-filter */
@supports not (backdrop-filter: blur(4px)) {
    .modal-overlay {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* Fallback للـ CSS Variables */
@supports not (--css: variables) {
    .btn-primary {
        background: #2563eb;
        color: white;
    }

    .btn-secondary {
        background: #6b7280;
        color: white;
    }

    .card,
    .content-card {
        background: white;
        border: 1px solid #e5e7eb;
    }
}

/* ===== تحسينات عامة لجميع المتصفحات ===== */
/* ضمان عدم وجود Scroll أفقي */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    position: relative;
}

/* تحسين الأداء */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ========================================
   تحسينات متقدمة لكروت لوحة التحكم
   تصميم حديث ومتطور مع دعم الوضع الليلي والنهاري
   ======================================== */

/* ===== CSS Variables للكروت ===== */
:root {
    /* ألوان الكروت - الوضع النهاري */
    --card-bg-light: #ffffff;
    --card-border-light: rgba(229, 231, 235, 0.8);
    --card-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --card-shadow-hover-light: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    --card-gradient-light: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.98) 100%);

    /* ألوان الكروت - الوضع الليلي */
    --card-bg-dark: #1f2937;
    --card-border-dark: rgba(55, 65, 81, 0.6);
    --card-shadow-dark: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
    --card-shadow-hover-dark: 0 8px 24px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
    --card-gradient-dark: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.98) 100%);

    /* ألوان الأيقونات */
    --icon-bg-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --icon-bg-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --icon-bg-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --icon-bg-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --icon-bg-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --icon-bg-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);

    /* انتقالات سلسة */
    --card-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --icon-transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
    --card-bg: var(--card-bg-dark);
    --card-border: var(--card-border-dark);
    --card-shadow: var(--card-shadow-dark);
    --card-shadow-hover: var(--card-shadow-hover-dark);
    --card-gradient: var(--card-gradient-dark);
}

:root:not([data-theme="dark"]) {
    --card-bg: var(--card-bg-light);
    --card-border: var(--card-border-light);
    --card-shadow: var(--card-shadow-light);
    --card-shadow-hover: var(--card-shadow-hover-light);
    --card-gradient: var(--card-gradient-light);
}

/* ===== تحسينات عامة للكروت ===== */
.content-card {
    /* Fallback للمتصفحات القديمة */
    background: #ffffff;
    background: var(--card-gradient);
    border: 1px solid #e5e7eb;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    box-shadow: var(--card-shadow);
    -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    -moz-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--card-transition);
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -moz-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -o-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* backdrop-filter مع fallback */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -moz-backdrop-filter: blur(10px);
    will-change: transform, box-shadow;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* تحسينات للأداء */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.3) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.content-card:hover {
    -webkit-transform: translateY(-4px) scale(1.01);
    -moz-transform: translateY(-4px) scale(1.01);
    -ms-transform: translateY(-4px) scale(1.01);
    -o-transform: translateY(-4px) scale(1.01);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    box-shadow: var(--card-shadow-hover);
    -webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    -moz-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(59, 130, 246, 0.3);
}

.content-card:hover::before {
    opacity: 1;
}

/* ===== تحسينات Grid للكروت ===== */
.kpi-grid {
    /* Fallback للمتصفحات القديمة */
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -moz-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 0;
    /* Grid الحديث */
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.75rem;
    -webkit-column-gap: 1.75rem;
    -moz-column-gap: 1.75rem;
    column-gap: 1.75rem;
    row-gap: 1.75rem;
}

/* Fallback للمتصفحات القديمة */
.kpi-grid>* {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 280px;
    -moz-box-flex: 1;
    -ms-flex: 1 1 280px;
    flex: 1 1 280px;
    min-width: 280px;
    max-width: 100%;
    margin: 0.875rem;
}

@supports (display: grid) {
    .kpi-grid>* {
        margin: 0;
    }
}

/* ===== تحسينات KPI Cards ===== */
.kpi-card {
    /* Fallback للمتصفحات القديمة */
    background: #ffffff;
    background: var(--card-gradient);
    border: 1px solid #e5e7eb;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    padding: 2rem 1.75rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 1.5rem;
    -webkit-column-gap: 1.5rem;
    -moz-column-gap: 1.5rem;
    column-gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    box-shadow: var(--card-shadow);
    -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    -moz-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--card-transition);
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -moz-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -o-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -moz-backdrop-filter: blur(10px);
    will-change: transform, box-shadow;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    min-height: 140px;
    /* Fallback للمتصفحات القديمة التي لا تدعم gap */
    margin-left: 1.5rem;
}

.kpi-card:first-child {
    margin-left: 0;
}

@supports (gap: 1.5rem) {
    .kpi-card {
        margin-left: 0;
    }
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0.6;
    transition: width 0.3s ease, opacity 0.3s ease;
    z-index: 1;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 0;
}

.kpi-card:hover {
    -webkit-transform: translateY(-6px) scale(1.02);
    -moz-transform: translateY(-6px) scale(1.02);
    -ms-transform: translateY(-6px) scale(1.02);
    -o-transform: translateY(-6px) scale(1.02);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    box-shadow: var(--card-shadow-hover);
    -webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    -moz-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(59, 130, 246, 0.4);
}

.kpi-card:hover::before {
    width: 5px;
    opacity: 1;
}

.kpi-card:hover::after {
    opacity: 1;
}

/* ===== تحسينات الأيقونات ===== */
.kpi-icon {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    border-radius: 18px;
    -webkit-border-radius: 18px;
    -moz-border-radius: 18px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    margin-left: 1rem;
    font-size: 2rem;
    color: white;
    font-weight: 600;
    position: relative;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: var(--icon-transition);
    -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    -moz-transition: -moz-transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    -o-transition: -o-transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -moz-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.kpi-card:hover .kpi-icon {
    -webkit-transform: scale(1.1) rotate(5deg);
    -moz-transform: scale(1.1) rotate(5deg);
    -ms-transform: scale(1.1) rotate(5deg);
    -o-transform: scale(1.1) rotate(5deg);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    -webkit-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    -moz-box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* ألوان الأيقونات حسب النوع */
.kpi-primary .kpi-icon {
    background: var(--icon-bg-primary);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.kpi-success .kpi-icon {
    background: var(--icon-bg-success);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.kpi-warning .kpi-icon {
    background: var(--icon-bg-warning);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.kpi-danger .kpi-icon {
    background: var(--icon-bg-danger);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.kpi-info .kpi-icon {
    background: var(--icon-bg-info);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.kpi-purple .kpi-icon {
    background: var(--icon-bg-purple);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ===== تحسينات المحتوى ===== */
.kpi-content {
    flex: 1;
    position: relative;
    z-index: 2;
    min-width: 0;
}

.kpi-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
    letter-spacing: 0.01em;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-family: 'Cairo', sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.kpi-description {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ===== ألوان KPI Cards حسب النوع - الوضع النهاري ===== */
.kpi-card.kpi-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(37, 99, 235, 0.08) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.kpi-card.kpi-primary::before {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

.kpi-card.kpi-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.08) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.kpi-card.kpi-success::before {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.kpi-card.kpi-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(217, 119, 6, 0.08) 100%);
    border-color: rgba(245, 158, 11, 0.2);
}

.kpi-card.kpi-warning::before {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.kpi-card.kpi-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(220, 38, 38, 0.08) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.kpi-card.kpi-danger::before {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

.kpi-card.kpi-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05) 0%, rgba(8, 145, 178, 0.08) 100%);
    border-color: rgba(6, 182, 212, 0.2);
}

.kpi-card.kpi-info::before {
    background: linear-gradient(180deg, #06b6d4 0%, #0891b2 100%);
}

.kpi-card.kpi-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(124, 58, 237, 0.08) 100%);
    border-color: rgba(139, 92, 246, 0.2);
}

.kpi-card.kpi-purple::before {
    background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
}

/* ===== ألوان KPI Cards حسب النوع - الوضع الليلي ===== */
[data-theme="dark"] .kpi-card.kpi-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.2) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .kpi-card.kpi-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.2) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .kpi-card.kpi-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.2) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .kpi-card.kpi-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.2) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .kpi-card.kpi-info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(8, 145, 178, 0.2) 100%);
    border-color: rgba(6, 182, 212, 0.3);
}

[data-theme="dark"] .kpi-card.kpi-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(124, 58, 237, 0.2) 100%);
    border-color: rgba(139, 92, 246, 0.3);
}

/* ===== ألوان النصوص في الوضع الليلي ===== */
[data-theme="dark"] .kpi-label {
    color: rgba(209, 213, 219, 0.9);
}

[data-theme="dark"] .kpi-primary .kpi-label {
    color: #60a5fa;
}

[data-theme="dark"] .kpi-success .kpi-label {
    color: #34d399;
}

[data-theme="dark"] .kpi-warning .kpi-label {
    color: #fbbf24;
}

[data-theme="dark"] .kpi-danger .kpi-label {
    color: #f87171;
}

[data-theme="dark"] .kpi-info .kpi-label {
    color: #22d3ee;
}

[data-theme="dark"] .kpi-purple .kpi-label {
    color: #a78bfa;
}

[data-theme="dark"] .kpi-value {
    color: #f5f5f5;
}

[data-theme="dark"] .kpi-primary .kpi-value {
    color: #60a5fa;
}

[data-theme="dark"] .kpi-success .kpi-value {
    color: #34d399;
}

[data-theme="dark"] .kpi-warning .kpi-value {
    color: #fbbf24;
}

[data-theme="dark"] .kpi-danger .kpi-value {
    color: #f87171;
}

[data-theme="dark"] .kpi-info .kpi-value {
    color: #22d3ee;
}

[data-theme="dark"] .kpi-purple .kpi-value {
    color: #a78bfa;
}

[data-theme="dark"] .kpi-description {
    color: rgba(156, 163, 175, 0.8);
}

/* ===== تحسينات Card Header و Card Body ===== */
.card-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--card-border);
    background: var(--card-gradient);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.card-body {
    padding: 2rem;
    position: relative;
}

[data-theme="dark"] .card-header {
    background: linear-gradient(135deg, rgba(37, 37, 37, 0.95) 0%, rgba(31, 41, 55, 0.98) 100%);
    border-bottom-color: rgba(55, 65, 81, 0.6);
}

[data-theme="dark"] .card-body {
    background: var(--card-gradient-dark);
}

/* ===== تحسينات Responsive للكروت ===== */
@media (max-width: 1280px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 1.5rem;
    }

    .kpi-card {
        padding: 1.75rem 1.5rem;
        min-height: 130px;
    }

    .kpi-icon {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
        font-size: 1.75rem;
        border-radius: 16px;
    }

    .kpi-value {
        font-size: 2.25rem;
    }
}

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.25rem;
    }

    .kpi-card {
        padding: 1.5rem 1.25rem;
        gap: 1.25rem;
        min-height: 120px;
    }

    .kpi-icon {
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
        font-size: 1.5rem;
        border-radius: 14px;
    }

    .kpi-value {
        font-size: 2rem;
    }

    .kpi-label {
        font-size: 0.875rem;
    }

    .card-header {
        padding: 1.5rem 1.75rem;
    }

    .card-body {
        padding: 1.75rem;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .kpi-card {
        padding: 1.25rem 1rem;
        gap: 1rem;
        min-height: 110px;
        flex-direction: row;
    }

    .kpi-icon {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        font-size: 1.375rem;
        border-radius: 12px;
    }

    .kpi-value {
        font-size: 1.75rem;
    }

    .kpi-label {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }

    .kpi-description {
        font-size: 0.75rem;
    }

    .card-header {
        padding: 1.25rem 1.5rem;
    }

    .card-body {
        padding: 1.5rem;
    }

    .content-card {
        border-radius: 16px;
    }

    .kpi-card {
        border-radius: 16px;
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .kpi-card {
        padding: 1.25rem;
        gap: 1rem;
        min-height: 120px;
    }

    .kpi-icon {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
        font-size: 1.5rem;
    }

    .kpi-value {
        font-size: 2rem;
    }

    .kpi-label {
        font-size: 0.875rem;
    }

    .card-header {
        padding: 1.25rem;
    }

    .card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .kpi-card {
        padding: 1rem;
        gap: 0.875rem;
        min-height: 110px;
    }

    .kpi-icon {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        font-size: 1.25rem;
        border-radius: 12px;
    }

    .kpi-value {
        font-size: 1.625rem;
    }

    .kpi-label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }

    .kpi-description {
        font-size: 0.6875rem;
    }

    .card-header {
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .content-card,
    .kpi-card {
        border-radius: 14px;
    }
}

/* ===== تحسينات للأداء ===== */
.kpi-card,
.content-card {
    contain: layout style paint;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -o-transform: translateZ(0);
    transform: translateZ(0);
    /* Fallback للمتصفحات التي لا تدعم contain */
}

@supports not (contain: layout) {

    .kpi-card,
    .content-card {
        isolation: isolate;
    }
}

/* ===== منع انكسار العناصر ===== */
.kpi-content,
.kpi-label,
.kpi-value,
.kpi-description {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
}

.kpi-icon i {
    display: inline-block;
    width: 1em;
    text-align: center;
    flex-shrink: 0;
}

/* ===== تحسينات للكروت داخل content-card ===== */
.content-card .kpi-card {
    margin: 0;
    box-shadow: none;
}

.content-card .kpi-card:hover {
    -webkit-transform: translateY(-2px) scale(1.01);
    -moz-transform: translateY(-2px) scale(1.01);
    -ms-transform: translateY(-2px) scale(1.01);
    -o-transform: translateY(-2px) scale(1.01);
    transform: translateY(-2px) scale(1.01);
}

/* ===== تحسينات للكروت في Grid layouts ===== */
.grid .content-card {
    height: 100%;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.grid .content-card .card-body {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -moz-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

/* ===== تحسينات للوضع الليلي - ظلال منخفضة ===== */
[data-theme="dark"] .content-card,
[data-theme="dark"] .kpi-card {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .content-card:hover,
[data-theme="dark"] .kpi-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* ===== تحسينات Contrast للوضع الليلي ===== */
[data-theme="dark"] .kpi-label,
[data-theme="dark"] .kpi-value,
[data-theme="dark"] .kpi-description {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== تحسينات للكروت مع أيقونات Font Awesome ===== */
.content-card .fas,
.content-card .far,
.content-card .fal,
.kpi-card .fas,
.kpi-card .far,
.kpi-card .fal {
    display: inline-block;
    width: 1em;
    text-align: center;
    flex-shrink: 0;
}

/* ===== تحسينات للكروت في Grid layouts الأخرى ===== */
.grid.grid-cols-1 .content-card,
.grid.grid-cols-2 .content-card,
.grid.grid-cols-3 .content-card,
.grid.grid-cols-4 .content-card,
.grid.grid-cols-5 .content-card {
    height: auto;
    min-height: fit-content;
}

/* ===== تحسينات للكروت مع flex layouts ===== */
.flex.items-center.justify-between .content-card {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -moz-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    margin: 0 0.5rem;
}

.flex.items-center.justify-between .content-card:first-child {
    margin-right: 0;
}

.flex.items-center.justify-between .content-card:last-child {
    margin-left: 0;
}

/* ===== تحسينات للكروت في Mobile Landscape ===== */
@media (max-width: 896px) and (orientation: landscape) {
    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }

    .kpi-card {
        padding: 1rem;
        min-height: 100px;
    }

    .kpi-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1.125rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }
}

/* ===== تحسينات للطباعة ===== */
@media print {

    .content-card,
    .kpi-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        page-break-inside: avoid;
    }

    .kpi-card:hover,
    .content-card:hover {
        -webkit-transform: none;
        -moz-transform: none;
        -ms-transform: none;
        -o-transform: none;
        transform: none;
    }
}

/* ========================================
   تحسينات التوافق للمتصفحات والهواتف
   ======================================== */

/* ===== تحسينات خاصة لـ iOS Safari ===== */
@supports (-webkit-touch-callout: none) {

    .content-card,
    .kpi-card {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000px;
        perspective: 1000px;
    }

    .kpi-icon {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    /* إصلاح مشكلة viewport height في iOS */
    .kpi-grid {
        min-height: -webkit-fill-available;
    }

    /* تحسينات للـ touch events */
    .content-card:active,
    .kpi-card:active {
        -webkit-transform: translateY(-2px) scale(1.005);
        transform: translateY(-2px) scale(1.005);
    }
}

/* ===== تحسينات خاصة لـ Android Chrome ===== */
@supports (-webkit-appearance: none) and (not (-webkit-touch-callout: none)) {

    .content-card,
    .kpi-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }

    /* تحسينات للـ touch events في Android */
    .content-card:active,
    .kpi-card:active {
        -webkit-transform: translateY(-2px) scale(1.005);
        transform: translateY(-2px) scale(1.005);
    }
}

/* ===== تحسينات خاصة لـ Firefox ===== */
@-moz-document url-prefix() {

    .content-card,
    .kpi-card {
        -moz-transform: translateZ(0);
        transform: translateZ(0);
    }

    .kpi-grid {
        display: -moz-grid;
        display: grid;
    }

    /* إصلاح مشكلة backdrop-filter في Firefox القديم */
    @supports not (backdrop-filter: blur(10px)) {

        .content-card,
        .kpi-card {
            background: #ffffff;
        }

        [data-theme="dark"] .content-card,
        [data-theme="dark"] .kpi-card {
            background: #1f2937;
        }
    }
}

/* ===== تحسينات خاصة لـ Edge (Legacy) ===== */
@supports (-ms-ime-align: auto) {
    .kpi-grid {
        display: -ms-grid;
        -ms-grid-columns: 1fr 1fr 1fr;
        -ms-grid-rows: auto;
    }

    .kpi-card {
        -ms-grid-column: auto;
        grid-column: auto;
        -ms-grid-row: auto;
        grid-row: auto;
    }
}

/* ===== تحسينات للمتصفحات القديمة (IE11) ===== */
@media screen and (-ms-high-contrast: active),
(-ms-high-contrast: none) {
    .kpi-grid {
        display: -ms-flexbox;
        display: flex;
        -ms-flex-wrap: wrap;
        flex-wrap: wrap;
    }

    .kpi-card {
        -ms-flex: 1 1 280px;
        flex: 1 1 280px;
        margin: 0.875rem;
    }

    .content-card,
    .kpi-card {
        background: #ffffff;
    }

    [data-theme="dark"] .content-card,
    [data-theme="dark"] .kpi-card {
        background: #1f2937;
    }
}

/* ===== تحسينات للشاشات الصغيرة جداً (أقل من 320px) ===== */
@media (max-width: 320px) {
    .kpi-grid {
        grid-template-columns: 1fr;
        -ms-grid-columns: 1fr;
        gap: 0.75rem;
        -webkit-column-gap: 0.75rem;
        -moz-column-gap: 0.75rem;
        column-gap: 0.75rem;
        row-gap: 0.75rem;
    }

    .kpi-card {
        padding: 1rem 0.875rem;
        gap: 0.75rem;
        -webkit-column-gap: 0.75rem;
        -moz-column-gap: 0.75rem;
        column-gap: 0.75rem;
        min-height: 100px;
    }

    .kpi-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1.125rem;
        border-radius: 12px;
        -webkit-border-radius: 12px;
        -moz-border-radius: 12px;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .kpi-label {
        font-size: 0.75rem;
    }

    .card-header {
        padding: 0.875rem;
    }

    .card-body {
        padding: 0.875rem;
    }
}

/* ===== تحسينات للشاشات الكبيرة جداً (أكثر من 1920px) ===== */
@media (min-width: 1920px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        -ms-grid-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
        -webkit-column-gap: 2rem;
        -moz-column-gap: 2rem;
        column-gap: 2rem;
        row-gap: 2rem;
    }

    .kpi-card {
        padding: 2.5rem 2rem;
        min-height: 160px;
    }

    .kpi-icon {
        width: 80px;
        height: 80px;
        min-width: 80px;
        min-height: 80px;
        font-size: 2.25rem;
    }

    .kpi-value {
        font-size: 3rem;
    }
}

/* ===== تحسينات للوضع الأفقي في الهواتف ===== */
@media (max-width: 896px) and (orientation: landscape) {
    .kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        -ms-grid-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
        -webkit-column-gap: 1rem;
        -moz-column-gap: 1rem;
        column-gap: 1rem;
        row-gap: 1rem;
    }

    .kpi-card {
        padding: 1rem;
        min-height: 100px;
        gap: 0.875rem;
        -webkit-column-gap: 0.875rem;
        -moz-column-gap: 0.875rem;
        column-gap: 0.875rem;
    }

    .kpi-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1.125rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .kpi-label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }
}

/* ===== تحسينات للـ touch devices ===== */
@media (hover: none) and (pointer: coarse) {

    .content-card:hover,
    .kpi-card:hover {
        -webkit-transform: none;
        -moz-transform: none;
        -ms-transform: none;
        -o-transform: none;
        transform: none;
    }

    .content-card:active,
    .kpi-card:active {
        -webkit-transform: translateY(-2px) scale(1.01);
        -moz-transform: translateY(-2px) scale(1.01);
        -ms-transform: translateY(-2px) scale(1.01);
        -o-transform: translateY(-2px) scale(1.01);
        transform: translateY(-2px) scale(1.01);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        -moz-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    /* زيادة حجم الـ touch targets */
    .kpi-card {
        min-height: 120px;
        padding: 1.5rem;
    }

    .kpi-icon {
        width: 64px;
        height: 64px;
        min-width: 64px;
        min-height: 64px;
    }
}

/* ===== تحسينات للشاشات عالية الدقة (Retina) ===== */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .content-card,
    .kpi-card {
        border-width: 0.5px;
    }

    .kpi-icon {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }
}

/* ===== تحسينات للوضع المقلوب (RTL) ===== */
[dir="rtl"] .kpi-card::before {
    right: auto;
    left: 0;
}

[dir="rtl"] .content-card::before {
    left: auto;
    right: 0;
}

/* ===== تحسينات للوصولية (Accessibility) ===== */
@media (prefers-reduced-motion: reduce) {

    .content-card,
    .kpi-card,
    .kpi-icon {
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none;
        -webkit-animation: none;
        -moz-animation: none;
        -o-animation: none;
        animation: none;
    }

    .content-card:hover,
    .kpi-card:hover {
        -webkit-transform: none;
        -moz-transform: none;
        -ms-transform: none;
        -o-transform: none;
        transform: none;
    }
}

/* ===== تحسينات للوضع عالي التباين ===== */
@media (prefers-contrast: high) {

    .content-card,
    .kpi-card {
        border-width: 2px;
        border-color: currentColor;
    }

    .kpi-icon {
        border: 2px solid currentColor;
    }
}

/* ===== Fallback للمتصفحات التي لا تدعم CSS Variables ===== */
@supports not (--css: variables) {
    .content-card {
        background: #ffffff;
        border-color: #e5e7eb;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .kpi-card {
        background: #ffffff;
        border-color: #e5e7eb;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    [data-theme="dark"] .content-card,
    [data-theme="dark"] .kpi-card {
        background: #1f2937;
        border-color: #3a3a3a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
    }
}

/* ===== تحسينات للكروت مع خلفيات ملونة (bg-blue-100, bg-red-100, etc.) ===== */
.content-card .bg-blue-100,
.content-card .bg-red-100,
.content-card .bg-yellow-100,
.content-card .bg-green-100,
.content-card .bg-purple-100,
.content-card .bg-indigo-100,
.content-card .bg-pink-100,
.content-card .bg-gray-100 {
    border-radius: 16px;
    padding: 1rem;
    transition: var(--card-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.content-card:hover .bg-blue-100,
.content-card:hover .bg-red-100,
.content-card:hover .bg-yellow-100,
.content-card:hover .bg-green-100,
.content-card:hover .bg-purple-100,
.content-card:hover .bg-indigo-100,
.content-card:hover .bg-pink-100,
.content-card:hover .bg-gray-100 {
    -webkit-transform: scale(1.05);
    -moz-transform: scale(1.05);
    -ms-transform: scale(1.05);
    -o-transform: scale(1.05);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    -webkit-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    -moz-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* تحسينات للوضع الليلي - خلفيات ملونة */
[data-theme="dark"] .content-card .bg-blue-100 {
    background: rgba(59, 130, 246, 0.2) !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .content-card .bg-red-100 {
    background: rgba(239, 68, 68, 0.2) !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .content-card .bg-yellow-100 {
    background: rgba(245, 158, 11, 0.2) !important;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .content-card .bg-green-100 {
    background: rgba(16, 185, 129, 0.2) !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .content-card .bg-purple-100 {
    background: rgba(139, 92, 246, 0.2) !important;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .content-card .bg-indigo-100 {
    background: rgba(99, 102, 241, 0.2) !important;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .content-card .bg-pink-100 {
    background: rgba(236, 72, 153, 0.2) !important;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

[data-theme="dark"] .content-card .bg-gray-100 {
    background: rgba(156, 163, 175, 0.15) !important;
    border: 1px solid rgba(156, 163, 175, 0.25);
}

/* تحسينات للأيقونات داخل الخلفيات الملونة */
.content-card .bg-blue-100 i,
.content-card .bg-red-100 i,
.content-card .bg-yellow-100 i,
.content-card .bg-green-100 i,
.content-card .bg-purple-100 i,
.content-card .bg-indigo-100 i,
.content-card .bg-pink-100 i,
.content-card .bg-gray-100 i {
    transition: var(--icon-transition);
    display: inline-block;
    width: 1em;
    text-align: center;
}

.content-card:hover .bg-blue-100 i,
.content-card:hover .bg-red-100 i,
.content-card:hover .bg-yellow-100 i,
.content-card:hover .bg-green-100 i,
.content-card:hover .bg-purple-100 i,
.content-card:hover .bg-indigo-100 i,
.content-card:hover .bg-pink-100 i,
.content-card:hover .bg-gray-100 i {
    -webkit-transform: scale(1.1) rotate(5deg);
    -moz-transform: scale(1.1) rotate(5deg);
    -ms-transform: scale(1.1) rotate(5deg);
    -o-transform: scale(1.1) rotate(5deg);
    transform: scale(1.1) rotate(5deg);
}

/* تحسينات للنصوص داخل الكروت */
.content-card .text-blue-600,
.content-card .text-red-600,
.content-card .text-yellow-600,
.content-card .text-green-600,
.content-card .text-purple-600,
.content-card .text-indigo-600,
.content-card .text-pink-600,
.content-card .text-gray-600 {
    transition: color 0.3s ease;
    font-weight: 700;
}

[data-theme="dark"] .content-card .text-blue-600 {
    color: #60a5fa !important;
}

[data-theme="dark"] .content-card .text-red-600 {
    color: #f87171 !important;
}

[data-theme="dark"] .content-card .text-yellow-600 {
    color: #fbbf24 !important;
}

[data-theme="dark"] .content-card .text-green-600 {
    color: #34d399 !important;
}

[data-theme="dark"] .content-card .text-purple-600 {
    color: #a78bfa !important;
}

[data-theme="dark"] .content-card .text-indigo-600 {
    color: #818cf8 !important;
}

[data-theme="dark"] .content-card .text-pink-600 {
    color: #f472b6 !important;
}

[data-theme="dark"] .content-card .text-gray-600 {
    color: #d1d5db !important;
}

/* تحسينات للكروت في Grid layouts مع خلفيات ملونة */
.grid .content-card .bg-blue-100,
.grid .content-card .bg-red-100,
.grid .content-card .bg-yellow-100,
.grid .content-card .bg-green-100 {
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    flex-shrink: 0;
}

@media (max-width: 768px) {

    .grid .content-card .bg-blue-100,
    .grid .content-card .bg-red-100,
    .grid .content-card .bg-yellow-100,
    .grid .content-card .bg-green-100 {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {

    .grid .content-card .bg-blue-100,
    .grid .content-card .bg-red-100,
    .grid .content-card .bg-yellow-100,
    .grid .content-card .bg-green-100 {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        padding: 0.625rem;
    }
}

/* تحسينات للكروت مع rounded-full */
.content-card .rounded-full {
    border-radius: 50% !important;
    aspect-ratio: 1;
}

/* تحسينات للكروت في HSE Dashboard */
.grid.grid-cols-1 .content-card,
.grid.grid-cols-2 .content-card,
.grid.grid-cols-3 .content-card,
.grid.grid-cols-4 .content-card,
.grid.grid-cols-5 .content-card {
    transition: var(--card-transition);
}

.grid.grid-cols-1 .content-card:hover,
.grid.grid-cols-2 .content-card:hover,
.grid.grid-cols-3 .content-card:hover,
.grid.grid-cols-4 .content-card:hover,
.grid.grid-cols-5 .content-card:hover {
    -webkit-transform: translateY(-4px) scale(1.01);
    -moz-transform: translateY(-4px) scale(1.01);
    -ms-transform: translateY(-4px) scale(1.01);
    -o-transform: translateY(-4px) scale(1.01);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    box-shadow: var(--card-shadow-hover);
    -webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
    -moz-box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* تحسينات للنصوص داخل الكروت */
.content-card .text-sm,
.content-card .text-xs,
.content-card .text-2xl,
.content-card .text-xl {
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

.content-card .font-bold,
.content-card .font-semibold {
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* تحسينات للكروت مع flex layouts */
.content-card .flex.items-center.justify-between {
    gap: 1rem;
    flex-wrap: wrap;
}

.content-card .flex.items-center.justify-between>div:first-child {
    flex: 1;
    min-width: 0;
}

.content-card .flex.items-center.justify-between>div:last-child {
    flex-shrink: 0;
}

/* تحسينات للكروت في Safety Budget Dashboard */
.content-card .mb-1,
.content-card .mt-1 {
    margin-bottom: 0.25rem;
    margin-top: 0.25rem;
}

/* تحسينات للكروت مع progress bars */
.content-card .bg-gray-200 {
    background: rgba(229, 231, 235, 0.5) !important;
    border-radius: 8px;
    overflow: hidden;
}

[data-theme="dark"] .content-card .bg-gray-200 {
    background: rgba(55, 65, 81, 0.5) !important;
}

.content-card .bg-blue-600,
.content-card .bg-green-600,
.content-card .bg-red-600,
.content-card .bg-yellow-600 {
    border-radius: 8px;
    transition: width 0.5s ease;
}

/* ===== Contractor Evaluation Form Enhancements ===== */
.modal-content[style*="1400px"] {
    animation: slideUpScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpScale {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced form input focus states */
#contractor-evaluation-form .form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transition: all 0.3s ease;
}

/* Radio button label transitions */
#contractor-evaluation-form label[style*="cursor: pointer"] {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#contractor-evaluation-form label[style*="cursor: pointer"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Table row hover effects */
#contractor-evaluation-form tbody tr {
    transition: all 0.2s ease;
}

#contractor-evaluation-form tbody tr:hover {
    background-color: #f8fafc !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Summary cards animation */
#contractor-evaluation-form input[readonly][id*="evaluation"] {
    transition: all 0.3s ease;
}

/* Responsive adjustments for evaluation form */
@media (max-width: 1440px) {
    .modal-content[style*="1400px"] {
        width: 95vw !important;
        max-width: 95vw !important;
    }
}

@media (max-width: 768px) {
    .modal-content[style*="1400px"] {
        width: 98vw !important;
        max-width: 98vw !important;
        max-height: 98vh !important;
    }

    #contractor-evaluation-form .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    #contractor-evaluation-form .grid.md\\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }

    #contractor-evaluation-form table {
        font-size: 0.875rem;
    }

    #contractor-evaluation-form th,
    #contractor-evaluation-form td {
        padding: 0.75rem 0.5rem !important;
    }
}

/* Dark mode support for evaluation form */
[data-theme="dark"] #contractor-evaluation-form {
    background: var(--bg-primary) !important;
}

[data-theme="dark"] #contractor-evaluation-form .form-input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] #contractor-evaluation-form tbody tr {
    border-color: var(--border-color);
}

[data-theme="dark"] #contractor-evaluation-form tbody tr:hover {
    background-color: var(--bg-secondary) !important;
}

/* ===== Daily Observations Form - Enhanced Colors & Styling ===== */

/* Form Overlay with Gradient Background */
.observation-form-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.55);
    padding: 1rem;
    z-index: 10000;
}

/* Enhanced Modal Container */
.observation-form-modal {
    max-width: 900px;
    width: 100%;
    max-height: 92vh;
    box-shadow: 0 25px 70px rgba(0, 56, 101, 0.35);
    border: 2px solid rgba(0, 56, 101, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Vibrant Header with Gradient */
.observation-form-header {
    background: linear-gradient(135deg, #003865 0%, #0056A3 50%, #003865 100%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.observation-form-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.observation-form-title {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    font-size: 1.375rem;
    margin: 0;
}

.observation-form-close {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.observation-form-close:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.1);
}

/* Enhanced Step Containers with Color Coding */
.observation-form-step {
    border-radius: 12px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.observation-step-1 {
    background: #ffffff;
    border: 2px solid #e0f2fe;
    border-right: 4px solid #0ea5e9;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
}

.observation-step-2 {
    background: #ffffff;
    border: 2px solid #fed7aa;
    border-right: 4px solid #f97316;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.1);
}

[data-theme="dark"] .observation-step-1 {
    background: #1e293b;
    border-color: #0c4a6e;
    border-right-color: #0ea5e9;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

[data-theme="dark"] .observation-step-2 {
    background: #1e293b;
    border-color: #7c2d12;
    border-right-color: #f97316;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

/* Step Headers with Colorful Accents */
.step-header {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid;
}

.observation-step-1 .step-header {
    border-bottom-color: #bae6fd;
}

.observation-step-2 .step-header {
    border-bottom-color: #fed7aa;
}

[data-theme="dark"] .observation-step-1 .step-header {
    border-bottom-color: #0c4a6e;
}

[data-theme="dark"] .observation-step-2 .step-header {
    border-bottom-color: #7c2d12;
}

/* Enhanced Step Titles with Icons */
.step-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.observation-step-1 .step-title {
    color: #0369a1;
}

.observation-step-2 .step-title {
    color: #c2410c;
}

[data-theme="dark"] .observation-step-1 .step-title {
    color: #7dd3fc;
}

[data-theme="dark"] .observation-step-2 .step-title {
    color: #fb923c;
}

/* Colorful Step Icons */
.step-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.125rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.observation-step-1 .step-icon {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #ffffff;
}

.observation-step-2 .step-icon {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff;
}

.step-icon:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Step Descriptions */
.step-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Form Labels with Color Coding */
.observation-form .form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

[data-theme="dark"] .observation-form .form-label {
    color: #cbd5e1;
}

.observation-form .form-label.required::after {
    content: '*';
    color: #ef4444;
    font-weight: 700;
    font-size: 0.875rem;
    margin-right: 0.25rem;
}


/* Enhanced Form Inputs */
.observation-form .form-input {
    border: 2px solid #cbd5e1;
    background: #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.observation-form .form-input:hover {
    border-color: #94a3b8;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.observation-form .form-input:focus {
    border-color: #003865;
    box-shadow: 0 0 0 4px rgba(0, 56, 101, 0.15), 0 4px 12px rgba(0, 56, 101, 0.2);
    transform: translateY(-1px);
    outline: none;
}

[data-theme="dark"] .observation-form .form-input {
    background: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .observation-form .form-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

/* Select Dropdowns with Custom Arrow */
.observation-form .form-select {
    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='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: 12px;
    padding-left: 2.5rem;
    padding-right: 1rem;
    cursor: pointer;
    appearance: none;
}

/* Textarea - Already updated above */

/* Readonly Fields with Distinct Style */
.observation-form .form-readonly {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

[data-theme="dark"] .observation-form .form-readonly {
    background: #334155;
    color: #94a3b8;
}

/* File Input with Enhanced Styling */
.observation-form .form-file {
    border: 2px dashed #94a3b8;
    background: #f8fafc;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.observation-form .form-file:hover {
    border-color: #003865;
    background: #f0f9ff;
    border-style: solid;
    box-shadow: 0 2px 8px rgba(0, 56, 101, 0.1);
}

/* File Input Hint with Colorful Icon */
.file-input-hint {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-right: 3px solid #3b82f6;
    color: #1e40af;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.625rem;
    font-size: 0.8125rem;
}

.file-input-hint i {
    color: #2563eb;
    font-size: 1rem;
}

[data-theme="dark"] .file-input-hint {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #bfdbfe;
}

/* Form Grid with Spacing */
.observation-form .form-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 0;
}

.observation-form .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.observation-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Enhanced Footer with Gradient */
.observation-form-footer {
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

[data-theme="dark"] .observation-form-footer {
    background: #1e293b;
    border-top-color: #334155;
}

/* Form Body */
.observation-form-body {
    padding: 1.75rem;
    overflow-y: auto;
    flex: 1;
    background: var(--bg-primary);
}

/* Enhanced Buttons */
.observation-btn-save {
    background: #003865;
    box-shadow: 0 2px 8px rgba(0, 56, 101, 0.25);
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.observation-btn-save:hover {
    background: #0056A3;
    box-shadow: 0 4px 12px rgba(0, 56, 101, 0.35);
    transform: translateY(-1px);
}

.observation-btn-save:active {
    transform: translateY(0);
}

.observation-btn-cancel {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    color: #475569;
    font-weight: 600;
    padding: 0.875rem 1.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.observation-btn-cancel:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #334155;
}

[data-theme="dark"] .observation-btn-cancel {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .observation-btn-cancel:hover {
    background: #475569;
    border-color: #64748b;
}

/* Attachments Preview with Enhanced Styling */
.attachments-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.attachment-item {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.attachment-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #003865;
}

[data-theme="dark"] .attachment-item {
    background: #1e293b;
    border-color: #475569;
}

/* Image Display Container */
.image-display-container {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .image-display-container {
    background: #1e293b;
    border-color: #475569;
}

.image-display-placeholder {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
}

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
    .observation-form-overlay {
        padding: 0.5rem;
        align-items: flex-end;
    }

    .observation-form-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    .observation-form-header {
        padding: 1.25rem 1.5rem;
    }

    .observation-form-title {
        font-size: 1.25rem;
    }

    .observation-form-body {
        padding: 1.5rem 1.25rem;
    }

    .observation-form-step {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .step-header {
        padding: 0.75rem 0;
        margin-bottom: 1.25rem;
    }

    .step-title {
        font-size: 1rem;
    }

    .step-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9375rem;
    }

    .observation-form .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .observation-form .form-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .observation-form-footer {
        padding: 1.25rem 1.5rem;
        flex-direction: column-reverse;
    }

    .observation-btn-save,
    .observation-btn-cancel {
        width: 100%;
        min-width: auto;
        padding: 1rem;
    }

    .attachments-preview {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .observation-form-modal {
        max-height: 98vh;
    }

    .observation-form-step {
        padding: 1rem;
        border-right-width: 3px;
    }

    .step-header {
        padding: 0.5rem 0;
    }

    .observation-form .form-grid {
        gap: 1rem;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .observation-form-modal {
        max-height: 98vh;
    }

    .observation-form-body {
        max-height: calc(98vh - 140px);
    }
}