/* ============================================
   Shaad Nexus - Common Styles & Global Variables
   این فایل همیشه پیش از سایر فایل‌های CSS پلاگین لود می‌شود.
   ============================================ */

.snexus-root {
    /* ---------- رنگ‌های اصلی ---------- */
    --snexus-primary: #2271b1;
    --snexus-primary-dark: #0a4b78;
    --snexus-secondary: #1e3c72;
    --snexus-accent: #8a4a7f;
    --snexus-accent-dark: #6c2a6e;
    --snexus-success: #00a32a;
    --snexus-warning: #dba617;
    --snexus-danger: #dc3232;
    --snexus-danger-hover: #b32d2d;

    /* ---------- رنگ‌های متن و پس‌زمینه ---------- */
    --snexus-text-dark: #1d2327;
    --snexus-text-muted: #6c757d;
    --snexus-text-light: #ffffff;
    --snexus-bg-card: #ffffff;
    --snexus-bg-light: #f8f9fa;
    --snexus-bg-hover: #f1f5f9;
    --snexus-bg-message: #f9fafb;
    --snexus-bg-highlight: #fff3cd;

    /* ---------- حاشیه و سایه ---------- */
    --snexus-border: #ccd0d4;
    --snexus-border-light: #e2e8f0;
    --snexus-border-dark: #cbd5e1;
    --snexus-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --snexus-shadow-md: 0 10px 25px -5px rgba(0,0,0,0.05);
    --snexus-shadow-lg: 0 20px 25px -12px rgba(0,0,0,0.1);

    /* ---------- گرادینت‌ها ---------- */
    --snexus-gradient-start: #1e3c72;
    --snexus-gradient-end: #2a5298;
    --snexus-gradient-primary: linear-gradient(105deg, var(--snexus-gradient-start), var(--snexus-gradient-end));
    --snexus-gradient-project: linear-gradient(105deg, var(--snexus-primary), var(--snexus-primary-dark));
    --snexus-gradient-table: linear-gradient(105deg, var(--snexus-accent), var(--snexus-accent-dark));
    --snexus-gradient-title: linear-gradient(135deg, var(--snexus-gradient-start), var(--snexus-gradient-end));

    /* ---------- سایر ---------- */
    --snexus-radius: 8px;
    --snexus-radius-lg: 20px;

    /* رنگ‌های جدول (بوت‌استرپ تیبل) */
    --snexus-table-hover-bg: #89aff5;
    --snexus-table-hover-text: #000e4a;
    --snexus-table-selected-bg: #f7e08a;
    --snexus-table-selected-text: #5c4400;
    --snexus-table-striped-bg: rgba(0, 0, 0, 0.02);
    --snexus-table-header-bg: var(--snexus-gradient-primary);
    --snexus-table-header-text: #ffffff;     
}

/* ---------------------------------------------
   1. لودینگ اوورلی
--------------------------------------------- */
.snexus-root #global-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}
.snexus-root #global-loading-overlay .loader-spinner {
    text-align: center;
}

/* ---------------------------------------------
   2. نمایش حضور کاربران (presence)
--------------------------------------------- */
.snexus-root #presence-indicator {
    max-width: 100%;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding: 2px 6px;
    border-radius: 20px;
    background-color: rgba(0,0,0,0.05);
    font-size: 11px;
}
.snexus-root #presence-indicator::-webkit-scrollbar {
    height: 3px;
}
.snexus-root #presence-text {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}
.snexus-root #presence-text i.dashicons {
    font-size: 12px;
    position: relative;
    left: -9px;
}

.snexus-root .snexus-status-badge {
    display: inline-block;
    font-size: 0.7em;      
    padding: 4px 4px;
    border-radius: 50%;
    color: #fff;
    margin-left: 0;
    text-transform: uppercase;
}

.snexus-root .snexus-expiry-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--snexus-radius);
    font-size: 0.7rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
    background-color: #6c757d;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.snexus-expiry-badge.expired { background-color: #b71c1c; color: #fff; }
.snexus-expiry-badge.due { background-color: #ffc107; color: #000; }
.snexus-expiry-badge.hours { background-color: #ff9800; color: #fff; }
.snexus-expiry-badge.days-3 { background-color: #ffc107; color: #000; }
.snexus-expiry-badge.days-7 { background-color: #ffeb3b; color: #000; }
.snexus-expiry-badge.days-long { background-color: #28a745; color: #fff; }

/* ---------------------------------------------
   3. ویرایشگرهای اینلاین (ادیت درون جدول)
--------------------------------------------- */
.snexus-root .edit-input,
.snexus-root .edit-input.form-control,
.snexus-root .edit-input.form-select {
    width: 100%;
    min-width: 50px;
    height: auto;
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--snexus-border-dark, #cbd5e1);
    background: white;
    box-sizing: border-box;
}
.snexus-root .edit-input:focus {
    border-color: var(--snexus-primary, #2271b1);
    outline: none;
    box-shadow: 0 0 0 2px rgba(44, 125, 160, 0.2);
}
.snexus-root select.edit-input,
.snexus-root .edit-input.form-select {
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    background-image: none !important;
    padding-right: 20px !important;
}
.snexus-root .edit-input.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0 auto;
    display: block;
}
.snexus-root .edit-input.form-control[rows="2"] {
    height: auto;
}
.snexus-root .edit-buttons {
    display: flex;
    gap: 4px;
}
.snexus-root .edit-buttons button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.snexus-root .edit-buttons .edit-confirm {
    color: #2e7d32;
}
.snexus-root .edit-buttons .edit-confirm:hover {
    background: #e8f5e9;
    transform: scale(1.1);
}
.snexus-root .edit-buttons .edit-cancel {
    color: #c62828;
}
.snexus-root .edit-buttons .edit-cancel:hover {
    background: #ffebee;
    transform: scale(1.1);
}

/* ---------------------------------------------
   4. نمایش چک‌باکس در سلول‌های جدول
--------------------------------------------- */
.snexus-root .checkbox-cell {
    text-align: center;
}
.snexus-root .snexus-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
}
.snexus-root .snexus-checkbox.checked {
    background-color: var(--snexus-primary, #2271b1);
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.snexus-root .snexus-checkbox.unchecked {
    background-color: var(--snexus-bg-light, #f8f9fa);
    color: #94a3b8;
}
.snexus-root .snexus-checkbox .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ---------------------------------------------
   5. استایل‌های پایه جدول داده (Bootstrap Table)
--------------------------------------------- */
.bootstrap-table .fixed-table-container .fixed-table-body {
    overflow-x: auto;
    height: auto;
}
.snexus-root .bootstrap-table .table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--snexus-shadow-md, 0 10px 25px -5px rgba(0,0,0,0.05));
    border-collapse: separate;
    border-spacing: 0;
    border: 2px solid rgba(0, 0, 0, 0.2);
    table-layout: fixed !important;
}
.snexus-root #snexus-table-container {
    width: auto;
}
.snexus-root .bootstrap-table thead tr,
.snexus-root .bootstrap-table tfoot tr {
    background: var(--snexus-gradient-primary, linear-gradient(105deg,#4b88f1, #d46a6a));
    font-weight: 600;
    letter-spacing: 0.3px;
}
.snexus-root .bootstrap-table thead th,
.snexus-root .bootstrap-table tfoot th {
    padding: 2px 2px;
    color: var(--snexus-table-header-text, #ffffff);
    text-align: center;
    font-size: 0.85rem;
    text-transform: uppercase;
    background: transparent !important;
}
.snexus-root .bootstrap-table thead th {
    border-bottom: 2px solid rgba(0, 0, 0, 0.2);
}
.snexus-root .bootstrap-table tfoot th {
    border-top: 2px solid rgba(0, 0, 0, 0.2);
}
.snexus-root .bootstrap-table .table td,
.snexus-root .bootstrap-table .table th {
    line-height: 1.0 !important;
    font-size: 0.85rem;
    vertical-align: middle;
}
.snexus-root .bootstrap-table .table-hover tbody tr:hover > td {
    background-color: var(--snexus-table-hover-bg, #89aff5) !important;
    --bs-table-bg: var(--snexus-table-hover-bg, #89aff5);
    color: var(--snexus-table-hover-text, #000e4a) !important;
}
.snexus-root .bootstrap-table thead th.bs-checkbox input[type="checkbox"],
.snexus-root .bootstrap-table .fixed-table-header th.bs-checkbox input[type="checkbox"],
.snexus-root .bootstrap-table td input[type="checkbox"] {
    position: relative;
    top: 5px;
    left: -12px;
    margin: 0;
}
.snexus-root .bootstrap-table .table tbody tr.selected > td {
    background-color: var(--snexus-table-selected-bg, #f7e08a) !important;
    --bs-table-bg: var(--snexus-table-selected-bg, #f7e08a);
    color: var(--snexus-table-selected-text, #5c4400) !important;
}
.snexus-root .bootstrap-table .table-hover tbody tr.selected:hover > td {
    background-color: color-mix(in srgb, var(--snexus-table-hover-bg, #89aff5) 20%, var(--snexus-table-selected-bg, #f7e08a) 80%) !important;
    --bs-table-bg: color-mix(in srgb, var(--snexus-table-hover-bg, #89aff5) 20%, var(--snexus-table-selected-bg, #f7e08a) 80%);
    color: color-mix(in srgb, var(--snexus-table-hover-text, #000e4a) 20%, var(--snexus-table-selected-text, #5c4400) 80%) !important;
}
.snexus-root .bootstrap-table .table-striped tbody tr.selected:nth-of-type(odd) > * {
    background-color: var(--snexus-table-striped-bg, rgba(0,0,0,0.02));
    --bs-table-bg: var(--snexus-table-striped-bg, rgba(0,0,0,0.02));
}
.snexus-root .bootstrap-table .columns .dropdown-menu {
    position: absolute;
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    transform: translateY(0) !important;
    margin-top: 5px;
}

/* ---------------------------------------------
   استایل آخرین ردیف ویرایش‌شده 
--------------------------------------------- */
.snexus-root .bootstrap-table .table tbody tr.last-edited-row > td {
    /* background-color: color-mix(in srgb, var(--snexus-table-hover-bg) 50%, transparent 50%);
    --bs-table-bg: color-mix(in srgb, var(--snexus-table-hover-bg) 50%, transparent 50%); */
    text-decoration: underline;
}

/* .snexus-root .bootstrap-table .table tbody tr.last-edited-row:hover > td {
    background-color: var(--snexus-table-hover-bg);
    --bs-table-bg: var(--snexus-table-hover-bg);
} */

/* ---------------------------------------------
   6. واکنشگرایی پایه (موبایل)
--------------------------------------------- */
@media (max-width: 768px) {
    .snexus-root .btn-sm {
        padding: 0.2rem 0.6rem;
        font-size: 0.7rem;
    }
    .snexus-root .btn-primary,
    .snexus-root .btn-success {
        padding: 0.25rem 0.8rem;
        font-size: 0.8rem;
    }
    .snexus-root #snexus-table {
        font-size: 0.75rem;
    }
    .snexus-root #snexus-table td,
    .snexus-root #snexus-table th {
        padding: 6px 4px;
    }
}