/**
 * ╔══════════════════════════════════════════════════════════╗
 * ║  نظام ByteVia - Light Mode (RTL Arabic)                 ║
 * ╚══════════════════════════════════════════════════════════╝
 */
:root {
    --bv-bg: #f1f5f9; --bv-bg-alt: #e2e8f0;
    --bv-surface: #ffffff; --bv-surface-light: #f8fafc; --bv-surface-hover: #f1f5f9;
    --bv-primary: #2563eb; --bv-primary-dark: #1d4ed8; --bv-primary-light: #dbeafe;
    --bv-success: #059669; --bv-success-light: #d1fae5;
    --bv-warning: #d97706; --bv-warning-light: #fef3c7;
    --bv-danger: #dc2626; --bv-danger-light: #fee2e2;
    --bv-purple: #7c3aed; --bv-purple-light: #ede9fe;
    --bv-cyan: #0891b2; --bv-cyan-light: #cffafe;
    --bv-text: #1e293b; --bv-text-secondary: #475569; --bv-text-muted: #64748b; --bv-text-dim: #94a3b8;
    --bv-border: #e2e8f0; --bv-border-light: #f1f5f9;
    --bv-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --bv-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --bv-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --bv-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --bv-sidebar-w: 260px; --bv-topbar-h: 60px; --bv-radius: 12px;
    --bv-font: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--bv-font); background: var(--bv-bg); color: var(--bv-text); margin: 0; min-height: 100vh; -webkit-font-smoothing: antialiased; line-height: 1.6; }
a { color: var(--bv-primary); text-decoration: none; } a:hover { color: var(--bv-primary-dark); }
.app-wrapper { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-right: var(--bv-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ═══ القائمة الجانبية ═══ */
.sidebar { width: var(--bv-sidebar-w); background: var(--bv-surface); border-left: 1px solid var(--bv-border); position: fixed; right: 0; top: 0; bottom: 0; display: flex; flex-direction: column; z-index: 100; overflow-y: auto; box-shadow: -2px 0 8px rgba(0,0,0,0.03); }
.sidebar-brand { padding: 20px; border-bottom: 1px solid var(--bv-border); display: flex; align-items: center; gap: 12px; }
.brand-icon, .brand-icon-lg { background: linear-gradient(135deg, var(--bv-primary), #7c3aed); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 17px; }
.brand-icon-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }
.brand-text h1 { font-size: 18px; font-weight: 800; color: var(--bv-text); margin: 0; }
.brand-text small { font-size: 10px; color: var(--bv-text-dim); }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group { margin-bottom: 20px; }
.nav-group-label { display: block; font-size: 10px; font-weight: 700; color: var(--bv-text-dim); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 12px; margin-bottom: 6px; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 10px; color: var(--bv-text-secondary); font-size: 13.5px; font-weight: 500; transition: all 0.15s; margin-bottom: 2px; border: 1px solid transparent; }
.sidebar-nav .nav-link:hover { background: var(--bv-surface-hover); color: var(--bv-text); }
.sidebar-nav .nav-link.active { background: var(--bv-primary-light); color: var(--bv-primary); font-weight: 700; border-color: rgba(37,99,235,0.15); }
.sidebar-nav .nav-link i { font-size: 17px; width: 24px; text-align: center; opacity: 0.75; }
.sidebar-nav .nav-link.active i { opacity: 1; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--bv-border); background: var(--bv-surface-light); }
.user-mini { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #059669, #0891b2); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: var(--bv-text); }
.user-role { font-size: 11px; color: var(--bv-text-dim); }

/* ═══ الشريط العلوي ═══ */
.top-bar { height: var(--bv-topbar-h); padding: 0 28px; background: var(--bv-surface); border-bottom: 1px solid var(--bv-border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; box-shadow: var(--bv-shadow-sm); }
.top-bar-title { font-size: 17px; font-weight: 700; color: var(--bv-text); margin: 0; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bv-bg); border: 1px solid var(--bv-border); border-radius: 10px; padding: 7px 14px; }
.search-box:focus-within { border-color: var(--bv-primary); }
.search-box i { color: var(--bv-text-dim); font-size: 14px; }
.search-box input { background: none; border: none; outline: none; color: var(--bv-text); font-family: var(--bv-font); font-size: 13px; width: 200px; }
.search-box input::placeholder { color: var(--bv-text-dim); }
.btn-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--bv-bg); border: 1px solid var(--bv-border); color: var(--bv-text-muted); display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; }
.btn-icon:hover { background: var(--bv-surface-hover); color: var(--bv-text); }
.notification-badge { position: absolute; top: 6px; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bv-danger); }
.user-dropdown { background: none; border: none; color: var(--bv-text); cursor: pointer; padding: 4px; font-family: var(--bv-font); }
.user-avatar-sm { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #059669, #0891b2); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.user-name-sm { font-size: 13px; font-weight: 600; color: var(--bv-text); }

/* ═══ البطاقات ═══ */
.card { background: var(--bv-surface); border: 1px solid var(--bv-border); border-radius: var(--bv-radius); box-shadow: var(--bv-shadow-sm); color: var(--bv-text); }
.card:hover { box-shadow: var(--bv-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--bv-border-light); padding: 16px 20px; }
.card-header h6 { color: var(--bv-text); margin: 0; font-weight: 700; }
.card-body { padding: 20px; }
.card-footer { background: var(--bv-surface-light); border-top: 1px solid var(--bv-border-light); padding: 12px 20px; }
.card-tab { border-radius: 0 0 var(--bv-radius) var(--bv-radius); border-top: none; }

/* ═══ بطاقات إحصائية ═══ */
.stat-card { background: var(--bv-surface); border: 1px solid var(--bv-border); border-radius: var(--bv-radius); padding: 20px; box-shadow: var(--bv-shadow-sm); transition: all 0.2s; }
.stat-card:hover { box-shadow: var(--bv-shadow-md); transform: translateY(-2px); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; margin-bottom: 12px; }
.stat-label { display: block; font-size: 12px; color: var(--bv-text-muted); font-weight: 600; margin-bottom: 4px; }
.stat-value { display: block; font-size: 24px; font-weight: 800; color: var(--bv-text); letter-spacing: -0.03em; }

/* ═══ الجداول ═══ */
.table { color: var(--bv-text); --bs-table-bg: transparent; }
.table thead th { font-size: 11.5px; color: var(--bv-text-muted); font-weight: 700; border-bottom: 2px solid var(--bv-border); padding: 12px 16px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bv-surface-light); }
.table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--bv-border-light); vertical-align: middle; font-size: 13.5px; }
.table-hover tbody tr:hover { background: var(--bv-surface-hover); }
.table-danger-subtle { background: #fef2f2 !important; }

/* ═══ النماذج ═══ */
.form-control, .form-select { background: var(--bv-surface); border: 1px solid var(--bv-border); color: var(--bv-text); border-radius: 10px; font-family: var(--bv-font); font-size: 13.5px; padding: 8px 14px; }
.form-control:focus, .form-select:focus { background: var(--bv-surface); color: var(--bv-text); border-color: var(--bv-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.form-control::placeholder { color: var(--bv-text-dim); }
.form-label { font-size: 13px; font-weight: 600; color: var(--bv-text-secondary); margin-bottom: 5px; }
.input-group-text { background: var(--bv-surface-light); border: 1px solid var(--bv-border); color: var(--bv-text-muted); }
.form-check-input { border-color: var(--bv-border); }
.form-check-input:checked { background-color: var(--bv-primary); border-color: var(--bv-primary); }

/* ═══ الأزرار ═══ */
.btn { font-family: var(--bv-font); border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--bv-primary); border-color: var(--bv-primary); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,0.3); }
.btn-primary:hover { background: var(--bv-primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.btn-outline-primary { border-color: var(--bv-primary); color: var(--bv-primary); }
.btn-outline-primary:hover { background: var(--bv-primary-light); color: var(--bv-primary-dark); }
.btn-outline-secondary { border-color: var(--bv-border); color: var(--bv-text-muted); }
.btn-outline-secondary:hover { background: var(--bv-surface-hover); color: var(--bv-text); }
.btn-outline-secondary.active { background: var(--bv-primary-light); color: var(--bv-primary); border-color: var(--bv-primary); }
.btn-success { background: var(--bv-success); border-color: var(--bv-success); }
.btn-outline-danger { border-color: #fca5a5; color: var(--bv-danger); }
.btn-outline-danger:hover { background: var(--bv-danger-light); }
.btn-outline-success { border-color: #6ee7b7; color: var(--bv-success); }
.btn-outline-success:hover { background: var(--bv-success-light); }

/* ═══ شارات ═══ */
.badge { font-weight: 600; font-size: 11px; padding: 4px 10px; border-radius: 6px; }
.bg-primary-subtle { background: var(--bv-primary-light) !important; } .text-primary { color: var(--bv-primary) !important; }
.bg-success-subtle { background: var(--bv-success-light) !important; } .text-success { color: var(--bv-success) !important; }
.bg-warning-subtle { background: var(--bv-warning-light) !important; } .text-warning { color: var(--bv-warning) !important; }
.bg-danger-subtle { background: var(--bv-danger-light) !important; } .text-danger { color: var(--bv-danger) !important; }
.bg-info-subtle { background: var(--bv-cyan-light) !important; } .text-info { color: var(--bv-cyan) !important; }
.bg-secondary-subtle { background: #f1f5f9 !important; } .text-secondary { color: var(--bv-text-muted) !important; }

/* ═══ تبويبات ═══ */
.nav-tabs { border-bottom: 2px solid var(--bv-border); }
.nav-tabs .nav-link { color: var(--bv-text-muted); border: none; font-weight: 600; font-size: 13px; padding: 12px 18px; font-family: var(--bv-font); }
.nav-tabs .nav-link:hover { color: var(--bv-text); }
.nav-tabs .nav-link.active { color: var(--bv-primary); background: transparent; border-bottom: 2.5px solid var(--bv-primary); }

/* ═══ قوائم منسدلة ═══ */
.dropdown-menu { background: var(--bv-surface); border: 1px solid var(--bv-border); border-radius: var(--bv-radius); box-shadow: var(--bv-shadow-lg); font-family: var(--bv-font); padding: 6px; }
.dropdown-item { color: var(--bv-text-secondary); font-size: 13px; padding: 8px 14px; border-radius: 8px; }
.dropdown-item:hover { background: var(--bv-surface-hover); color: var(--bv-text); }
.dropdown-header { color: var(--bv-text-dim); font-size: 11px; font-weight: 700; }
.dropdown-divider { border-color: var(--bv-border-light); }

/* ═══ تنبيهات ═══ */
.alert { border-radius: var(--bv-radius); font-size: 14px; font-family: var(--bv-font); }

/* ═══ تصفح ترقيمي ═══ */
.pagination .page-link { background: var(--bv-surface); border-color: var(--bv-border); color: var(--bv-text-muted); font-family: var(--bv-font); }
.pagination .page-item.active .page-link { background: var(--bv-primary); border-color: var(--bv-primary); color: #fff; }

/* ═══ شريط تقدم ═══ */
.progress { background: var(--bv-bg-alt); border-radius: 6px; } .progress-bar { border-radius: 6px; transition: width 0.8s; }

/* ═══ معلومات عميل ═══ */
.client-info .info-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--bv-border-light); font-size: 13.5px; }
.client-info .info-row:last-child { border: none; }
.client-info .label { color: var(--bv-text-muted); font-weight: 500; }

/* ═══ Timeline ═══ */
.timeline { padding: 16px 20px; }
.timeline-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--bv-border-light); }
.timeline-item:last-child { border: none; }
.timeline-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; color: #fff; }
.timeline-content h6 { font-size: 14px; margin-bottom: 4px; color: var(--bv-text); }

/* ═══ صور رمزية ═══ */
.avatar-sm { width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, var(--bv-purple), var(--bv-primary)); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ═══ قائمة مجموعات ═══ */
.list-group-item { background: transparent; border-color: var(--bv-border-light); color: var(--bv-text); }
.list-group-item:hover { background: var(--bv-surface-hover); }

/* ═══ تسجيل الدخول ═══ */
.auth-body { background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 50%, #f0f9ff 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-container { width: 100%; max-width: 440px; padding: 20px; }
.auth-card { background: var(--bv-surface); border: 1px solid var(--bv-border); border-radius: 20px; padding: 40px 32px; box-shadow: var(--bv-shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h2 { font-size: 28px; font-weight: 800; color: var(--bv-text); margin: 12px 0 4px; }
.auth-footer { text-align: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--bv-border-light); }

/* ═══ ذيل ═══ */
.app-footer { padding: 16px 28px; border-top: 1px solid var(--bv-border); font-size: 12px; color: var(--bv-text-dim); margin-top: auto; background: var(--bv-surface); }

/* ═══ نوافذ منبثقة ═══ */
.modal-content { background: var(--bv-surface); border: 1px solid var(--bv-border); border-radius: 16px; box-shadow: var(--bv-shadow-lg); color: var(--bv-text); }
.modal-header { border-bottom: 1px solid var(--bv-border-light); }
.modal-footer { border-top: 1px solid var(--bv-border-light); }
.modal-title { font-weight: 700; color: var(--bv-text); }

/* ═══ كانبان ═══ */
.kanban-card { cursor: grab; transition: all 0.15s; } .kanban-card:hover { box-shadow: var(--bv-shadow-md); transform: translateY(-2px); }
.font-monospace { font-family: 'Courier New', monospace; }

/* ═══ تجاوب ═══ */
@media (max-width: 991px) { .sidebar { transform: translateX(100%); transition: transform 0.3s; } .sidebar.show { transform: translateX(0); } .main-content { margin-right: 0 !important; } #sidebar-toggle { display: inline-flex !important; } }
@media (max-width: 576px) { .stat-card { padding: 16px; } .stat-value { font-size: 20px; } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media print { .sidebar, .top-bar, .app-footer, .btn, .d-print-none { display: none !important; } .main-content { margin: 0 !important; } .card { box-shadow: none !important; } body { background: #fff !important; } }
