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

/* ===== CSS Variables ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --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, #001a33 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;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--login-bg);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

.font-cairo {
    font-family: 'Cairo', sans-serif;
}

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

.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;
    gap: 1rem;
}

.logo-wrapper img {
    max-width: 150px;
    max-height: 100px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.logo-wrapper img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.logo-wrapper i {
    display: inline-block;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 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;
}

.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, #667eea 0%, #764ba2 100%);
    color: white;
    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;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.875rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

/* ===== Main App Layout ===== */
.main-app {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.app-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-right: var(--sidebar-width);
    background: var(--bg-secondary);
    transition: margin-right 0.3s ease;
    width: 100%;
}

/* ===== 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;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 56, 101, 0.3);
    z-index: 100;
    right: 0;
    transition: transform 0.3s ease, background 0.3s ease;
    border-left: 3px solid #FFC72C;
}

/* 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;
}

.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;
}

.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;
    transition: background-color 0.3s ease;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 90;
}

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

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

.sidebar-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

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

.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.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.sidebar-open {
    overflow: hidden;
}

.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;
}

.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;
}

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

.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;
}

.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);
}

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

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

.kpi-card.kpi-primary::before { background: var(--primary-color); }
.kpi-card.kpi-success::before { background: var(--success-color); }
.kpi-card.kpi-warning::before { background: var(--warning-color); }
.kpi-card.kpi-info::before { background: var(--info-color); }

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
    font-size: 1.5rem;
    color: white;
}

.kpi-primary .kpi-icon { background: var(--primary-color); }
.kpi-success .kpi-icon { background: var(--success-color); }
.kpi-warning .kpi-icon { background: var(--warning-color); }
.kpi-info .kpi-icon { background: var(--info-color); }

.kpi-content {
    flex: 1;
}

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

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    transition: color 0.3s ease;
}

.kpi-description {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
}

/* ===== 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;
}

/* ===== 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;
}

.notification {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    min-width: 300px;
    animation: slideInLeft 0.3s ease;
    border-right: 4px solid;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.success { border-right-color: var(--success-color); }
.notification.error { border-right-color: var(--danger-color); }
.notification.warning { border-right-color: var(--warning-color); }
.notification.info { border-right-color: var(--info-color); }

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

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

.notification-content {
    flex: 1;
}

.notification-message {
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* ===== Loading Overlay ===== */
.loading-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: 9998;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

/* ===== 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 ===== */
@media (max-width: 1024px) {
    .app-shell {
        margin-right: 0;
    }

    .sidebar {
        width: 280px;
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-topbar {
        display: flex;
    }
    
    .sidebar-toggle {
        display: inline-flex;
    }
    
    .mobile-topbar-actions {
        display: flex;
    }
    
    .main-content {
        padding: calc(4.75rem + env(safe-area-inset-top)) 1.25rem 2rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .theme-toggle {
        display: none;
    }
    
    #company-logo-header {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .login-card {
        padding: 2rem 1.5rem;
    }
    
    .main-content {
        padding: calc(4.5rem + env(safe-area-inset-top)) 1rem 1.75rem;
    }
    
    .mobile-topbar {
        padding: calc(0.8rem + env(safe-area-inset-top) / 2) 1rem;
    }
    
    .sidebar-toggle,
    .mobile-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
    
    #mobile-company-name {
        font-size: 0.95rem;
    }
}

@media (min-width: 1025px) {
    .sidebar-overlay {
        display: none;
    }
}

/* ===== 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);
}

/* ===== 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.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;
    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;
}

/* 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;
}

/* ===== 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%;
}

.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;
}

.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);
}

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

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

.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(--gray-200);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--gray-50);
}

/* ===== 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);
}

/* ===== Responsive Tables ===== */
@media (max-width: 768px) {
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-width: 95vw;
        margin: 1rem;
    }
    
    .theme-toggle {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}
