/* تطبيق الجوال - نادي ضباط الشرطة (ينشط ≤768px) */

/* ===== Splash ===== */
.app-splash {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: linear-gradient(180deg, #1a3358, #2c5282);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    color: #fff;
}

.app-splash .splash-logo {
    font-size: 4rem;
    animation: splash-bounce 0.9s ease infinite alternate;
}

@keyframes splash-bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-18px);
    }
}

.app-splash h1 {
    font-size: 1.3rem;
    margin: 0;
}

.app-splash .splash-bar {
    width: 160px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    overflow: hidden;
}

.app-splash .splash-bar span {
    display: block;
    height: 100%;
    width: 30%;
    background: var(--gold, #c9a961);
    border-radius: 999px;
    animation: splash-load 1.4s ease forwards;
}

@keyframes splash-load {
    to {
        width: 100%;
    }
}

/* ===== وضع الجوال العام ===== */
body.app-mobile {
    background: #f4f6fb;
}

/* إخفاء عناصر الديسكتوب */
body.app-mobile .sidebar,
body.app-mobile #menuToggle,
body.app-mobile .gate-background,
body.app-mobile .gate-background-image,
body.app-mobile .floating-logo-badge {
    display: none !important;
}

body.app-mobile .main-area {
    width: 100%;
}

/* الشريط العلوي للجوال: رأس كحلي متدرّج بعنوان موسّط */
body.app-mobile .topbar {
    background: linear-gradient(160deg, #2a3169 0%, #171d47 100%);
    color: #fff;
    border-bottom: none;
    padding-top: calc(0.9rem + env(safe-area-inset-top));
    padding-bottom: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
}

body.app-mobile .topbar h2 {
    color: #fff;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    grid-column: 2;
}

/* زر الرجوع في الرأس (يمين في RTL) */
body.app-mobile #backBtn {
    grid-column: 1;
    justify-self: center;
}
/* منطقة الإجراءات (الجرس) على اليسار */
body.app-mobile .topbar-actions {
    grid-column: 3;
    justify-self: center;
}

body.app-mobile .user-chip,
body.app-mobile .btn-logout {
    display: none;
}

body.app-mobile .icon-btn {
    color: #fff;
}

/* المحتوى فوق الشريط السفلي — خلفية فاتحة ونص داكن */
body.app-mobile .content {
    padding: 1rem;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
    color: var(--text, #1a1a1a);
}

body.app-mobile .page-head h3,
body.app-mobile .section-title {
    color: var(--navy, #1e2559);
}

/* بطاقة الآية/الكاروسيل على الجوال: كحلي متدرّج بنص أبيض */
body.app-mobile .quote-card {
    background: linear-gradient(150deg, #2a3169, #1a2150);
    border: none;
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(30, 37, 89, 0.25);
    /* مساحة علوية كافية حتى لا يغطي الشريط الذهبي بداية النص */
    padding: 3rem 1.5rem 1.6rem;
    position: relative;
    overflow: hidden;
}
/* الشريط الذهبي كعنصر زاوية علوي فقط — لا يتداخل مع النص */
body.app-mobile .quote-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 20px;
    width: 38px;
    height: 40px;
    background: var(--gold, #c8a45a);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
    opacity: 0.95;
}
body.app-mobile .quote-card p,
body.app-mobile .quote-mark {
    color: #fff;
    font-size: 1.12rem;
    line-height: 2.1;
    margin: 0;
}
body.app-mobile .quote-mark { color: var(--gold, #c8a45a); display: block; margin-bottom: 0.3rem; }

/* ===== الشريط السفلي (5 تبويبات بمركز مرفوع) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #ffffff;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(30, 37, 89, 0.1);
    border-top: 1px solid #eef0f6;
}

.bottom-nav button {
    background: transparent;
    border: none;
    color: #8a93ad;
    padding: 0.55rem 0.2rem 0.5rem;
    font-family: inherit;
    font-size: 0.66rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.22rem;
    transition: color 0.15s;
}

.bottom-nav button .bn-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.bottom-nav button.active {
    color: var(--navy, #1e2559);
}

/* التبويب المركزي (الرئيسية): دائرة كحلية مرفوعة */
.bottom-nav button.bn-center {
    position: relative;
    color: #fff;
}
.bottom-nav button.bn-center .bn-icon {
    position: absolute;
    top: -26px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(150deg, #2a3169, #171d47);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(30, 37, 89, 0.4);
    border: 4px solid #fff;
}
.bottom-nav button.bn-center {
    color: var(--navy, #1e2559);
    padding-top: 2.4rem;
}

/* ===== الرئيسية (جوال) ===== */
body.app-mobile .quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.quick-actions {
    display: none;
}

.quick-action {
    background: #fff;
    border: 1px solid #eef0f6;
    border-radius: 14px;
    color: var(--navy, #1e2559);
    padding: 0.85rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(30, 37, 89, 0.06);
}

.quick-action .qa-icon {
    font-size: 1.5rem;
}

/* ===== صفحة الحساب ===== */
.account-head {
    text-align: center;
    padding: 1.5rem 0;
    color: #fff;
}

.account-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold, #c9a961), #b8954f);
    color: var(--navy, #1e3a5f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 auto 0.75rem;
}

.account-head h3 {
    margin: 0.25rem 0;
    font-size: 1.3rem;
}

.account-rank {
    display: inline-block;
    background: var(--gold, #c9a961);
    color: var(--navy, #1e3a5f);
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.account-menu {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.account-menu button {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f1f4f9;
    padding: 0.95rem 1.1rem;
    text-align: start;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--navy, #1e3a5f);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.account-menu button:last-child {
    border-bottom: none;
}

.account-menu button.danger {
    color: var(--red, #dc2626);
}

/* شبكة الخدمات */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.service-tile {
    background: #fff;
    border-radius: 14px;
    padding: 1rem 0.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--navy, #1e3a5f);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.service-tile .svc-icon {
    font-size: 1.7rem;
}

/* ===== الوضع الليلي ===== */
body.dark {
    --bg: #0f1623;
    --text: #e5e7eb;
}

body.dark .topbar,
body.dark .panel,
body.dark .card-item,
body.dark .stat-card,
body.dark .table-wrap,
body.dark .inline-form,
body.dark .modal,
body.dark .account-menu,
body.dark .service-tile,
body.dark .faq-item,
body.dark .notif-item,
body.dark .bell-dropdown {
    background: #1b2638;
    color: #e5e7eb;
}

body.dark:not(.app-mobile) {
    background: #0f1623;
}

body.dark .data-table th {
    background: #243049;
    color: #e5e7eb;
}

body.dark .data-table td,
body.dark .list li,
body.dark .comment {
    border-color: #2a3854;
}

body.dark input,
body.dark textarea,
body.dark select {
    background: #243049;
    color: #e5e7eb;
    border-color: #2a3854;
}

body.dark .stat-value,
body.dark .panel h4,
body.dark .card-item h4,
body.dark .page-head h3 {
    color: #e5e7eb;
}

/* ===== قائمة الأقسام (نمط المرجع) ===== */
.section-menu { list-style: none; margin: -0.25rem 0 0; padding: 0; }
.section-menu li { border-bottom: 1px solid #eef0f6; }
.section-menu a {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 1.05rem 0.4rem; text-decoration: none; color: var(--navy, #1e2559);
}
.section-menu .sm-icon { font-size: 1.4rem; width: 30px; text-align: center; }
.section-menu .sm-label { flex: 1; font-size: 1rem; font-weight: 600; }
.section-menu .sm-chev { color: #b6bccf; font-size: 1.3rem; }

/* ===== صفحة الحساب (نمط المرجع) ===== */
.ac-profile {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.5rem 0.25rem 1.25rem; flex-direction: row-reverse; text-align: right;
}
.ac-avatar-ring {
    position: relative; width: 92px; height: 92px; border-radius: 50%; flex: 0 0 auto;
    background: conic-gradient(var(--gold, #c8a45a) calc(var(--pct) * 1%), #e6e9f2 0);
    display: flex; align-items: center; justify-content: center;
}
.ac-avatar {
    width: 76px; height: 76px; border-radius: 50%;
    background: linear-gradient(150deg, #2a3169, #171d47); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem; font-weight: 800;
}
.ac-pct {
    position: absolute; bottom: -4px; inset-inline-start: 50%; transform: translateX(-50%);
    background: var(--navy, #1e2559); color: #fff; font-size: 0.68rem; font-weight: 700;
    padding: 0.1rem 0.5rem; border-radius: 999px; border: 2px solid #fff;
}
.ac-id h3 { margin: 0 0 0.2rem; font-size: 1.2rem; color: var(--navy, #1e2559); }
.ac-id p { font-size: 0.82rem; margin: 0.1rem 0; }

.ac-card { background: #fff; border-radius: 16px; box-shadow: 0 4px 14px rgba(30,37,89,0.06); margin-bottom: 1rem; overflow: hidden; }
.ac-card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.9rem 1.1rem; background: #f3f5fb;
}
.ac-card-head strong { color: var(--navy, #1e2559); font-size: 1rem; }
.ac-edit { background: none; border: none; color: var(--navy, #1e2559); font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.ac-row { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1.1rem; border-top: 1px solid #f1f3f9; }
.ac-row:first-of-type { border-top: none; }
.ac-k { color: var(--muted, #6b7280); font-size: 0.9rem; }
.ac-v { color: var(--navy, #1e2559); font-weight: 600; font-size: 0.95rem; text-align: left; }
.ac-v.muted { color: #9aa2b8; font-weight: 500; }

/* ===== الرئيسية: ترحيب بنمط المرجع ===== */
body.app-mobile .dash-greeting { display: flex; align-items: center; gap: 0.8rem; flex-direction: row-reverse; padding: 0.5rem 0 1rem; border-bottom: 1px solid #eef0f6; margin-bottom: 1rem; }
body.app-mobile .dash-greeting .dg-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(150deg,#2a3169,#171d47); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.2rem; flex:0 0 auto; }
body.app-mobile .dash-greeting .dg-hi { color: var(--gold, #c8a45a); font-size: 0.9rem; }
body.app-mobile .dash-greeting .dg-name { color: var(--navy, #1e2559); font-size: 1.2rem; font-weight: 800; }

/* تحسين بطاقات الخدمات على الخلفية الفاتحة */
.service-tile { box-shadow: 0 4px 14px rgba(30,37,89,0.07); }

/* شارة الجرس فوق الرأس الكحلي */
body.app-mobile .bell-wrap { position: relative; }

/* الرئيسية: بطاقة الترحيب بنمط المرجع (جوال) */
body.app-mobile .welcome-card {
    background: transparent;
    box-shadow: none;
    padding: 0.25rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-direction: row-reverse;
    border-bottom: 1px solid #eef0f6;
    margin-bottom: 1.1rem;
}
body.app-mobile .welcome-card .dg-avatar {
    width: 58px; height: 58px; border-radius: 50%;
    background: linear-gradient(150deg,#2a3169,#171d47); color:#fff;
    display:flex; align-items:center; justify-content:center; font-weight:800; font-size:1.3rem; flex:0 0 auto;
}
body.app-mobile .welcome-card .welcome-text { text-align: right; }
body.app-mobile .welcome-card .welcome-hi { color: var(--gold, #c8a45a); font-size: 0.92rem; display:block; }
body.app-mobile .welcome-card h3 { color: var(--navy, #1e2559); font-size: 1.25rem; margin: 0.1rem 0; }
body.app-mobile .welcome-card .welcome-date { color: var(--muted, #6b7280); font-size: 0.8rem; }
/* إخفاء صورة الترحيب على سطح المكتب */
.welcome-card .dg-avatar { display: none; }

/* ===== نظام الأيقونات الموحّد (خطّي أحادي اللون) ===== */
.ui-icon { display: block; }
/* أيقونات قائمة الأقسام/الخدمات: بلون النادي الكحلي داخل دائرة فاتحة */
.section-menu .sm-icon {
    width: 42px; height: 42px; border-radius: 12px;
    background: #eef1fa; color: var(--navy, #1e2559);
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.section-menu .sm-icon .ui-icon { width: 22px; height: 22px; }
/* أيقونات الشريط السفلي */
.bottom-nav .bn-icon .ui-icon { width: 24px; height: 24px; }
.bottom-nav button.bn-center .bn-icon .ui-icon { width: 26px; height: 26px; }
/* أيقونات الإجراءات السريعة */
.quick-action .qa-icon { color: var(--navy, #1e2559); display: flex; }
.quick-action .qa-icon .ui-icon { width: 26px; height: 26px; }
