/*
 * ===========================================
 * Design System — מערכת גדוד 51
 * גרסה 1.0 — עיצוב מאוחד לכל הדפים
 * ===========================================
 */
@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;500;600;700;800&display=swap');

/* ==========================================
   CSS VARIABLES (Design Tokens)
   ========================================== */
:root {
    /* --- צבעים ראשיים --- */
    --ds-primary:           #1e3a5f;   /* כחול כהה — הצבע הראשי */
    --ds-primary-light:     #2563eb;   /* כחול בהיר */
    --ds-primary-dark:      #0f2240;   /* כחול כהה מאוד */
    --ds-primary-gradient:  linear-gradient(135deg, #1e3a5f, #2563eb);

    /* --- צבעי פעולה --- */
    --ds-success:           #22c55e;
    --ds-success-dark:      #16a34a;
    --ds-success-gradient:  linear-gradient(135deg, #16a34a, #22c55e);
    --ds-warning:           #e67e22;
    --ds-warning-gradient:  linear-gradient(135deg, #d35400, #e67e22);
    --ds-danger:            #e74c3c;
    --ds-danger-gradient:   linear-gradient(135deg, #c0392b, #e74c3c);
    --ds-info:              #3498db;
    --ds-info-gradient:     linear-gradient(135deg, #2980b9, #3498db);

    /* --- רקעים --- */
    --ds-bg:                #f7f9fc;
    --ds-card-bg:           #ffffff;
    --ds-header-gradient-strip: linear-gradient(90deg, #1e3a5f, #2563eb, #22c55e);

    /* --- טקסטים --- */
    --ds-text-primary:      #0f172a;
    --ds-text-secondary:    #334155;
    --ds-text-muted:        #64748b;
    --ds-text-light:        #94a3b8;

    /* --- גבולות --- */
    --ds-border:            rgba(30, 58, 95, 0.18);
    --ds-border-light:      rgba(30, 58, 95, 0.08);

    /* --- פונטים --- */
    --ds-font:              'Assistant', -apple-system, system-ui, sans-serif;
    --ds-text-xs:           12px;
    --ds-text-sm:           13px;
    --ds-text-base:         14px;
    --ds-text-md:           15px;
    --ds-text-lg:           18px;
    --ds-text-xl:           22px;
    --ds-text-2xl:          26px;
    --ds-text-3xl:          30px;

    /* --- עיגולי פינות --- */
    --ds-radius-sm:         6px;    /* badges, tags קטנים */
    --ds-radius-md:         10px;   /* כפתורים, שדות קלט, כרטיסיות */
    --ds-radius-lg:         16px;   /* sections, cards גדולים */
    --ds-radius-pill:       50px;   /* pills בלבד */
    --ds-radius-circle:     50%;    /* אייקונים עגולים */

    /* --- צללים --- */
    --ds-shadow-card:       0 2px 12px rgba(30, 58, 95, 0.08);
    --ds-shadow-hover:      0 4px 20px rgba(30, 58, 95, 0.16);
    --ds-shadow-button:     0 3px 10px rgba(37, 99, 235, 0.25);
}

/* ==========================================
   BUTTONS — כפתורים אחידים
   ========================================== */

/* כפתור ראשי — גרדיאנט כחול */
.ds-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--ds-primary-gradient);
    color: #fff;
    border: none;
    border-radius: var(--ds-radius-md);
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--ds-shadow-button);
    text-decoration: none;
    white-space: nowrap;
}
.ds-btn-primary:hover {
    box-shadow: 0 5px 18px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

/* כפתור הצלחה — גרדיאנט ירוק */
.ds-btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--ds-success-gradient);
    color: #fff;
    border: none;
    border-radius: var(--ds-radius-md);
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(34, 197, 94, 0.25);
    text-decoration: none;
    white-space: nowrap;
}
.ds-btn-success:hover {
    box-shadow: 0 5px 18px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

/* כפתור אזהרה — כתום */
.ds-btn-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--ds-warning-gradient);
    color: #fff;
    border: none;
    border-radius: var(--ds-radius-md);
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(230, 126, 34, 0.25);
    text-decoration: none;
    white-space: nowrap;
}
.ds-btn-warning:hover {
    box-shadow: 0 5px 18px rgba(230, 126, 34, 0.4);
    transform: translateY(-1px);
}

/* כפתור מחיקה — אדום */
.ds-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--ds-danger-gradient);
    color: #fff;
    border: none;
    border-radius: var(--ds-radius-md);
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.25);
    text-decoration: none;
    white-space: nowrap;
}
.ds-btn-danger:hover {
    box-shadow: 0 5px 18px rgba(231, 76, 60, 0.4);
    transform: translateY(-1px);
}

/* כפתור משני — אפור/לבן */
.ds-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    background: #f1f5f9;
    color: var(--ds-primary);
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    white-space: nowrap;
}
.ds-btn-secondary:hover {
    background: #e2e8f0;
    border-color: var(--ds-primary);
    transform: translateY(-1px);
}

/* ==========================================
   כפתור "חזרה לראשי" — אחיד בכל הדפים
   ========================================== */
.ds-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #f1f5f9;
    color: var(--ds-primary);
    border: 1.5px solid rgba(30, 58, 95, 0.25);
    border-radius: var(--ds-radius-md);
    font-family: var(--ds-font);
    font-size: var(--ds-text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    white-space: nowrap;
}
.ds-btn-back:hover {
    background: var(--ds-primary);
    color: #fff;
    border-color: var(--ds-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.2);
}

/* ==========================================
   TABLE ACTION BUTTONS — כפתורי פעולה בטבלאות
   ========================================== */
.ds-action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--ds-radius-sm);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: white;
    position: relative;
}
.ds-action-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Tooltip */
.ds-action-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    font-weight: 500;
}
.ds-action-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #2c3e50;
    z-index: 100;
}

.ds-action-btn-view    { background: var(--ds-info); }
.ds-action-btn-edit    { background: var(--ds-warning); }
.ds-action-btn-approve { background: var(--ds-success-dark); }
.ds-action-btn-delete  { background: var(--ds-danger); }
.ds-action-btn-send    { background: #25d366; } /* WhatsApp */
.ds-action-btn-telegram{ background: #2980b9; }

.ds-action-btn-view:hover    { background: #2980b9; }
.ds-action-btn-edit:hover    { background: #d35400; }
.ds-action-btn-approve:hover { background: #15803d; }
.ds-action-btn-delete:hover  { background: #c0392b; }
.ds-action-btn-send:hover    { background: #1ebe57; }
.ds-action-btn-telegram:hover{ background: #1a6a9a; }

/* ==========================================
   STATUS BADGES — תגים סטטוס
   ========================================== */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--ds-radius-pill);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    white-space: nowrap;
}
.ds-badge-new     { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.ds-badge-pending { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.ds-badge-done    { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.ds-badge-active  { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.ds-badge-closed  { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.ds-badge-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ==========================================
   TABLE HEADERS — אחידות
   ========================================== */
.ds-table-header th,
.ds-thead-unified th,
.excel-table thead th,
.tracker-table thead th {
    background: #edf2f7 !important;
    color: var(--ds-primary) !important;
    font-weight: 700 !important;
    font-size: var(--ds-text-sm) !important;
    text-align: right !important;
    padding: 10px 14px !important;
    border-bottom: 2px solid rgba(30, 58, 95, 0.12) !important;
}

/* ==========================================
   FOOTER — אחיד בכל הדפים
   ========================================== */
.ds-footer {
    text-align: center;
    color: var(--ds-text-muted);
    font-size: var(--ds-text-sm);
    font-family: var(--ds-font);
    padding: 20px;
    margin-top: auto;
    opacity: 0.85;
}
.ds-footer p { margin: 0; }

/* ==========================================
   FORM INPUTS — שדות קלט אחידים
   ========================================== */
.ds-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    background: #fff;
    font-family: var(--ds-font);
    font-size: var(--ds-text-base);
    color: var(--ds-text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ds-input:focus {
    outline: none;
    border-color: var(--ds-primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: #fff;
}
.ds-input::placeholder {
    color: var(--ds-text-light);
}

/* ==========================================
   HEADER LINE — קו gradient אחיד בתחתית header
   ========================================== */
.ds-header-strip {
    height: 4px;
    background: var(--ds-header-gradient-strip);
    border-radius: 0 0 4px 4px;
}

/* ==========================================
   MOBILE CARD TABLE — טבלה → כרטיסיות במובייל
   ========================================== */
@media (max-width: 700px) {
    .mobile-card-table thead {
        display: none !important;
    }

    .mobile-card-table tbody tr {
        display: block !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: var(--ds-radius-md) !important;
        margin-bottom: 12px !important;
        padding: 12px 14px !important;
        background: var(--ds-card-bg) !important;
        box-shadow: var(--ds-shadow-card) !important;
    }

    .mobile-card-table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 6px 0 !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 13px !important;
        gap: 8px;
    }

    .mobile-card-table tbody td:last-child {
        border-bottom: none !important;
        padding-top: 10px !important;
        justify-content: flex-start !important;
        flex-wrap: wrap;
        gap: 6px;
    }

    .mobile-card-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--ds-primary);
        font-size: 12px;
        flex-shrink: 0;
        min-width: 80px;
    }

    .mobile-card-table tbody td:last-child::before {
        display: none;
    }

    /* Table container — overflow visible for card mode */
    .mobile-card-table {
        width: 100% !important;
        min-width: unset !important;
    }
}

/* ==========================================
   RESPONSIVE BREAKPOINTS
   ========================================== */

/* Mobile Small */
@media (max-width: 480px) {
    .ds-btn-primary,
    .ds-btn-success,
    .ds-btn-danger,
    .ds-btn-secondary,
    .ds-btn-warning {
        font-size: var(--ds-text-sm);
        padding: 8px 14px;
    }
    .ds-btn-back {
        font-size: var(--ds-text-xs);
        padding: 7px 12px;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .ds-stats-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile */
@media (max-width: 700px) {
    .ds-stats-grid-4,
    .ds-stats-grid-3,
    .ds-stats-grid-5 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .ds-stats-grid-2 {
        grid-template-columns: 1fr !important;
    }
    .ds-hide-mobile { display: none !important; }
    .ds-show-mobile { display: block !important; }
    .ds-footer { padding: 14px; font-size: 11px; }
}

/* Utility classes */
.ds-show-mobile { display: none; }
.ds-flex-wrap-mobile { display: flex; }
@media (max-width: 700px) {
    .ds-flex-wrap-mobile {
        flex-wrap: wrap !important;
    }
    .ds-header-actions-mobile {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .ds-header-actions-mobile button,
    .ds-header-actions-mobile a {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
}
