/* ===== GuronApp palette (Phase 60B) =====
   שמות משתנים בלבד לצבעי המותג הקיימים — לא שינוי צבעים, לא theme חדש.
   מוגבל ל-app.css בלבד (לא נגעל ב-<style> פנימיים בתוך templates). */
:root {
  --guron-navy: #1a2e4a;
  --guron-blue: #2e6dc9;
  --guron-danger: #dc3545;
}

/* ===== RTL base ===== */
.rtl { direction: rtl; text-align: right; }
.rtl .card,
.rtl .table,
.rtl .table th,
.rtl .table td { direction: rtl; text-align: right; }

body { font-family: "Segoe UI", Arial, sans-serif; }
.table th, .table td { white-space: nowrap; }

/* ===== page container ===== */
.container-fluid {
  width: 100%;
  max-width: 100%;
}

/* ===== SideBar ===== */
.sidebar {
  position: fixed; top: 0; right: 0;
  width: 240px; height: 100vh;
  background: var(--guron-navy);
  display: flex; flex-direction: column;
  transition: width 0.25s ease;
  overflow: hidden; z-index: 1040;
  box-shadow: -3px 0 12px rgba(0,0,0,0.18);
}
.sidebar.collapsed { width: 60px; }

.main-content {
  margin-right: 240px;
  padding: 0.75rem 1.25rem 0.5rem;
  transition: margin-right 0.25s ease;
  box-sizing: border-box;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-content::-webkit-scrollbar { display: none; }
.main-content { -ms-overflow-style: none; scrollbar-width: none; }
.main-content.sidebar-collapsed { margin-right: 60px; }

/* Phase 62: רשת ביטחון CSS-בלבד למובייל — לא תלויה בתזמון JS בכלל.
   דורסת (!important) כל override פר-עמוד של .main-content/.sidebar כדי
   להבטיח שברוחב ≤768px ה-sidebar לעולם לא יתפוס יותר מ-60px כברירת מחדל,
   גם אם קוד JS כלשהו נכשל/מתעכב/נחסם. כפתור הכיווץ הידני (מוסיף/מסיר
   .collapsed) ממשיך לעבוד כרגיל — ההרחבה הידנית עדיין אפשרית באותה בקשה. */
@media (max-width: 768px) {
  .sidebar { width: 60px !important; }
  .sidebar:not(.collapsed) { width: 240px !important; }
  .main-content { margin-right: 60px !important; }
  .main-content:not(.sidebar-collapsed) { margin-right: 240px !important; }
}

.sidebar-brand-row {
  display: flex; align-items: center;
  padding: 14px 12px 14px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap; overflow: hidden; gap: 6px;
}

.sidebar-brand-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; overflow: hidden; flex-shrink: 0;
}

.sidebar-brand-link img {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 6px;
}

.sidebar-brand-text {
  color: #fff; font-size: 1.15rem; font-weight: 700; letter-spacing: 1px;
  transition: opacity 0.2s, width 0.2s;
}
.sidebar.collapsed .sidebar-brand-text { opacity: 0; width: 0; overflow: hidden; }

.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0;
}

.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; color: rgba(255,255,255,0.75);
  text-decoration: none; font-size: 0.92rem;
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active-nav { background: rgba(255,255,255,0.13); color: #fff; font-weight: 600; }
.sidebar-nav i { font-size: 1.15rem; flex-shrink: 0; width: 22px; text-align: center; }

.nav-label { transition: opacity 0.2s; }
.sidebar.collapsed .nav-label { opacity: 0; }

.sidebar-toggle-bar { padding: 4px 0; }

.sidebar-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; width: 100%;
  background: none; border: none;
  color: rgba(255,255,255,0.75); font-size: 0.92rem;
  cursor: pointer; text-align: right; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-toggle i { font-size: 1.15rem; flex-shrink: 0; width: 22px; text-align: center; }
.sidebar-toggle .toggle-text { transition: opacity 0.2s; white-space: nowrap; }
.sidebar.collapsed .sidebar-toggle .toggle-text { opacity: 0; width: 0; overflow: hidden; }

.sidebar-user {
  padding: 12px 12px 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden;
}

.sidebar-avatar {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 50%; background: var(--guron-blue); color: #fff;
  font-weight: 700; font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase; flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1; overflow: hidden; display: flex; flex-direction: column;
  transition: opacity 0.2s;
}

.sidebar-user-name {
  color: rgba(255,255,255,0.8); font-size: 0.85rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sidebar-org-name, .sidebar-org-switch .dropdown-toggle {
  color: rgba(255,255,255,0.5); font-size: 0.72rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: none; border: none; padding: 0; text-align: right;
}

.sidebar-org-switch .dropdown-toggle::after { vertical-align: middle; }

.sidebar.collapsed .sidebar-user-info { opacity: 0; width: 0; }

.sidebar-logout-btn {
  background: none; border: none; color: rgba(255,120,120,0.75);
  cursor: pointer; font-size: 1.1rem; padding: 4px 5px;
  flex-shrink: 0; border-radius: 5px;
  transition: color 0.15s, background 0.15s; margin-right: auto;
}

.sidebar-logout-btn:hover {
  color: #ff8888; background: rgba(255,80,80,0.12);
}

/* sidebar bottom nav */
.sidebar-nav-bottom { padding: 4px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-nav-bottom a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; color: rgba(255,255,255,0.75);
  text-decoration: none; font-size: 0.92rem;
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.sidebar-nav-bottom a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav-bottom a.active-nav { background: rgba(255,255,255,0.13); color: #fff; font-weight: 600; }
.sidebar-nav-bottom i { font-size: 1.15rem; flex-shrink: 0; width: 22px; text-align: center; }
.sidebar.collapsed .sidebar-nav-bottom .nav-label { opacity: 0; }

/* nav submenu */
.nav-parent { user-select: none; }

.nav-parent .nav-arrow {
  margin-right: auto;
  font-size: 0.78rem;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.sidebar.collapsed .nav-arrow {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.nav-parent.open .nav-arrow {
  transform: rotate(180deg);
}

.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.sidebar-submenu.open {
  max-height: 200px;
}

.sidebar.collapsed .sidebar-submenu {
  max-height: 0 !important;
}

/* ---- Phase 89A — collapsed-sidebar submenu flyout ----
   When the rail is collapsed the rule above clips every submenu to 0 height, so
   sub-items are unreachable without expanding the whole sidebar. The flyout
   (opened by base.html JS on parent click, only while collapsed) lifts the
   submenu out as a fixed-position popover beside the icon: position:fixed
   escapes the sidebar's overflow:hidden clip, and the extra .flyout-open class
   (specificity 0,4,0) overrides the max-height:0 !important above. JS sets the
   inline top/right so it aligns with the clicked icon. Expanded-sidebar
   accordion behavior is untouched. */
.sidebar.collapsed .sidebar-submenu.flyout-open {
  position: fixed;
  right: 60px;                      /* just left of the 60px rail (JS re-sets inline) */
  max-height: none !important;      /* beat the collapsed max-height:0 clip */
  width: 196px;
  padding: 6px;
  background: var(--guron-navy);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  box-shadow: -6px 6px 22px rgba(0,0,0,0.30);
  overflow: visible;
  z-index: 1060;
}
.sidebar.collapsed .sidebar-submenu.flyout-open .nav-label { opacity: 1 !important; }
.sidebar.collapsed .sidebar-submenu.flyout-open a {
  padding: 9px 12px !important;     /* drop the 34px accordion indent */
  border-radius: 7px;
}
.sidebar.collapsed .sidebar-submenu.flyout-open a:hover { background: rgba(255,255,255,0.10); }
.sidebar.collapsed .nav-parent.flyout-active {
  background: rgba(255,255,255,0.13);
  color: #fff;
}

/* Flyout group header (Phase 89A) — subtle parent-group title at the top of the
   popover. Injected once per group by the JS; hidden in the expanded accordion,
   shown only inside an open flyout. Compact, quiet, not oversized. */
.sidebar-submenu .flyout-title { display: none; }
.sidebar.collapsed .sidebar-submenu.flyout-open .flyout-title {
  display: block;
  padding: 3px 12px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.55);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.sidebar-submenu a {
  padding-right: 34px !important;
  font-size: 0.86rem;
}

.nav-file-badge {
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--guron-danger); color:#fff; border-radius:999px;
  font-size:10px; font-weight:700; min-width:18px; height:18px;
  padding:0 4px; margin-right:4px; line-height:1;
}

/* ===== sidebar pages: צמצום padding צידי ===== */
.main-content {
  padding-left: 0.6rem !important;
  padding-right: 0.6rem !important;
}

/* ביטול קפיצת תפריט בעליית דף */
body.preload-sidebar .sidebar,
body.preload-sidebar .main-content,
body.preload-sidebar .sidebar-submenu,
body.preload-sidebar .nav-arrow,
body.preload-sidebar .sidebar-toggle .toggle-text,
body.preload-sidebar .sidebar-brand-text,
body.preload-sidebar .sidebar-user-name,
body.preload-sidebar .nav-label {
  transition: none !important;
}

/* ===== metrics grid (compact tiles) ===== */
.metrics-grid {
  display: grid;
  /* יוצר עמודות שוות שמתאימות את עצמן לרוחב */
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
  gap: 12px;
}

.metric-tile {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.2s;
}

.metric-tile:hover {
  transform: translateY(-2px); /* אפקט ריחוף קליל */
  background: #fff;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.metric-tile .label {
  font-size: 0.85rem;
  color: #6c757d;
  font-weight: 500;
}

.metric-tile .value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #212529;
}

/* ===== tables (no horizontal scroll by default) ===== */
.table th, .table td { 
  white-space: nowrap; 
  padding: 10px 8px; /* צמצום קל של הריווח הפנימי כדי לפנות מקום לעמודות נוספות */
}

/* ביטול גלילה מיותרת אם יש מקום */
.table-responsive {
  overflow-x: auto;
  border: none;
}
/* clickable table rows */
.table-hover tbody tr:hover {
  background: #f0f0f0;
  cursor: pointer;
}

/* wrapper יציב לטבלאות */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

/* RTL עוטף, אבל חישוב רוחבים נשאר LTR כדי ש-resize לא "יברח" */
.table-wrap.rtl {
  direction: rtl;
}

.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap.rtl { direction: rtl; }
.table-wrap.rtl th, .table-wrap.rtl td { text-align: right; white-space: nowrap; }


/* משימה באיחור */
.tabulator-row.task-overdue {
  background-color: #f8d7da !important; /* אדום בהיר */
}

/* לא בוצע - בולד */
.tabulator-row.task-pending .tabulator-cell{
  font-weight: 700;
}

/* בוצע / בוטל - קו חוצה */
.tabulator-row.task-done .tabulator-cell{
  text-decoration: line-through;
  opacity: 0.75; /* אופציונלי */
}

/* תיקים - פעיל בולד */
.tabulator-row.case-active .tabulator-cell{
  font-weight: 700;
}

/* תיקים - סגור/מחוק קו חוצה */
.tabulator-row.case-closed .tabulator-cell{
  text-decoration: line-through;
  opacity: 0.75;
}

.case-alert-dot{
  display:inline-block;
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--guron-danger); /* אדום */
}

.case-ok-dot{
  display:inline-block;
  width:10px;
  height:10px;
  border-radius:50%;
  background:#198754; /* ירוק */
}


@media print {
  @page { size: A4 landscape; margin: 8mm; }

  /* מסתיר כפתורים וחיפושים */
  .btn, .vr, #search-cases, #search-tasks { display: none !important; }
  .modal, .modal-backdrop { display: none !important; }

  /* Tabulator: לא לחתוך בגובה */
  #cases-table, #tasks-table { height: auto !important; }
  .tabulator { height: auto !important; }
  .tabulator-tableholder { height: auto !important; overflow: visible !important; }

  /* ✅ להקטין רק את הטבלאות כדי שלא ייחתכו לרוחב */
  .print-tabulator-wrap{
    transform: scale(0.72);
    transform-origin: top right;
    width: 128%;
  }

  .tabulator { font-size: 11px !important; }
  .tabulator .tabulator-cell { padding: 3px 4px !important; }
  .tabulator .tabulator-header .tabulator-col { white-space: nowrap !important; }
}

/* ===== Global Scrollbar Styling — GURON Luxury ===== */
/* ===== Global Scrollbar Styling — GURON Luxury ===== */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #8fa4bb #edf3f8;
}

/* Chrome / Edge / Safari */
*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #f4f8fb 0%, #eaf1f7 100%);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #a7b8ca 0%, #7f96ad 100%);
  border-radius: 999px;
  border: 2px solid #edf3f8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #95aabd 0%, #6f879f 100%);
}

*::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #8399ae 0%, #5f768e 100%);
}

*::-webkit-scrollbar-corner {
  background: #edf3f8;
}

