/* ============================================
   Tables - טבלאות אחידות
   תוכנית שידרוג עיצוב Enterprise מקיף
   ============================================
   
   קובץ מאוחד - מבנה אחיד לכל הטבלאות:
   - .table - טבלה בסיסית
   - .table-header - כותרת
   - .table-row - שורה
   - .table-cell - תא
   
   תאריך יצירה: 2025-01-27
   גרסה: 1.0.0
   ============================================ */

@layer components {
  /* ===== Table Wrapper ===== */
  .table-wrapper,
  .employees-table-wrapper,
  .contracts-table-wrapper,
  .materials-table-wrapper,
  .worklogs-table-wrapper,
  .projects-table-wrapper,
  .reports-table-wrapper,
  .safety-table-wrapper,
  .email-table-wrapper {
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
  }
  
  /* כותרת טבלה נקייה */
  .table-header-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
  }
  
  .table-header-section h4 {
    color: var(--text-inverse);
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
  }
  
  .table-header-actions {
    display: flex;
    gap: 0.5rem;
  }
  
  /* ===== Base Table ===== */
  /* נגישות: טקסט כהה על רקע בהיר - ניגודיות מינימלית 4.5:1 */
  .table,
  .employees-table,
  .contracts-table,
  .materials-table,
  .worklogs-table,
  .suppliers-table,
  .equipment-table,
  .orders-table,
  .invoices-table,
  .accounts-table,
  .projects-table,
  .reports-table,
  .safety-table,
  .email-table,
  table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
    border-spacing: 0;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: var(--text-sm);
    border: 1px solid var(--border-subtle);
  }
  
  /* ===== Table Header ===== */
  /* נגישות: טקסט בהיר על רקע כהה - ניגודיות מינימלית 4.5:1 */
  .table-header,
  .table thead,
  .employees-table thead,
  .contracts-table thead,
  .materials-table thead,
  .worklogs-table thead,
  .projects-table thead,
  .reports-table thead,
  .safety-table thead,
  .email-table thead,
  table thead {
    background: var(--bg-surface);
  }
  
  .table thead tr,
  .employees-table thead tr,
  .contracts-table thead tr,
  .materials-table thead tr,
  .worklogs-table thead tr,
  .projects-table thead tr,
  .reports-table thead tr,
  .safety-table thead tr,
  .email-table thead tr,
  table thead tr {
    background: var(--bg-surface);
    border-bottom: 2px solid var(--border-subtle);
  }
  
  .table-header th,
  .table thead th,
  .employees-table thead th,
  .contracts-table thead th,
  .materials-table thead th,
  .worklogs-table thead th,
  .projects-table thead th,
  .reports-table thead th,
  .safety-table thead th,
  .email-table thead th,
  table thead th {
    color: var(--text-inverse);
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid var(--border-subtle);
    white-space: nowrap;
    background: var(--bg-surface);
    text-align: right;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
  }
  
  /* חץ מיון עדין בעמודות */
  .table thead th .sort-icon,
  .employees-table thead th .sort-icon,
  .contracts-table thead th .sort-icon,
  .materials-table thead th .sort-icon,
  .worklogs-table thead th .sort-icon,
  .projects-table thead th .sort-icon,
  .reports-table thead th .sort-icon,
  .safety-table thead th .sort-icon,
  .email-table thead th .sort-icon,
  table thead th .sort-icon {
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    margin-inline-start: 0.5rem;
  }
  
  .table thead th:hover .sort-icon,
  .employees-table thead th:hover .sort-icon,
  .contracts-table thead th:hover .sort-icon,
  .materials-table thead th:hover .sort-icon,
  .worklogs-table thead th:hover .sort-icon,
  .projects-table thead th:hover .sort-icon,
  .reports-table thead th:hover .sort-icon,
  .safety-table thead th:hover .sort-icon,
  .email-table thead th:hover .sort-icon,
  table thead th:hover .sort-icon {
    opacity: 0.8;
  }
  
  /* רקע לעמודת פעולות */
  .table thead th:last-child,
  .employees-table thead th:last-child,
  .contracts-table thead th:last-child,
  .materials-table thead th:last-child,
  .worklogs-table thead th:last-child,
  .projects-table thead th:last-child,
  .reports-table thead th:last-child,
  .safety-table thead th:last-child,
  .email-table thead th:last-child,
  table thead th:last-child {
    background: rgba(255, 255, 255, 0.03);
  }
  
  .table thead th:last-child,
  .employees-table thead th:last-child,
  .contracts-table thead th:last-child,
  .materials-table thead th:last-child,
  .worklogs-table thead th:last-child,
  .projects-table thead th:last-child,
  .reports-table thead th:last-child,
  .safety-table thead th:last-child,
  .email-table thead th:last-child,
  table thead th:last-child {
    border-right: none;
  }
  
  /* ===== Table Row ===== */
  .table-row,
  .table tbody tr,
  .employees-table tbody tr,
  .contracts-table tbody tr,
  .materials-table tbody tr,
  .worklogs-table tbody tr,
  .projects-table tbody tr,
  .reports-table tbody tr,
  .safety-table tbody tr,
  .email-table tbody tr,
  table tbody tr {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.2s ease;
    color: var(--text-main);
  }
  
  .table-row:nth-child(even),
  .table tbody tr:nth-child(even),
  .employees-table tbody tr:nth-child(even),
  .contracts-table tbody tr:nth-child(even),
  .materials-table tbody tr:nth-child(even),
  .worklogs-table tbody tr:nth-child(even),
  .projects-table tbody tr:nth-child(even),
  .reports-table tbody tr:nth-child(even),
  .safety-table tbody tr:nth-child(even),
  .email-table tbody tr:nth-child(even),
  table tbody tr:nth-child(even) {
    background: var(--surface-100);
  }
  
  /* ===== Table Variants ===== */
  .table-bordered,
  .table.table-bordered {
    border: 1px solid var(--border-subtle);
  }
  
  .table-bordered th,
  .table-bordered td,
  .table.table-bordered th,
  .table.table-bordered td {
    border: 1px solid var(--border-subtle);
  }
  
  .table-striped tbody tr:nth-child(odd),
  .table.table-striped tbody tr:nth-child(odd) {
    background-color: var(--surface-50);
  }
  
  .table-striped tbody tr:nth-child(even),
  .table.table-striped tbody tr:nth-child(even) {
    background-color: var(--bg-surface);
  }
  
  .table-row:hover,
  .table tbody tr:hover,
  .table.table-hover tbody tr:hover,
  .employees-table tbody tr:hover,
  .contracts-table tbody tr:hover,
  .materials-table tbody tr:hover,
  .worklogs-table tbody tr:hover,
  .projects-table tbody tr:hover,
  .reports-table tbody tr:hover,
  .safety-table tbody tr:hover,
  .email-table tbody tr:hover,
  table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(-2px);
  }
  
  /* ===== Table Cell ===== */
  .table-cell,
  .table td,
  .employees-table td,
  .contracts-table td,
  .materials-table td,
  .worklogs-table td,
  .projects-table td,
  .reports-table td,
  .safety-table td,
  .email-table td,
  table td {
    padding: 1rem;
    vertical-align: middle;
    color: var(--text-inverse);
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9375rem;
    transition: all 0.2s ease;
  }
  
  .table-cell:last-child,
  .table td:last-child,
  .employees-table td:last-child,
  .contracts-table td:last-child,
  .materials-table td:last-child,
  .worklogs-table td:last-child,
  .projects-table td:last-child,
  .reports-table td:last-child,
  .safety-table td:last-child,
  .email-table td:last-child,
  table td:last-child {
    border-right: none;
  }
  
  /* ===== Table Footer ===== */
  .table-footer,
  .table tfoot,
  .employees-table tfoot,
  .contracts-table tfoot,
  .materials-table tfoot,
  .worklogs-table tfoot,
  .projects-table tfoot,
  .reports-table tfoot,
  .safety-table tfoot,
  .email-table tfoot,
  table tfoot {
    background: transparent;
  }
  
  .table-footer td,
  .table tfoot td,
  .employees-table tfoot td,
  .contracts-table tfoot td,
  .materials-table tfoot td,
  .worklogs-table tfoot td,
  .projects-table tfoot td,
  .reports-table tfoot td,
  .safety-table tfoot td,
  .email-table tfoot td,
  table tfoot td {
    padding: var(--space-2);
    vertical-align: middle;
    color: var(--text-main);
    background: transparent;
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
  }
  
  .table tfoot tr,
  .employees-table tfoot tr,
  .contracts-table tfoot tr,
  .materials-table tfoot tr,
  .worklogs-table tfoot tr,
  .projects-table tfoot tr,
  .reports-table tfoot tr,
  .safety-table tfoot tr,
  .email-table tfoot tr,
  table tfoot tr {
    background: var(--primary-50);
    border-top: 2px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
  }
  
  /* כפתורי פעולות בטבלאות - עיצוב אחיד */
  .table .action-buttons,
  .employees-table .action-buttons,
  .contracts-table .action-buttons,
  .materials-table .action-buttons,
  .worklogs-table .action-buttons,
  .projects-table .action-buttons,
  .reports-table .action-buttons,
  .safety-table .action-buttons,
  .email-table .action-buttons,
  table .action-buttons {
    display: flex;
    gap: var(--space-1);
    align-items: center;
    justify-content: flex-start;
  }

  .table .action-buttons .btn,
  .employees-table .action-buttons .btn,
  .contracts-table .action-buttons .btn,
  .materials-table .action-buttons .btn,
  .worklogs-table .action-buttons .btn,
  .projects-table .action-buttons .btn,
  .reports-table .action-buttons .btn,
  .safety-table .action-buttons .btn,
  .email-table .action-buttons .btn,
  table .action-buttons .btn {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
  }

  /* עיצוב כפתורים בטבלאות - צבעים מהאתר - אחיד לכל הטבלאות */
  /* כפתור צפייה - כחול כהה עם מסגרת כחולה בהירה */
  .table .action-buttons .btn-outline-primary,
  .table td .btn-outline-primary,
  .employees-table .action-buttons .btn-outline-primary,
  .employees-table td .btn-outline-primary,
  .contracts-table .action-buttons .btn-outline-primary,
  .contracts-table td .btn-outline-primary,
  .materials-table .action-buttons .btn-outline-primary,
  .materials-table td .btn-outline-primary,
  .worklogs-table .action-buttons .btn-outline-primary,
  .worklogs-table td .btn-outline-primary,
  .projects-table .action-buttons .btn-outline-primary,
  .projects-table td .btn-outline-primary,
  .reports-table .action-buttons .btn-outline-primary,
  .reports-table td .btn-outline-primary,
  .safety-table .action-buttons .btn-outline-primary,
  .safety-table td .btn-outline-primary,
  .email-table .action-buttons .btn-outline-primary,
  .email-table td .btn-outline-primary,
  table .action-buttons .btn-outline-primary,
  table td .btn-outline-primary {
    color: var(--text-inverse);
    border-color: var(--primary-500);
    background: var(--primary-800);
    border-width: 2px;
  }

  .table .action-buttons .btn-outline-primary:hover,
  .table td .btn-outline-primary:hover,
  .employees-table .action-buttons .btn-outline-primary:hover,
  .employees-table td .btn-outline-primary:hover,
  .contracts-table .action-buttons .btn-outline-primary:hover,
  .contracts-table td .btn-outline-primary:hover,
  .materials-table .action-buttons .btn-outline-primary:hover,
  .materials-table td .btn-outline-primary:hover,
  .worklogs-table .action-buttons .btn-outline-primary:hover,
  .worklogs-table td .btn-outline-primary:hover,
  .projects-table .action-buttons .btn-outline-primary:hover,
  .projects-table td .btn-outline-primary:hover,
  .reports-table .action-buttons .btn-outline-primary:hover,
  .reports-table td .btn-outline-primary:hover,
  .safety-table .action-buttons .btn-outline-primary:hover,
  .safety-table td .btn-outline-primary:hover,
  .email-table .action-buttons .btn-outline-primary:hover,
  .email-table td .btn-outline-primary:hover,
  table .action-buttons .btn-outline-primary:hover,
  table td .btn-outline-primary:hover {
    color: var(--text-inverse);
    background: var(--primary-900);
    border-color: var(--primary-600);
    opacity: 0.9;
  }

  /* כפתור עריכה - לבן עם מסגרת שחורה */
  .table .action-buttons .btn-outline-secondary,
  .table td .btn-outline-secondary,
  .employees-table .action-buttons .btn-outline-secondary,
  .employees-table td .btn-outline-secondary,
  .contracts-table .action-buttons .btn-outline-secondary,
  .contracts-table td .btn-outline-secondary,
  .materials-table .action-buttons .btn-outline-secondary,
  .materials-table td .btn-outline-secondary,
  .worklogs-table .action-buttons .btn-outline-secondary,
  .worklogs-table td .btn-outline-secondary,
  .projects-table .action-buttons .btn-outline-secondary,
  .projects-table td .btn-outline-secondary,
  .reports-table .action-buttons .btn-outline-secondary,
  .reports-table td .btn-outline-secondary,
  .safety-table .action-buttons .btn-outline-secondary,
  .safety-table td .btn-outline-secondary,
  .email-table .action-buttons .btn-outline-secondary,
  .email-table td .btn-outline-secondary,
  table .action-buttons .btn-outline-secondary,
  table td .btn-outline-secondary {
    color: var(--text-main);
    border-color: var(--text-main);
    background: var(--bg-surface);
    border-width: 2px;
  }

  .table .action-buttons .btn-outline-secondary:hover,
  .table td .btn-outline-secondary:hover,
  .employees-table .action-buttons .btn-outline-secondary:hover,
  .employees-table td .btn-outline-secondary:hover,
  .contracts-table .action-buttons .btn-outline-secondary:hover,
  .contracts-table td .btn-outline-secondary:hover,
  .materials-table .action-buttons .btn-outline-secondary:hover,
  .materials-table td .btn-outline-secondary:hover,
  .worklogs-table .action-buttons .btn-outline-secondary:hover,
  .worklogs-table td .btn-outline-secondary:hover,
  .projects-table .action-buttons .btn-outline-secondary:hover,
  .projects-table td .btn-outline-secondary:hover,
  .reports-table .action-buttons .btn-outline-secondary:hover,
  .reports-table td .btn-outline-secondary:hover,
  .safety-table .action-buttons .btn-outline-secondary:hover,
  .safety-table td .btn-outline-secondary:hover,
  .email-table .action-buttons .btn-outline-secondary:hover,
  .email-table td .btn-outline-secondary:hover,
  table .action-buttons .btn-outline-secondary:hover,
  table td .btn-outline-secondary:hover {
    color: var(--text-main);
    background: var(--bg-secondary);
    border-color: var(--text-main);
  }


  /* עיצוב תגיות סטטוס בטבלאות */
  .table .badge,
  .employees-table .badge,
  .contracts-table .badge,
  .materials-table .badge,
  .worklogs-table .badge,
  .projects-table .badge,
  table .badge {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
  }

  /* עיצוב קישורים בטבלאות - שיפור */
  .table tbody a,
  .employees-table tbody a,
  .contracts-table tbody a,
  .materials-table tbody a,
  .worklogs-table tbody a,
  .projects-table tbody a,
  .reports-table tbody a,
  .safety-table tbody a,
  .email-table tbody a,
  table tbody a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .table tbody a:hover,
  .employees-table tbody a:hover,
  .contracts-table tbody a:hover,
  .materials-table tbody a:hover,
  .worklogs-table tbody a:hover,
  .projects-table tbody a:hover,
  .reports-table tbody a:hover,
  .safety-table tbody a:hover,
  .email-table tbody a:hover,
  table tbody a:hover {
    color: var(--primary-700);
    text-decoration: underline;
  }

  /* עיצוב טקסט משני בטבלאות */
  .table .text-secondary,
  .table .text-muted,
  table .text-secondary,
  table .text-muted {
    color: var(--text-secondary);
  }

  /* עיצוב טקסט הצלחה/אזהרה/שגיאה בטבלאות */
  .table .text-success,
  table .text-success {
    color: var(--success-600);
  }

  .table .text-warning,
  table .text-warning {
    color: var(--warning-600);
  }

  .table .text-danger,
  table .text-danger {
    color: var(--error-600);
  }

  /* ===== Table Row Variants ===== */
  .table-success,
  .table tbody tr.table-success {
    background-color: var(--success-50);
    color: var(--success-900);
  }
  
  .table-danger,
  .table tbody tr.table-danger {
    background-color: var(--error-50);
    color: var(--error-900);
  }
  
  .table-warning,
  .table tbody tr.table-warning {
    background-color: var(--warning-50);
    color: var(--warning-900);
  }
  
  .table-info,
  .table tbody tr.table-info {
    background-color: var(--info-50);
    color: var(--info-900);
  }
  
  .table-primary,
  .table tbody tr.table-primary {
    background-color: var(--primary-50);
    color: var(--primary-900);
  }
  
  /* ARIA Support - תמיכה ב-ARIA לטבלאות */
  .table th[scope="col"],
  .table th[scope="row"] {
    font-weight: 600;
  }
  
  .table th[aria-sort] {
    cursor: pointer;
    user-select: none;
  }
  
  .table th[aria-sort="ascending"]::after {
    content: " ▲";
    font-size: 0.75em;
    color: var(--primary-500);
    margin-inline-start: var(--space-1);
  }
  
  .table th[aria-sort="descending"]::after {
    content: " ▼";
    font-size: 0.75em;
    color: var(--primary-500);
    margin-inline-start: var(--space-1);
  }
  
  /* Table Caption - כותרת טבלה */
  .table caption {
    caption-side: top;
    text-align: right;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
  }
  
  [dir="rtl"] .table caption {
    text-align: right;
  }
  
  [dir="ltr"] .table caption {
    text-align: left;
  }
  
  /* ===== Overflow Rules for Tables ===== */
  /* תאי טבלה צריכים overflow: visible כדי למנוע סרגל גלילה מיותר */
  .table td,
  .employees-table td,
  .contracts-table td,
  .materials-table td,
  .worklogs-table td,
  .projects-table td,
  .reports-table td,
  .safety-table td,
  .email-table td,
  .contractors-table td,
  table td {
    overflow-x: visible;
    overflow-y: visible;
    max-width: none;
  }
  
  /* תאי טבלה עם btn-group */
  .table td .btn-group,
  .employees-table td .btn-group,
  .contracts-table td .btn-group,
  .materials-table td .btn-group,
  .worklogs-table td .btn-group,
  .projects-table td .btn-group,
  .reports-table td .btn-group,
  .safety-table td .btn-group,
  .email-table td .btn-group,
  .contractors-table td .btn-group,
  table td .btn-group {
    overflow-x: visible;
    overflow-y: visible;
    max-width: none;
  }
  
  /* תאי טבלה עם table-actions */
  .table td .table-actions,
  .responsive-table td .table-actions,
  .employees-table td .table-actions,
  .contracts-table td .table-actions,
  .materials-table td .table-actions,
  .worklogs-table td .table-actions,
  .projects-table td .table-actions,
  .reports-table td .table-actions,
  .safety-table td .table-actions,
  .email-table td .table-actions,
  .contractors-table td .table-actions,
  table td .table-actions {
    overflow-x: visible;
    overflow-y: visible;
    max-width: none;
    white-space: nowrap;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
  }
  
  /* כפתורים בתוך table-actions */
  .table td .table-actions .btn,
  .responsive-table td .table-actions .btn,
  .employees-table td .table-actions .btn,
  .contracts-table td .table-actions .btn,
  .materials-table td .table-actions .btn,
  .worklogs-table td .table-actions .btn,
  .projects-table td .table-actions .btn,
  .reports-table td .table-actions .btn,
  .safety-table td .table-actions .btn,
  .email-table td .table-actions .btn,
  .contractors-table td .table-actions .btn,
  table td .table-actions .btn {
    overflow-x: visible;
    overflow-y: visible;
    max-width: none;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: auto;
  }
  
  /* וידוא ש-table-container לא יוצר גלישה */
  .table-container,
  .table-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* גלילה אופקית לטבלאות */
  }
  
  /* הגדרות בסיסיות - גלילה עם "חלון" */
  .table-responsive,
  .responsive-table-container {
    overflow-x: scroll;
    overflow-y: auto;
    max-height: 300px; /* גובה ל-6 שורות - "חלון" לטבלה */
    scrollbar-width: thin; /* Firefox - scrollbar דק */
    -ms-overflow-style: auto; /* IE/Edge - scrollbar גלוי */
    display: block;
    position: relative;
  }
  
  /* Scrollbar styling - WebKit (Chrome, Safari, Opera) */
  .table-responsive::-webkit-scrollbar,
  .responsive-table-container::-webkit-scrollbar {
    display: block;
    height: 10px;
    width: 10px;
  }
  
  /* הסרת scrollbar תחתון מ-table-responsive */
  .table-responsive-mobile,
  .contracts-table-responsive,
  .employees-table-responsive,
  .materials-table-responsive,
  .equipment-table-responsive,
  .suppliers-table-responsive,
  .orders-table-responsive,
  .worklogs-table-responsive,
  .invoices-table-responsive,
  .accounts-table-responsive,
  .projects-table-responsive,
  .reports-table-responsive,
  .safety-table-responsive,
  .email-table-responsive,
  .dashboard-advanced-table-responsive,
  .integrations-advanced-table-responsive,
  .communication-advanced-table-responsive,
  .settings-table-responsive {
    /* הסרת scrollbar תחתון */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }
  
  .table-responsive-mobile::-webkit-scrollbar,
  .contracts-table-responsive::-webkit-scrollbar,
  .employees-table-responsive::-webkit-scrollbar,
  .materials-table-responsive::-webkit-scrollbar,
  .equipment-table-responsive::-webkit-scrollbar,
  .suppliers-table-responsive::-webkit-scrollbar,
  .orders-table-responsive::-webkit-scrollbar,
  .worklogs-table-responsive::-webkit-scrollbar,
  .invoices-table-responsive::-webkit-scrollbar,
  .accounts-table-responsive::-webkit-scrollbar,
  .projects-table-responsive::-webkit-scrollbar,
  .reports-table-responsive::-webkit-scrollbar,
  .safety-table-responsive::-webkit-scrollbar,
  .email-table-responsive::-webkit-scrollbar,
  .dashboard-advanced-table-responsive::-webkit-scrollbar,
  .integrations-advanced-table-responsive::-webkit-scrollbar,
  .communication-advanced-table-responsive::-webkit-scrollbar,
  .settings-table-responsive::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
    width: 0;
    height: 0;
  }
  
  /* וידוא ש-pagination container לא יוצר overflow */
  .pagination {
    overflow-x: visible;
    overflow-y: visible;
    max-width: 100%;
  }

  /* ===== Responsive Design - רספונסיביות למובייל ===== */
  @media (max-width: 768px) {
    .table-wrapper {
      padding: var(--space-2);
      margin-bottom: var(--space-3);
    }
    
    .table-header th,
    .table thead th,
    .table-cell,
    .table td {
      padding: var(--space-2) var(--space-3);
      font-size: var(--fs-sm);
    }
    
    /* טבלאות הופכות לכרטיסים במובייל */
    .table-responsive {
      display: block;
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
  }

  /* ===== עיצוב סכומים בטבלאות ===== */
  .table td,
  table td {
    font-family: var(--font-family);
  }

  /* ===== עיצוב קישורים בטבלאות - שיפור ===== */
  .table tbody a,
  .employees-table tbody a,
  .contracts-table tbody a,
  .materials-table tbody a,
  .worklogs-table tbody a,
  .projects-table tbody a,
  .reports-table tbody a,
  .safety-table tbody a,
  .email-table tbody a,
  table tbody a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .table tbody a:hover,
  .employees-table tbody a:hover,
  .contracts-table tbody a:hover,
  .materials-table tbody a:hover,
  .worklogs-table tbody a:hover,
  .projects-table tbody a:hover,
  .reports-table tbody a:hover,
  .safety-table tbody a:hover,
  .email-table tbody a:hover,
  table tbody a:hover {
    color: var(--primary-700);
    text-decoration: underline;
  }

  /* ===== עיצוב טקסט משני בטבלאות ===== */
  .table .text-secondary,
  .table .text-muted,
  table .text-secondary,
  table .text-muted {
    color: var(--text-secondary);
  }

  /* ===== עיצוב טקסט הצלחה/אזהרה/שגיאה בטבלאות ===== */
  .table .text-success,
  table .text-success {
    color: var(--success-600);
  }

  .table .text-warning,
  table .text-warning {
    color: var(--warning-600);
  }

  .table .text-danger,
  table .text-danger {
    color: var(--error-600);
  }

  /* ===== עיצוב תאים ריקים ===== */
  .table td:empty::before,
  table td:empty::before {
    content: "—";
    color: var(--text-muted);
  }

  /* ===== תיקון: הסרת סרגל גלילה מיותר מתאי טבלאות עם כפתורים ===== */
  /* וידוא ש-td עם btn-group לא יגרום לסרגל גלילה */
  .table td,
  .employees-table td,
  .contracts-table td,
  .materials-table td,
  .worklogs-table td,
  .projects-table td,
  .reports-table td,
  .safety-table td,
  .email-table td,
  table td {
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
  }

  /* וידוא ש-btn-group לא יגרום לסרגל גלילה */
  .table td .btn-group,
  .employees-table td .btn-group,
  .contracts-table td .btn-group,
  .materials-table td .btn-group,
  .worklogs-table td .btn-group,
  .projects-table td .btn-group,
  .reports-table td .btn-group,
  .safety-table td .btn-group,
  .email-table td .btn-group,
  table td .btn-group {
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
    max-width: none;
  }

  /* ===== וידוא ש-table-responsive לא יציג scrollbar כשלא צריך ===== */
  .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    /* הסרת scrollbar רק כשיש overflow אמיתי */
    scrollbar-width: thin; /* Firefox - scrollbar דק */
    -ms-overflow-style: -ms-autohiding-scrollbar; /* IE/Edge - scrollbar אוטומטי */
  }

  /* הסתרת scrollbar ב-WebKit רק כשיש overflow אמיתי */
  .table-responsive::-webkit-scrollbar {
    height: 6px; /* גובה scrollbar אופקי */
    width: 6px; /* רוחב scrollbar אנכי */
  }

  .table-responsive::-webkit-scrollbar-track {
    background: transparent;
  }

  .table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
  }

  .table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--border-primary);
  }
  
  /* ============================================
     Scrollbar styling לטבלאות responsive
     ============================================ */
  
  /* הסרת scrollbar מתחתון מטבלאות mobile */
  .table-responsive-mobile::-webkit-scrollbar,
  .contracts-table-responsive::-webkit-scrollbar,
  .employees-table-responsive::-webkit-scrollbar,
  .materials-table-responsive::-webkit-scrollbar,
  .equipment-table-responsive::-webkit-scrollbar,
  .suppliers-table-responsive::-webkit-scrollbar,
  .orders-table-responsive::-webkit-scrollbar,
  .worklogs-table-responsive::-webkit-scrollbar,
  .invoices-table-responsive::-webkit-scrollbar,
  .accounts-table-responsive::-webkit-scrollbar,
  .projects-table-responsive::-webkit-scrollbar,
  .reports-table-responsive::-webkit-scrollbar,
  .safety-table-responsive::-webkit-scrollbar,
  .email-table-responsive::-webkit-scrollbar,
  .dashboard-advanced-table-responsive::-webkit-scrollbar,
  .integrations-advanced-table-responsive::-webkit-scrollbar,
  .communication-advanced-table-responsive::-webkit-scrollbar,
  .settings-table-responsive::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
    width: 0;
    height: 0;
  }
  
  /* Scrollbar styling לטבלאות responsive */
  .table-responsive::-webkit-scrollbar-track,
  .responsive-table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f1f1f1);
    border-radius: 4px;
  }
  
  .table-responsive::-webkit-scrollbar-thumb,
  .responsive-table-container::-webkit-scrollbar-thumb {
    background: var(--primary-500, #667eea);
    border-radius: 4px;
  }
  
  .table-responsive::-webkit-scrollbar-thumb:hover,
  .responsive-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-600, #5568d3);
  }
  
  /* קיבוע שורת הכותרת (thead) בזמן גלילה */
  .table-responsive .table thead,
  .responsive-table-container .table thead,
  .responsive-table-container .responsive-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-primary, #ffffff);
  }
  
  /* וידוא שתאי הכותרת נראים טוב */
  .table-responsive .table thead th,
  .responsive-table-container .table thead th,
  .responsive-table-container .responsive-table thead th {
    background-color: var(--bg-primary, #ffffff);
    border-bottom: 2px solid var(--border-primary, #dee2e6);
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
  }
  
  /* תיקון כפתורי Pagination של DataTables */
  .pagination .page-item,
  .pagination .page-link,
  .pagination .paginate_button,
  .pagination a,
  .pagination li,
  .pagination li a,
  .page-item,
  .page-link,
  .paginate_button,
  .paginate_button a,
  [role="link"].page-link {
    white-space: normal;
    text-overflow: ellipsis;
    max-width: 100%;
    word-wrap: break-word;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-shrink: 1;
    min-width: 44px;
    min-height: 44px;
    height: auto;
  }
}

