/* ===================================================================
 * polish.css — طبقة تحسينات بريميوم (Premium Polish)
 * ===================================================================
 * تحسينات بصرية آمنة تعتمد على التوكنز، متوافقة مع الوضع الليلي.
 * مفيش تغيير في الـ layout — بس ظلال/حركات/تركيز/تفاصيل تدّي إحساس أرقى.
 * بتتحمّل آخر ملف عشان تطغى على الباقي.
 * =================================================================== */

/* ── انتقالات أنعم على العناصر التفاعلية ── */
.btn, .card, .form-control, .nav-item, .home-grid-item,
.dash-kpi, .stat-card-premium, .header-action-btn, .badge,
.salary-overview, .announcement-card, .info-list {
  transition: transform .22s cubic-bezier(.34,1.3,.64,1),
              box-shadow .22s ease, background-color .22s ease, border-color .22s ease, color .22s ease;
}

/* ── أزرار: رفعة + ظل ملوّن عند الهوفر ── */
.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(11,42,74,.28); }
.btn-accent:hover   { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(255,107,53,.32); }
.btn-outline:hover  { transform: translateY(-1px); }
.btn:active         { transform: translateY(0) scale(.99); }

/* ── مدخلات: حلقة تركيز برتقالية أنيقة ── */
.form-control:focus,
.premium-select-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,107,53,.18);
  outline: none;
}

/* ── كروت: رفعة لطيفة عند الهوفر ── */
.card:hover { box-shadow: var(--shadow-lg); }
.home-grid-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ── أزرار الأيقونات في الهيدر ── */
.header-action-btn:hover { transform: translateY(-1px); }

/* ── جداول: صفوف هوفر أنعم ── */
.table tbody tr:hover { background: var(--surface-2); }

/* ── سكرول-بار بريميوم ── */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 8px;
  border: 2px solid var(--surface); background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── تحديد النص بلون البراند ── */
::selection { background: rgba(255,107,53,.25); color: inherit; }

/* ── مودالات: خلفية مموّهة (frosted) ── */
.modal-overlay, .custom-alert-overlay {
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}

/* ── تفاصيل تيبوجرافية ── */
.page-title, .modal-title, .dash-h, .salary-amount { letter-spacing: -.012em; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ── شارات أنعم ── */
.badge { letter-spacing: .01em; }

/* ── السايدبار/التنقل: مؤشر أنعم ── */
.bottom-nav-simple a:active, .nav-item:active { transform: scale(.97); }

/* ── ظهور لطيف للكروت (يحترم تقليل الحركة) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ═══════════════════════════════════════ */
/* جدول التوزيع — 4 مراحل لون الحالة + تلميع  */
/* ═══════════════════════════════════════ */
/* 🔴 مش متوزّعة · 🟡 شغّالة · 🔵 الموظف سلّم · 🟢 الأدمن أكّد */
.ts-grid tbody tr.row-unassigned { background: rgba(239,68,68,.07) !important; }
.ts-grid tbody tr.row-unassigned td:first-child { box-shadow: inset 4px 0 0 #ef4444; }
.ts-grid tbody tr.row-working    { background: rgba(245,158,11,.08) !important; }
.ts-grid tbody tr.row-working td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.ts-grid tbody tr.row-pending    { background: rgba(59,130,246,.09) !important; }
.ts-grid tbody tr.row-pending td:first-child { box-shadow: inset 4px 0 0 #3b82f6; }
.ts-grid tbody tr.row-done       { background: rgba(16,185,129,.08) !important; }
.ts-grid tbody tr.row-done td:first-child { box-shadow: inset 4px 0 0 #10b981; }
.ts-grid tbody tr.row-done td .cell-input { color: var(--text-muted); }

/* ألوان الـ select حسب الحالة */
.ts-grid td .cell-select.status-working { background:#fef3c7 !important; color:#92400e !important; font-weight:700; border-color:#fcd34d !important; }
.ts-grid td .cell-select.status-pending { background:#dbeafe !important; color:#1e40af !important; font-weight:700; border-color:#93c5fd !important; }
.ts-grid td .cell-select.status-done    { background:#d1fae5 !important; color:#065f46 !important; font-weight:700; border-color:#6ee7b7 !important; }

/* تلميع الجدول: رأس ثابت + خلايا أوضح + منع التداخل */
.ts-grid thead th { position: sticky; top: 0; z-index: 3; background: var(--brand, #0B2A4A) !important; color: #fff !important; }
.ts-grid td .cell-input, .ts-grid td .cell-select { border-radius: 7px; min-width: 78px; }
.ts-grid td .cell-input[data-field="employeeName"], .ts-grid td .cell-input[data-field="taskName"] { min-width: 120px; }
.ts-grid td .cell-input[data-field="notes"] { min-width: 140px; }
.ts-grid tbody tr { transition: background-color .2s ease; }

/* ═══ تكبير منطقة التوزيع على الشاشة كلها ═══ */
#adminDistWorkspace.dist-maximized {
  position: fixed; inset: 0; z-index: 9000; margin: 0;
  background: var(--bg-color); padding: 1rem 1.3rem; overflow: hidden;
  display: flex; flex-direction: column; gap: .8rem;
  animation: fadeIn .2s ease;
}
#adminDistWorkspace.dist-maximized .ts-workspace-header { flex: 0 0 auto; }
#adminDistWorkspace.dist-maximized .ts-grid-wrap { flex: 1 1 auto; max-height: none; overflow: auto; }
#adminDistWorkspace.dist-maximized .ts-grid { min-width: 100%; }
body.dist-max-lock { overflow: hidden; }

/* ═══ تنظيف زحمة جدول التوزيع ═══ */
/* أزرار "الآن/اليوم" تظهر بس وانت بتعدّل الخلية (بدل ما تعمل زحمة دايمة) */
.ts-grid td .cell-with-now { display: flex; align-items: center; gap: 5px; }
.ts-grid td .cell-with-now .cell-input { flex: 1 1 auto; }
.ts-grid td .cell-with-now .now-btn {
  display: none; flex: 0 0 auto; font-size: .62rem; padding: 3px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); cursor: pointer; white-space: nowrap;
}
.ts-grid td .cell-with-now:hover .now-btn,
.ts-grid td .cell-with-now:focus-within .now-btn { display: inline-flex; }
.ts-grid td .cell-with-now .now-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* أزرار الإجراءات: موحّدة ومرتّبة من غير قص نص ("تأكيد" مايتقصّش) */
.ts-grid td:last-child { white-space: nowrap; }
.ts-grid .row-action-btn, .ts-grid .row-distribute-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px;
  border-radius: 7px; font-size: .78rem; font-weight: 700; white-space: nowrap; vertical-align: middle; margin: 0 1px;
}
.ts-grid .row-action-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.ts-grid .row-action-btn:hover { background: var(--surface-3); }
.ts-grid .row-action-btn[data-act="delete-row"]:hover { background: rgba(239,68,68,.12); color: #ef4444; }

/* ═══ فلاش الصف اللي الموظف سلّمه + علامة التسليم + خانات التوقيت للعرض ═══ */
@keyframes oafEdgePulse { 0%,100% { box-shadow: inset 4px 0 0 #3b82f6; } 50% { box-shadow: inset 8px 0 0 #1d4ed8; } }
.ts-grid tbody tr.row-pending td:first-child { animation: oafEdgePulse 1.4s ease-in-out infinite; }
@keyframes oafFlagPulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.submit-flag {
  display: inline-block; margin-top: 4px; font-size: .7rem; font-weight: 700;
  color: #1e40af; background: #dbeafe; border-radius: 6px; padding: 2px 8px; white-space: nowrap;
  animation: oafFlagPulse 1.3s ease-in-out infinite;
}
/* خانات التوقيت (تلقائية، للعرض فقط) */
.ts-grid td .cell-ro { background: transparent !important; border-color: transparent !important; color: var(--text-muted) !important; cursor: default; font-size: .8rem; text-align: center; }

/* ═══════════════════════════════════════════════════════════════ */
/* Pipeline D — لوحة إعادة التوزيع                                */
/* ═══════════════════════════════════════════════════════════════ */
.oaf-redist-emp {
  display: flex; align-items: center; gap: .55rem;
  padding: .4rem .6rem; border-radius: 8px; margin-bottom: .3rem;
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background .15s;
}
.oaf-redist-emp:hover { background: var(--surface-3, #f1f5f9); }
.oaf-redist-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.oaf-redist-name { font-weight: 700; font-size: .85rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oaf-redist-meta { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }

.oaf-redist-task {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .7rem; border-radius: 8px; margin-bottom: .3rem;
  background: rgba(239,68,68,.05); border: 1px solid rgba(239,68,68,.18);
}

/* ═══════════════════════════════════════════════════════════════ */
/* Pipeline D — موقع ملفات المشروع (بوابة الموظف)                 */
/* ═══════════════════════════════════════════════════════════════ */
.ts-files-location {
  display: flex; align-items: center; gap: .4rem;
  background: rgba(255,107,53,.07); border: 1px dashed rgba(255,107,53,.35);
  border-radius: 8px; padding: .35rem .6rem;
  font-size: .78rem; color: var(--text);
}
.ts-copy-loc-btn:hover { background: rgba(255,107,53,.1) !important; border-color: var(--accent) !important; }

/* ═══════════════════════════════════════════════════════════════ */
/* Pipeline D — شريط تصدير البيانات الخام                         */
/* ═══════════════════════════════════════════════════════════════ */
.oaf-export-bar .form-control {
  font-size: .85rem; border-radius: 8px;
}
@media (max-width: 600px) {
  .oaf-export-bar { flex-direction: column; }
  .oaf-export-bar > * { width: 100%; }
}
