/* ============================================================
   דפוס דותן V3 — שפת העיצוב
   מקור אמת אחד לצבעים, טיפוגרפיה ומרווחים. אין צבעים קשיחים במסכים.
   בנוי מעל Bootstrap RTL: המשתנים של Bootstrap ממופים לערכים שלנו,
   כך שכל המסכים הקיימים מקבלים את המראה החדש בלי לשנות קלאסים.
   ============================================================ */

:root {
    /* --- לוח הצבעים (מסמך ההנחיות) --- */
    --page-bg: #F5F6F8;
    --surface: #FFFFFF;
    --surface-subtle: #F0F2F5;
    --text: #202B38;
    --text-secondary: #526174;
    --border: #D8DEE7;
    --input-border: #7B8797;
    --primary: #2457A7;
    --primary-hover: #1B4382;
    --selected-bg: #EAF1FC;
    --success-text: #24613C;
    --success-bg: #EDF6EF;
    --warning-text: #80520B;
    --warning-bg: #FFF4DB;
    --danger-text: #A32B32;
    --danger-bg: #FCEFF0;
    --focus: #2457A7;

    --radius-control: 8px;
    --radius-panel: 12px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* --- מידות המעטפת --- */
    --side-w: 208px;
    --top-h: 72px;

    /* --- שמות ותיקים מהמערכת הקיימת ---
       מסכים קיימים משתמשים בשמות האלה. הם ממופים ללוח החדש כדי שלא יישבר דבר. */
    --accent: var(--primary);
    --accent-hover: var(--primary-hover);
    --accent-light: var(--selected-bg);
    --bg: var(--page-bg);
    --fill: var(--surface-subtle);
    --border-strong: var(--input-border);
    --text-secondary: #526174;
    --warning: #B06E0C;
    --danger: #A32B32;
    --success: #24613C;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 12px;
    --shadow-2: none;
    --shadow-4: none;
    --shadow-8: 0 4px 12px rgba(32,43,56,.10);
    --shadow-16: 0 8px 24px rgba(32,43,56,.12);

    /* --- מיפוי משתני Bootstrap --- */
    --bs-primary: #2457A7;
    --bs-primary-rgb: 36, 87, 167;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--page-bg);
    --bs-border-color: var(--border);
    --bs-border-radius: var(--radius-control);
    --bs-link-color: var(--primary);
    --bs-link-hover-color: var(--primary-hover);
}

/* ============================================================
   טיפוגרפיה
   בסיס 18px לטקסט. שורש המסמך נשאר 16px כדי לא לשבש את סולם
   המרווחים של Bootstrap; גדלי הפקדים מוגדלים במפורש למטה.
   ============================================================ */
body {
    font-family: 'Heebo', Arial, sans-serif;
    font-size: 18px;
    line-height: 1.5;
    font-weight: 400;
    color: var(--text);
    background-color: var(--page-bg);
    margin: 0;
    padding-block-start: var(--top-h);
    padding-inline-start: var(--side-w);
    padding-block-end: 40px;
}

h1, .h1 { font-size: 28px; font-weight: 600; }
h2, .h2 { font-size: 22px; font-weight: 600; }
h3, .h3 { font-size: 20px; font-weight: 600; }
h4, h5, h6 { font-weight: 600; }

small, .small, .text-muted.small { font-size: 16px; }
.text-muted { color: var(--text-secondary) !important; }

/* מחירים, כמויות ומספרי הזמנה: ספרות ברוחב אחיד, כדי שעמודות מספרים יתיישרו */
.money, td.num, .tabular { font-variant-numeric: tabular-nums; }

/* כתובות מייל, טלפונים ומספרים בתוך טקסט עברי */
bdi { unicode-bidi: isolate; }

/* ============================================================
   המעטפת: סרגל צד קבוע + סרגל עליון
   ============================================================ */
.v3-side {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--side-w);
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
}

.v3-brand {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4) var(--space-3);
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.v3-brand span { font-size: 14px; color: var(--text-secondary); font-weight: 400; }

.v3-nav { flex: 1; padding: var(--space-2) 0; }
.v3-nav-group {
    padding: var(--space-4) var(--space-4) var(--space-1);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.v3-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    font-size: 17px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    border-inline-start: 3px solid transparent;
}
.v3-nav a:hover { background: var(--surface-subtle); }
.v3-nav a.active {
    background: var(--selected-bg);
    color: var(--primary);
    border-inline-start-color: var(--primary);
}
.v3-nav .v3-count {
    margin-inline-start: auto;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: var(--surface-subtle);
    color: var(--text-secondary);
    border-radius: 50rem;
    padding: 1px 8px;
}
.v3-nav a.active .v3-count { background: #fff; }
.v3-nav .v3-count.urgent { background: var(--danger-bg); color: var(--danger-text); }

.v3-side-foot { border-block-start: 1px solid var(--border); padding: var(--space-2) 0; }

.v3-top {
    position: fixed;
    inset-block-start: 0;
    inset-inline-start: var(--side-w);
    inset-inline-end: 0;
    height: var(--top-h);
    background: var(--surface);
    border-block-end: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-inline: var(--space-5);
    z-index: 1030;
}

.v3-search { flex: 1; max-width: 520px; position: relative; }
.v3-search input {
    width: 100%;
    height: 44px;
    font-size: 17px;
    font-family: inherit;
    padding-inline: 40px var(--space-3);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--text);
}
.v3-search .bi {
    position: absolute;
    inset-inline-start: var(--space-3);
    inset-block-start: 11px;
    color: var(--text-secondary);
    pointer-events: none;
}

.v3-user { margin-inline-start: auto; text-align: start; line-height: 1.25; }
.v3-user b { display: block; font-size: 16px; font-weight: 600; }
.v3-user span { font-size: 14px; color: var(--text-secondary); }

/* פעמון ההתראות: מקום אחד לכל מה שדורש טיפול, במקום בועות מתחרות */
.v3-bell { position: relative; }
.v3-bell > button { min-height: 44px; min-width: 44px; }
.v3-bell .v3-dot {
    position: absolute;
    inset-block-start: 4px;
    inset-inline-end: 4px;
    min-width: 20px;
    height: 20px;
    padding-inline: 5px;
    border-radius: 50rem;
    background: var(--danger-text);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.v3-bell .dropdown-menu { min-width: 320px; font-size: 17px; }
.v3-bell .dropdown-item { min-height: 44px; display: flex; align-items: center; gap: var(--space-2); }
.v3-bell .dropdown-item .v3-count { margin-inline-start: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* פס סביבת דמו — שלא יתבלבל בין המערכת האמיתית לעותק הניסוי */
.v3-env {
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    padding: 4px;
    border-block-end: 1px solid var(--border);
}

.v3-menu-btn { display: none; }

/* ============================================================
   התאמה לרוחב המסך
   ============================================================ */
@media (max-width: 1099.98px) {
    body { padding-inline-start: 0; }
    .v3-top { inset-inline-start: 0; }
    .v3-menu-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
    .v3-side {
        transform: translateX(100%);
        transition: transform .15s ease;
        box-shadow: var(--shadow-16);
    }
    html[dir="rtl"] .v3-side { transform: translateX(100%); }
    body.v3-nav-open .v3-side { transform: none; }
    body.v3-nav-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(32,43,56,.35);
        z-index: 1035;
    }
}

@media (max-width: 767.98px) {
    .v3-top { padding-inline: var(--space-3); gap: var(--space-2); }
    .v3-user { display: none; }
    .dashboard-container, .container-fluid { padding-inline: var(--space-3) !important; }
}

/* ============================================================
   רוחב התוכן
   המערכת היא סביבת עבודה, לא אתר שיווקי — מנצלים את הרוחב הזמין.
   ============================================================ */
.dashboard-container {
    max-width: none;
    margin: 0;
    padding: var(--space-5);
}
body > .container-fluid { padding: var(--space-5); }

/* ============================================================
   פקדים: גובה מינימלי 44px וטקסט קריא
   ============================================================ */
.btn {
    min-height: 44px;
    font-size: 17px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-control);
    padding-inline: var(--space-4);
}
.btn-sm { min-height: 38px; font-size: 16px; padding-inline: var(--space-3); }
.btn-lg { min-height: 52px; font-size: 19px; }

.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); }

.form-control, .form-select {
    min-height: 44px;
    font-size: 17px;
    font-family: inherit;
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-control);
}
.form-control:focus, .form-select:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(36,87,167,.18);
}
.form-label { font-size: 17px; font-weight: 500; margin-bottom: var(--space-2); }
textarea.form-control { min-height: 88px; }

/* מיקוד נראה בכל פקד — ניווט מקלדת מלא */
a:focus-visible, button:focus-visible, .btn:focus-visible,
[tabindex]:focus-visible, summary:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ============================================================
   משטחים: גבול דק, בלי צל על כל רכיב
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    box-shadow: none;
}
.modal-content, .dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-16);
}
.dropdown-item { font-size: 17px; min-height: 44px; display: flex; align-items: center; }

.table { font-size: 17px; color: var(--text); --bs-table-border-color: var(--border); }
.table > :not(caption) > * > * { padding: var(--space-3) var(--space-3); }
.table thead th { font-size: 16px; font-weight: 600; color: var(--text-secondary); background: var(--surface-subtle); }
.table-hover > tbody > tr:hover > * { background: var(--surface-subtle); }

/* טבלה רחבה: גלילה בתוך המכל שלה בלבד. הדף עצמו לא נגלל לרוחב. */
.table-responsive { overflow-x: auto; }

.badge { font-size: 14px; font-weight: 600; border-radius: 50rem; padding: 4px 10px; }
.bg-success, .text-bg-success { background: var(--success-bg) !important; color: var(--success-text) !important; }
.bg-warning, .text-bg-warning { background: var(--warning-bg) !important; color: var(--warning-text) !important; }
.bg-danger,  .text-bg-danger  { background: var(--danger-bg)  !important; color: var(--danger-text)  !important; }
.bg-primary, .text-bg-primary { background: var(--selected-bg) !important; color: var(--primary) !important; }
.bg-secondary, .text-bg-secondary { background: var(--surface-subtle) !important; color: var(--text-secondary) !important; }

.alert { font-size: 17px; border-radius: var(--radius-panel); border: 1px solid var(--border); }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.alert-info    { background: var(--selected-bg); color: var(--primary); }

/* מודל האישור והודעות ה-toast של app.js */
#appConfirmModal .modal-body { font-size: 19px; line-height: 1.5; white-space: pre-line; }
#appToastWrap { z-index: 1090; }
#appToastWrap .toast { font-size: 17px; }

/* ============================================================
   רכיבים של המסכים הקיימים — מותאמים לשפה החדשה
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    padding: var(--space-4) var(--space-5);
    box-shadow: none;
    position: relative;
}
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.1; margin-bottom: var(--space-1); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 16px; color: var(--text-secondary); font-weight: 500; }
.stat-subtitle { font-size: 16px; color: var(--text-secondary); margin-top: var(--space-1); }
.stat-card.color-1 .stat-value,
.stat-card.color-2 .stat-value,
.stat-card.color-3 .stat-value,
.stat-card.color-4 .stat-value { color: var(--text); }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { background: var(--surface-subtle); }

.status-tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-5) 0; padding: 0; }
.status-tab {
    flex: 1;
    min-width: 110px;
    min-height: 44px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    cursor: pointer;
    text-align: center;
    background: var(--surface);
    box-shadow: none;
    color: var(--text);
}
.status-tab:hover { background: var(--surface-subtle); }
.status-tab.active { background: var(--selected-bg); border-color: var(--primary); color: var(--primary); }
.status-tab-count { font-size: 22px; font-weight: 600; margin: var(--space-1) 0; font-variant-numeric: tabular-nums; }
.status-tab-label { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.status-tab.active .status-tab-label { color: var(--primary); }
/* צבעי הטאבים הישנים מנוטרלים — הבחירה מסומנת בכחול אחד, והמשמעות כתובה בטקסט */
.tab-all, .tab-new, .tab-design, .tab-work, .tab-ready, .tab-completed, .tab-cancelled, .tab-efrat { color: inherit; }

.search-bar { max-width: 300px; width: 100%; background: var(--surface-subtle); border-radius: var(--radius-control); padding: 5px 15px; display: flex; align-items: center; }
.search-bar input { border: none; background: transparent; width: 100%; outline: none; font-size: 17px; font-family: inherit; }

.price-panel { background: var(--selected-bg) !important; }
.price-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel); box-shadow: none; }
.price-box .input-group-text, .price-box .form-control { background: var(--surface) !important; }

.soft-input { background: var(--surface) !important; border: 1px solid var(--input-border) !important; }
.soft-input:focus { background: var(--surface) !important; box-shadow: 0 0 0 3px rgba(36,87,167,.18) !important; }

.payment-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-panel);
    cursor: pointer;
    box-shadow: none;
}
.payment-card:hover { background: var(--surface-subtle); }

.finish-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.finish-btn:hover { background: var(--surface-subtle); }
.btn-check:checked + .finish-btn { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: none; }

.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input { min-width: 22px; min-height: 22px; }

/* אנימציות קצרות בלבד, ומכובה למי שביקש פחות תנועה */
.badge-loading { opacity: .45; pointer-events: none; }
.row-leaving { transition: opacity .15s, transform .15s; opacity: 0; transform: translateX(20px); }
.badge-pop { animation: badge-pop .15s ease; }
@keyframes badge-pop { 0% { transform: scale(.9); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
    .v3-side, .v3-top, .v3-env { display: none !important; }
    body { padding: 0; }
}
