/* =========================================================
   لوحة تحكم التوصيل — هوية بصرية مخصصة
   Cairo لعناوين، Tajawal للنصوص — تركواز + كحلي + برتقالي تنبيه
   ========================================================= */

:root {
    --ink: #0F1B2D;
    --muted: #6B7A90;
    --bg: #F3F5F9;
    --surface: #FFFFFF;

    --navy-900: #0B1425;
    --navy-800: #12203A;
    --navy-700: #1A2C4C;

    --teal: #0D9488;
    --teal-light: #14B8A6;
    --teal-50: #E6F6F4;

    --amber: #F59E0B;
    --rose: #F43F5E;
    --emerald: #22C55E;
    --sky: #0EA5E9;

    /* إعادة توجيه ألوان Bootstrap لهوية اللوحة */
    --bs-primary: #0D9488;
    --bs-primary-rgb: 13,148,136;
    --bs-success: #22C55E;
    --bs-success-rgb: 34,197,94;
    --bs-danger: #F43F5E;
    --bs-danger-rgb: 244,63,94;
    --bs-warning: #F59E0B;
    --bs-warning-rgb: 245,158,11;
    --bs-info: #0EA5E9;
    --bs-info-rgb: 14,165,233;
    --bs-secondary: #6B7A90;
    --bs-secondary-rgb: 107,122,144;
    --bs-body-font-family: 'Tajawal', sans-serif;
    --bs-border-radius: .65rem;
    --bs-border-radius-lg: .9rem;
    --bs-border-radius-sm: .45rem;
}

* { font-family: 'Tajawal', sans-serif; }
h1, h2, h3, h4, h5, h6, .brand-font { font-family: 'Cairo', sans-serif; font-weight: 700; }

body { background: var(--bg); color: var(--ink); }
a { text-decoration: none; }

::selection { background: var(--teal-light); color: #fff; }

.wrapper { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: 264px;
    background: linear-gradient(190deg, var(--navy-900) 0%, var(--navy-700) 100%);
    color: #fff;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform .3s ease;
    border-left: 1px solid rgba(255,255,255,.06);
    scrollbar-width: none;
}
.sidebar-brand {
    padding: 26px 22px 22px;
    font-family: 'Cairo', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}
.sidebar-brand i {
    width: 38px; height: 38px;
    background: var(--teal);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.sidebar-menu { list-style: none; padding: 10px 14px 20px; margin: 0; }
.sidebar-menu .group-label {
    color: rgba(255,255,255,.35);
    font-size: .72rem;
    padding: 16px 12px 6px;
    letter-spacing: .3px;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,.68);
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 3px;
    font-size: .94rem;
    font-weight: 500;
    border-right: 3px solid transparent;
    transition: background .18s, color .18s;
}
.sidebar-menu li a i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-menu li a span { flex: 1; }
.sidebar-menu li a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-menu li a.active {
    background: rgba(20,184,166,.16);
    color: #fff;
    border-right-color: var(--teal-light);
}
.menu-badge {
    margin-inline-start: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===== Main ===== */
.main-content { margin-right: 264px; flex: 1; width: 100%; min-width: 0; }
.topbar {
    background: var(--surface);
    padding: 16px 28px;
    border-bottom: 1px solid #EAEDF3;
    position: sticky;
    top: 0;
    z-index: 500;
}
.topbar h5 { margin: 0; font-size: 1.05rem; }

.topbar-icon-btn {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    font-size: 1.1rem;
    padding: 0;
}
.topbar-badge {
    position: absolute;
    top: -4px; left: -4px;
    background: var(--rose);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}
.page-content { padding: 15px; }

/* ===== Cards ===== */
.card {
    border: 1px solid #EAEDF3;
    border-radius: var(--bs-border-radius-lg);
    box-shadow: 0 1px 2px rgba(15,27,45,.04);
}
.card-header { border-bottom: 1px solid #EAEDF3; font-family: 'Cairo', sans-serif; }

.stat-card {
    background: var(--surface);
    border: 1px solid #EAEDF3;
    border-radius: var(--bs-border-radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    height: 100%;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 3px;
    background: var(--accent, var(--teal));
}
.stat-card .stat-label { color: var(--muted); font-size: .82rem; margin-bottom: 6px; }
.stat-card .stat-value { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.5rem; color: var(--ink); }
.stat-card .stat-icon {
    color: var(--accent, var(--teal));
    background: color-mix(in srgb, var(--accent, var(--teal)) 14%, white);
    font-size: 1.15rem;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    float: left;
    margin-bottom: 6px;
}

/* ===== Tables ===== */
.table { background: var(--surface); margin-bottom: 0; }
.table thead th {
    background: #F7F9FC;
    color: var(--muted);
    font-weight: 600;
    font-size: .82rem;
    border-bottom: 1px solid #EAEDF3;
    padding: 12px 16px;
}
.table td { padding: 12px 16px; vertical-align: middle; border-color: #EEF1F6; font-size: .92rem; }
.table-hover tbody tr:hover { background: var(--teal-50); }

.badge { font-weight: 600; padding: 6px 11px; border-radius: 7px; font-size: .76rem; }

.btn { font-weight: 600; border-radius: var(--bs-border-radius); padding-top: .55rem; padding-bottom: .55rem; }
.btn-sm { padding-top: .3rem; padding-bottom: .3rem; }
.btn-primary { --bs-btn-bg: var(--teal); --bs-btn-border-color: var(--teal); --bs-btn-hover-bg: #0B7A70; --bs-btn-hover-border-color: #0B7A70; }

.form-control, .form-select {
    border-radius: .55rem;
    border-color: #DEE3EC;
    padding: .55rem .8rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--teal-light);
    box-shadow: 0 0 0 .2rem rgba(13,148,136,.12);
}
.form-label { font-weight: 600; font-size: .87rem; color: var(--ink); }

.modal-content { border-radius: var(--bs-border-radius-lg); border: none; }
.modal-header, .modal-footer { border-color: #EAEDF3; }

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    display: flex;
}
.login-side {
    flex: 1;
    background:
        radial-gradient(circle at 20% 20%, rgba(20,184,166,.25), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(13,148,136,.2), transparent 50%),
        linear-gradient(160deg, var(--navy-900), var(--navy-700));
    color: #fff;
    display: none;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    position: relative;
}
.login-side .brand { font-family: 'Cairo', sans-serif; font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-side .brand i { width: 46px; height: 46px; background: var(--teal); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.login-side h2 { font-size: 1.8rem; max-width: 420px; line-height: 1.5; }
.login-side p { color: rgba(255,255,255,.6); max-width: 400px; line-height: 1.8; }
.login-side .stat-row { display: flex; gap: 30px; margin-top: 40px; }
.login-side .stat-row div strong { display: block; font-family: 'Cairo', sans-serif; font-size: 1.5rem; }
.login-side .stat-row div span { color: rgba(255,255,255,.55); font-size: .82rem; }

.login-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: var(--surface);
}
.login-box { width: 100%; max-width: 380px; }
.login-box .icon-badge {
    width: 52px; height: 52px;
    background: var(--teal-50);
    color: var(--teal);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 18px;
}

@media (min-width: 992px) { .login-side { display: flex; } }

/* ===== Chat ===== */
.chat-window { height: 60vh; overflow-y: auto; background: var(--bg); border-radius: 12px; padding: 18px; border: 1px solid #EAEDF3; }
.msg { max-width: 68%; padding: 10px 15px; border-radius: 14px; margin-bottom: 10px; font-size: .92rem; line-height: 1.6; }
.msg-admin { background: var(--teal); color: #fff; margin-left: auto; border-bottom-left-radius: 4px; }
.msg-client { background: var(--surface); margin-right: auto; border: 1px solid #EAEDF3; border-bottom-right-radius: 4px; }

/* ===== Misc ===== */
.list-group-item.active { background: var(--teal); border-color: var(--teal); }
.pagination .page-item.active .page-link { background: var(--teal); border-color: var(--teal); }
.pagination .page-link { color: var(--teal); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--teal-light);
    outline-offset: 2px;
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .page-content { padding: 15px; }
}

/* نقطة أونلاين/أوفلاين للسائق */
.online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-left: 6px;
}

/* صورة مصغّرة في الجداول (زي جدول السائقين) */
.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #EAEDF3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.avatar-placeholder {
    background: var(--teal-50);
    color: var(--teal);
    font-size: 1rem;
}
/* نقطة الأونلاين فوق زاوية الصورة المصغّرة بدل ما تكون سطر منفصل */
.online-dot-corner {
    position: absolute;
    bottom: 0;
    left: -2px;
    margin: 0;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
}

/* الصورة الشخصية في ملف العميل/السائق */
.avatar-lg {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--teal-50);
}

/* صفحة توثيق الـ API */
.endpoint-card { border-inline-start: 4px solid var(--teal); }
.endpoint-path { background: #F1F5F9; padding: 4px 10px; border-radius: 6px; font-size: .88rem; direction: ltr; display: inline-block; }
.code-block {
    background: var(--navy-900);
    color: #E2E8F0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .8rem;
    direction: ltr;
    text-align: left;
    margin: 0;
    overflow-x: auto;
}
.code-block-response { color: #86EFAC; }
#apiTabs .nav-link { border-radius: 10px; font-weight: 600; color: var(--ink); }
#apiTabs .nav-link.active { background: var(--teal); color: #fff; }
