/* ===== دردشة النخبة - التصميم (ثيم أبيض فاتح) ===== */
:root {
    --bg: #f4f6fb;
    --bg2: #e9edf5;
    --panel: #ffffff;
    --panel2: #f1f4fa;
    --border: #dde3ee;
    --primary: #7c3aed;
    --primary2: #a855f7;
    --accent: #0891b2;
    --gold: #d97706;
    --text: #1e2433;
    --muted: #64748b;
    --danger: #e11d48;
    --ok: #059669;
    --radius: 14px;
    --shadow: 0 4px 18px rgba(15, 23, 42, .08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}
a { color: var(--accent); text-decoration: none; }

/* ---------- الخلفية المتحركة للدخول ---------- */
.auth-body {
    background:
        radial-gradient(1000px 600px at 85% -10%, rgba(124,58,237,.14), transparent 60%),
        radial-gradient(800px 500px at 10% 110%, rgba(34,211,238,.10), transparent 60%),
        var(--bg);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 34px 30px;
    box-shadow: 0 25px 60px rgba(15,23,42,.12);
}
.auth-logo { text-align: center; margin-bottom: 22px; }
/* تاج الواجهة: يتوهج ويتمايل */
.logo-crown {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 8px;
    display: inline-block;
    animation: crownFloat 2.6s ease-in-out infinite, crownGlow 2s ease-in-out infinite;
}
@keyframes crownFloat {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50%      { transform: translateY(-7px) rotate(4deg); }
}
@keyframes crownGlow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(251,191,36,.8)); }
    50%      { filter: drop-shadow(0 0 22px rgba(251,191,36,1)); }
}
/* عنوان "دردشة ملكية": ألوان متحركة متغيرة */
.brand-title {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6, #22d3ee, #f59e0b);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: brandColors 4s linear infinite;
}
@keyframes brandColors {
    0%   { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}
.tagline { color: var(--muted); font-size: 13px; margin-top: 6px; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.alert-err { background: rgba(244,63,94,.12); border: 1px solid rgba(244,63,94,.4); color: #fda4af; }
.alert-ok  { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.4); color: #6ee7b7; }

.tabs { display: flex; background: var(--bg2); border-radius: 12px; padding: 5px; margin-bottom: 20px; border: 1px solid var(--border); }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tab.active { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; }

.auth-form label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.auth-form input, .form input, .form select, .form textarea {
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.auth-form input:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--primary2); }
.closed-note { text-align: center; color: var(--muted); padding: 20px 0; }
.hint { text-align: center; color: var(--gold); font-size: 13px; margin-top: 10px; }

.btn {
    display: inline-block;
    padding: 11px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    color: #fff;
    transition: transform .12s, filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); }
.btn-gold { background: linear-gradient(135deg, #d97706, var(--gold)); color: #1f1300; }
.btn-accent { background: linear-gradient(135deg, #0891b2, var(--accent)); color: #06252b; }
.btn-danger { background: linear-gradient(135deg, #be123c, var(--danger)); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- صفحة الدردشة ---------- */
.chat-body { overflow: hidden; height: 100vh; }
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }

/* الكمبيوتر: قائمة الأعضاء ظاهرة ثابتة كعمود جانبي */
.sidebar {
    background: var(--bg2);
    border-inline-start: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.me-card {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(34,211,238,.08));
}
.me-name { font-weight: 800; font-size: 16px; }
.me-coins { color: var(--gold); font-weight: 800; margin-top: 4px; }
.badge-role {
    display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 999px; margin-inline-start: 6px; vertical-align: middle;
}
.badge-owner { background: linear-gradient(135deg, var(--gold), #f59e0b); color: #211400; animation: ownerGlow 1.6s ease-in-out infinite; }
.badge-admin { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; animation: adminGlow 1.6s ease-in-out infinite; }
.badge-user  { background: var(--panel2); color: var(--muted); }
/* توهج متحرك لاسم المالك */
@keyframes ownerGlow {
    0%, 100% {
        box-shadow: 0 0 6px rgba(251,191,36,.55), 0 0 14px rgba(251,191,36,.25);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 12px rgba(251,191,36,.95), 0 0 26px rgba(251,191,36,.55);
        filter: brightness(1.18);
    }
}
/* توهج متحرك لاسم المشرف */
@keyframes adminGlow {
    0%, 100% {
        box-shadow: 0 0 6px rgba(124,58,237,.55), 0 0 14px rgba(34,211,238,.25);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 12px rgba(124,58,237,.95), 0 0 26px rgba(34,211,238,.5);
        filter: brightness(1.18);
    }
}

.side-title { padding: 12px 16px 6px; font-size: 12px; color: var(--muted); letter-spacing: 1px; }

/* ---------- كبار الداعمين ---------- */
.topfans { margin-top: 6px; }
.topfans-title {
    padding: 10px 12px 4px;
    text-align: center;
}
.topfans-title span {
    display: inline-block;
    font-size: 13.5px;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #fbbf24, #ec4899, #8b5cf6, #22d3ee, #fbbf24);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: brandColors 3.5s linear infinite, fanPulse 1.6s ease-in-out infinite;
}
@keyframes fanPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
.topfans-list { padding: 0 10px 8px; }
.topfan-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(251,191,36,.06);
    border: 1px solid rgba(251,191,36,.15);
    margin-bottom: 6px;
    font-size: 13px;
}
.topfan-rank { font-size: 15px; min-width: 22px; text-align: center; }
.topfan-item .uname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topfan-gems { color: var(--gold); font-weight: 800; font-size: 12px; }
.user-list { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.user-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.user-item:hover { background: var(--panel); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 800; color: #fff; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); margin-inline-start: auto; }
.side-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

.chat-main { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
.chat-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}
.chat-head h2 { font-size: 18px; }
.chat-head .welcome { color: var(--muted); font-size: 12px; margin-inline-start: auto; text-align: left; max-width: 40%; }

.messages { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; flex-direction: column; max-width: 72%; animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-head { font-size: 12px; color: var(--muted); margin-bottom: 3px; padding: 0 6px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* ----- فقاعات جديدة: ذيل + ظل ناعم + شريط لون جانبي ----- */
.msg-bubble {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--primary2);
    padding: 10px 16px;
    border-radius: 4px 20px 20px 20px;
    word-break: break-word;
    line-height: 1.6;
    box-shadow: var(--shadow);
}
.msg:not(.mine) .msg-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    inset-inline-start: -1px;
    width: 15px; height: 15px;
    background: var(--panel);
    border-inline-start: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-bottom-inline-start: 3px solid var(--primary2);
    border-bottom-left-radius: 14px;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.msg.mine .msg-bubble {
    background: linear-gradient(135deg, #7c3aed, #a855f7 55%, #22d3ee 130%);
    border: none;
    border-bottom-end-radius: 4px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(124,58,237,.35);
}
.msg.mine .msg-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    inset-inline-end: 0;
    width: 15px; height: 15px;
    background: #a855f7;
    border-bottom-right-radius: 14px;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.msg.mine .msg-head { justify-content: flex-end; }
.msg-system { align-self: center; max-width: 90%; }
.msg-system .msg-bubble {
    background: #fffbeb;
    border: 1px dashed rgba(217,119,6,.45);
    border-inline-start: 3px solid var(--gold);
    color: var(--gold);
    font-size: 13px;
    border-radius: 999px;
    padding: 6px 18px;
    box-shadow: none;
}
.msg-system .msg-bubble::after { display: none; }
.msg-gift .msg-bubble { padding: 8px; background: linear-gradient(160deg, #fffbeb, var(--panel)); border-color: rgba(217,119,6,.45); border-inline-start: 3px solid var(--gold); }
.msg-gift .msg-bubble::after { background: #fffbeb; border-inline-start: 1px solid rgba(217,119,6,.45); border-bottom: 1px solid rgba(217,119,6,.45); border-bottom-inline-start: 3px solid var(--gold); }
.gift-video {
    display: block;
    width: 240px; max-width: 100%;
    border-radius: 12px;
    background: #000;
}
.gift-name { font-size: 12px; color: var(--gold); padding: 6px 8px 2px; font-weight: 700; }

/* ---------- تضليلة الاسم + العلم + أيقونات الرتب ---------- */
.uname-decor.name-hl {
    background: linear-gradient(180deg, #fffbeb, #fef3c7);
    border: 1.5px solid var(--gold);
    border-radius: 9px;
    padding: 2px 12px;
    color: #92400e;
    font-weight: 800;
    text-shadow: none;
    box-shadow: 0 2px 8px rgba(217,119,6,.22), inset 0 0 8px rgba(217,119,6,.08);
}

/* تضليل المالك الخاص: مستطيل أسود واسم بتدرج ذهبي لامع متحرك (نمط الملك) */
.uname-decor.owner-hl {
    background: linear-gradient(180deg, #1a1b20, #000);
    border: 1.5px solid rgba(245,158,11,.6);
    border-radius: 10px;
    padding: 3px 14px;
    font-weight: 900;
    letter-spacing: .3px;
    box-shadow: 0 3px 12px rgba(0,0,0,.35), inset 0 0 14px rgba(245,158,11,.12);
    background-image: linear-gradient(180deg, #1a1b20, #000), linear-gradient(90deg, #fde68a, #f59e0b, #ea580c, #fbbf24, #fde68a);
    background-origin: border-box;
    background-clip: padding-box, text;
    -webkit-background-clip: padding-box, text;
    background-size: 100% 100%, 250% 100%;
    animation: ownerGold 3s linear infinite;
}
@keyframes ownerGold {
    0%   { background-position: 0 0, 0% 50%; }
    100% { background-position: 0 0, 250% 50%; }
}
.flag-ic { font-size: 13px; line-height: 1; }
.rank-ic { font-size: 13px; line-height: 1; }
.star-purple {
    color: #c084fc;
    font-size: 15px;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(192,132,252,.9), 0 0 14px rgba(147,51,234,.6);
}
/* ذئب صغير متحرك لاسم المالك: قفزة خفيفة ولمعان */
.rank-wolf {
    display: inline-block;
    font-size: 14px;
    animation: wolfPounce 1.8s ease-in-out infinite;
    filter: drop-shadow(0 0 5px rgba(168,85,247,.8)) drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
@keyframes wolfPounce {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    25%      { transform: translateY(-2px) rotate(-8deg) scale(1.06); }
    50%      { transform: translateY(0) rotate(0deg) scale(1); }
    65%      { transform: translateY(-3px) rotate(8deg) scale(1.12); }
}

/* ---------- وسائط الدردشة ---------- */
.msg-media { display: block; max-width: 280px; max-height: 320px; border-radius: 12px; background: #000; }
.msg-media-msg .msg-bubble { padding: 6px; }

/* ---------- زر شريط الإدخال + السمايلات ---------- */
.bar-icon-btn, .head-icon-btn {
    background: var(--panel2); border: 1px solid var(--border); color: var(--text);
    border-radius: 10px; cursor: pointer; font-size: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: transform .12s, background .12s;
}
.bar-icon-btn { width: 44px; height: 44px; flex: 0 0 auto; }
.head-icon-btn { width: 38px; height: 38px; font-size: 16px; }
.bar-icon-btn:hover, .head-icon-btn:hover { transform: translateY(-2px); background: var(--panel); }
.emoji-panel {
    position: fixed;
    bottom: 84px;
    inset-inline-start: 16px;
    width: min(340px, 86vw);
    max-height: 240px;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    z-index: 600;
    box-shadow: 0 18px 50px rgba(15,23,42,.18);
}
.emoji-panel.open { display: grid; }
.emoji-ic { background: none; border: 0; font-size: 21px; cursor: pointer; border-radius: 8px; padding: 4px 0; }
.emoji-ic:hover { background: var(--panel2); }

/* ---------- لوحة إشعارات الجرس ---------- */
.bell-panel {
    position: fixed;
    top: 58px;
    inset-inline-start: 12px;
    width: min(340px, 88vw);
    max-height: 60vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    z-index: 600;
    display: none;
    box-shadow: 0 18px 50px rgba(15,23,42,.18);
}
.bell-panel.open { display: block; }
.bp-head { padding: 12px 14px; font-weight: 800; border-bottom: 1px solid var(--border); color: var(--gold); }
.bp-item { display: flex; gap: 10px; padding: 10px 14px; cursor: pointer; align-items: center; border-bottom: 1px solid var(--border); }
.bp-item:hover { background: var(--panel2); }
.bp-name { font-weight: 700; font-size: 13.5px; }
.bp-body { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.bp-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- شريط كبار الداعمين: مستطيل رفيع متحرك أعلى الدردشة ---------- */
.topfans-bar {
    margin: 6px 18px 0;
    border-radius: 8px;
    padding: 1.5px;
    background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6, #0891b2, #f59e0b);
    background-size: 400% 100%;
    animation: brandColors 4s linear infinite;
    box-shadow: 0 2px 10px rgba(15,23,42,.10);
}
.tf-title {
    text-align: center;
    padding: 3px 8px 0;
    font-weight: 800;
    letter-spacing: .5px;
    font-size: 11px;
    color: #fff;
}
.tf-title span {
    display: inline-block;
    background: linear-gradient(90deg, #fbbf24, #f472b6, #c4b5fd, #67e8f9, #fbbf24);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: brandColors 3.2s linear infinite, fanPulse 1.6s ease-in-out infinite;
}
.tf-list {
    display: flex;
    gap: 6px;
    padding: 3px 8px 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tf-list::-webkit-scrollbar { display: none; }
.tf-item {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,.92);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    white-space: nowrap;
    flex: 0 0 auto;
}
.tf-rank { font-size: 15px; }
.tf-gems { color: var(--gold); font-weight: 800; }
/* صاحب المركز الأول: توهج ذهبي */
.tf-first {
    background: linear-gradient(135deg, rgba(251,191,36,.35), rgba(236,72,153,.22));
    border: 1px solid rgba(251,191,36,.65);
    box-shadow: 0 0 14px rgba(251,191,36,.35);
    animation: firstPulse 1.8s ease-in-out infinite;
}
@keyframes firstPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(251,191,36,.3); }
    50%      { box-shadow: 0 0 22px rgba(251,191,36,.6); }
}
/* شارة VIP لصاحب المركز الأول */
.tf-vip {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    background-size: 200% 100%;
    color: #fff;
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: 1px;
    padding: 2px 9px;
    border-radius: 999px;
    animation: brandColors 3s linear infinite, vipPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(236,72,153,.6);
}
@keyframes vipPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

/* ---------- ثيمات الدردشة (لكل عضو على حدة) ---------- */
/* ثيمات فاتحة كلها (لا يوجد وضع داكن) - الافتراضي أبيض */
body.theme-rose   { --bg: #fdf2f6; --bg2: #fbe9f1; --panel: #ffffff; --panel2: #fdf0f5; --primary: #ec4899; --primary2: #f472b6; --accent: #e11d48; --border: #f6d3e1; }
body.theme-ocean  { --bg: #eff8fd; --bg2: #e3f2fb; --panel: #ffffff; --panel2: #edf6fc; --primary: #0ea5e9; --primary2: #38bdf8; --accent: #0369a1; --border: #cfe7f5; }
body.theme-emerald{ --bg: #effaf3; --bg2: #e2f4ea; --panel: #ffffff; --panel2: #ecf7f1; --primary: #10b981; --primary2: #34d399; --accent: #047857; --border: #cdeadd; }
body.theme-gold   { --bg: #fdf9ef; --bg2: #faf1dd; --panel: #ffffff; --panel2: #fdf6e9; --primary: #d97706; --primary2: #f59e0b; --accent: #b45309; --border: #f0e2c2; }
body.theme-slate  { --bg: #f4f6f8; --bg2: #eaedf1; --panel: #ffffff; --panel2: #f0f3f6; --primary: #64748b; --primary2: #94a3b8; --accent: #475569; --border: #dbe1e8; }

.chat-inputbar {
    display: flex; gap: 10px; padding: 14px 20px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    align-items: center;
}
.chat-inputbar input[type=text] {
    flex: 1;
    padding: 13px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.chat-inputbar input[type=text]:focus { border-color: var(--primary2); }
.btn-gift {
    background: linear-gradient(135deg, #d97706, var(--gold));
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center; font-size: 20px; border: none; cursor: pointer;
    box-shadow: 0 0 18px rgba(251,191,36,.35);
}

/* ---------- نافذة الهدايا ---------- */
.gift-modal {
    position: fixed; inset: 0;
    background: rgba(5,3,15,.8);
    display: none;
    place-items: center;
    z-index: 50;
    backdrop-filter: blur(6px);
}
.gift-modal.open { display: grid; }
.gift-modal-content {
    width: min(860px, 94vw);
    max-height: 86vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
}
.gift-modal-content h3 { margin-bottom: 4px; }
.gift-modal-content .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gift-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s, border-color .15s;
}
.gift-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.gift-card video { width: 100%; aspect-ratio: 9/14; object-fit: cover; background: #000; display: block; }
.gift-card .gc-info { padding: 10px; text-align: center; }
.gift-card .gc-name { font-size: 13px; font-weight: 700; }
.gift-card .gc-price { color: var(--gold); font-weight: 800; font-size: 14px; margin-top: 3px; }
.modal-close {
    float: left; background: none; border: none; color: var(--muted);
    font-size: 26px; cursor: pointer; line-height: 1;
}

/* ---------- لوحة تحكم الأدمن ---------- */
.admin-body { background: var(--bg); }
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-nav {
    background: var(--bg2);
    border-inline-start: 1px solid var(--border);
    padding: 20px 0;
    position: sticky; top: 0; height: 100vh;
}
.admin-nav .brand { font-weight: 800; font-size: 17px; padding: 0 18px 18px; background: linear-gradient(90deg, var(--accent), var(--primary2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.admin-nav a.nav-link {
    display: block; padding: 12px 18px; color: var(--muted); font-size: 14.5px; font-weight: 600;
    border-inline-start: 3px solid transparent;
}
.admin-nav a.nav-link:hover { color: var(--text); background: var(--panel); }
.admin-nav a.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(124,58,237,.35), transparent); border-inline-start-color: var(--primary2); }
.admin-content { padding: 28px 32px; min-width: 0; }
.admin-content h1 { font-size: 22px; margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
    background: linear-gradient(160deg, var(--panel), var(--bg2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--accent); }
.stat-card.gold .num { color: var(--gold); }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
    text-align: right; padding: 12px 14px; background: var(--bg2);
    color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.tbl td { padding: 10px 14px; border-bottom: 1px solid rgba(58,47,110,.35); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl video { width: 110px; border-radius: 8px; display: block; background: #000; }

.form { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.form h3 { margin-bottom: 14px; font-size: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row > * { flex: 1; min-width: 140px; }
.form label { display: block; font-size: 13px; color: var(--muted); }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-on  { color: #6ee7b7; font-weight: 700; }
.tag-off { color: #fda4af; font-weight: 700; }
.search-input { max-width: 300px; }

.flash { max-width: 640px; }

@media (max-width: 860px) {
    .chat-layout { grid-template-columns: 1fr; }
    /* الهاتف: القائمة منسدلة - الزر يفتحها ويغلقها */
    .sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 64px; right: 0; left: auto;
        width: min(320px, 85vw);
        height: calc(100vh - 64px);
        z-index: 40;
        transform: translateX(110%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s;
        box-shadow: -8px 0 30px rgba(15,23,42,.16);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .sidebar.open { transform: translateX(0); visibility: visible; }
    .sidebar .me-card { flex-shrink: 0; }
    .sidebar .side-footer, .sidebar .side-links { flex-shrink: 0; }
    .sidebar .user-list { flex: 1 1 auto; min-height: 120px; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-nav { position: static; height: auto; display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
    .admin-nav .brand { display: none; }
    .admin-nav a.nav-link { white-space: nowrap; border-inline-start: none; border-bottom: 3px solid transparent; }
    .admin-nav a.nav-link.active { border-bottom-color: var(--primary2); }
    .msg { max-width: 92%; }
    .gift-video { width: 190px; }
}

/* ---------- الصور الشخصية ---------- */
.avatar-img { object-fit: cover; border: 2px solid rgba(168,85,247,.6); }
.flag-img { width: 21px; height: 14px; border-radius: 3px; object-fit: cover; vertical-align: middle; margin-inline-start: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.avatar-lg { width: 62px !important; height: 62px !important; font-size: 26px !important; }
.me-row { display: flex; align-items: center; gap: 10px; }
.me-info { flex: 1; min-width: 0; }
.me-bio {
    margin-top: 8px; font-size: 12.5px; color: var(--muted);
    background: var(--bg); border-radius: 8px; padding: 6px 10px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.me-bio:empty { display: none; }
.uname { cursor: pointer; }
.user-click { cursor: pointer; border: 1px solid transparent; }
.user-click:hover { border-color: var(--primary2); }

/* ---------- نافذة خيارات العضو ---------- */
.user-modal-content {
    width: min(420px, 92vw);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    position: relative;
}
.um-head { display: flex; align-items: center; gap: 14px; }
.um-name { font-weight: 800; font-size: 17px; }
.um-bio { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.6; }
.um-actions { display: flex; gap: 10px; margin-top: 18px; }
.um-actions .btn { flex: 1; }

/* ---------- الدردشة الخاصة ---------- */
.dm-content {
    width: min(560px, 94vw);
    height: min(640px, 88vh);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}
.dm-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}
.dm-title { font-weight: 800; flex: 1; }
.dm-head .modal-close { float: none; }
.dm-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.dm-messages .msg { max-width: 80%; }
.dm-inputbar {
    display: flex; gap: 8px; padding: 10px 12px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    align-items: center;
}
.dm-inputbar input {
    flex: 1; padding: 11px 14px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 999px; color: var(--text);
    font-family: inherit; font-size: 14px; outline: none;
}
.dm-inputbar input:focus { border-color: var(--primary2); }

/* ---------- زر قائمة الموبايل ---------- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px; height: 40px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    padding: 8px;
}
.hamburger span {
    display: block; height: 3px; width: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary2));
    border-radius: 2px;
}
@media (max-width: 860px) {
    .hamburger { display: flex; }
    .chat-head { padding: 10px 14px; }
    .chat-head h2 { font-size: 15px; }
    .chat-head .welcome { display: none; }
}

/* ---------- تأثير ملء الشاشة (هدايا + دخولية) - متجاوب ---------- */
.fx-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: grid;
    place-items: center;
    overflow: hidden;
    animation: fxIn .25s ease;
}
/* دعم متصفحات الجوال القديمة التي لا تفهم inset */
.fx-overlay { height: 100vh; height: 100dvh; }
/* الخلفية الضبابية: تملأ كل الشاشة على أي نسبة عرض/ارتفاع */
.fx-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(22px) brightness(.55) saturate(1.3);
    transform: scale(1.12);
    pointer-events: none;
}
/* الفيديو الرئيسي: يظهر كاملاً في المنتصف دون قص
   - الجوال: بحجم كبير يملأ الشاشة كما هو
   - الكمبيوتر: حجم أصغر متوازن في المنتصف */
.fx-main {
    position: relative;
    z-index: 1;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: none;
    outline: none;
    display: block;
    border-radius: 6px;
}
/* على الكمبيوتر: الهدية بحجم أصغر (يبقى التأثير ملء الشاشة بالخلفية الضبابية) */
@media (min-width: 1024px) {
    .fx-main { max-width: min(42vw, 640px); max-height: 62vh; }
}
/* دخولية المالك تبقى بملء الشاشة على كل الأجهزة */
.fx-intro .fx-main { max-width: 100%; max-height: 100%; border-radius: 0; }
.fx-title {
    position: absolute;
    z-index: 2;
    top: clamp(24px, 10vh, 90px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(124,58,237,.95), rgba(34,211,238,.85));
    color: #fff;
    font-size: clamp(15px, 4.5vw, 26px);
    font-weight: 800;
    padding: clamp(8px, 2vh, 14px) clamp(16px, 5vw, 38px);
    border-radius: 14px;
    border: 2px solid rgba(251,191,36,.85);
    box-shadow: 0 0 40px rgba(124,58,237,.8), 0 8px 30px rgba(0,0,0,.6);
    text-align: center;
    max-width: 92vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* شاشات ضيقة جداً: اسم التايتل على سطرين إن لزم */
@media (max-width: 380px) {
    .fx-title { white-space: normal; line-height: 1.4; }
}
.fx-out { animation: fxOut .5s ease forwards; }
@keyframes fxIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxOut { from { opacity: 1; } to { opacity: 0; } }
.gift-to { font-size: 12px; color: var(--gold); margin-top: 2px; }

/* ---------- الجواهر ---------- */
.me-gems { color: var(--accent); font-weight: 800; margin-top: 3px; font-size: 14px; }

/* ---------- تبويبات الغرف ---------- */
.rooms-bar {
    display: flex; gap: 8px; padding: 8px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.room-tab {
    padding: 7px 18px; border-radius: 999px; white-space: nowrap;
    background: var(--panel); border: 1px solid var(--border);
    color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 700;
    cursor: pointer; transition: all .15s;
}
.room-tab:hover { color: var(--text); border-color: var(--primary2); }
.room-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: #fff; border-color: transparent;
}

/* ---------- جرس الإشعارات ---------- */
.bell {
    position: relative;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 50%; color: var(--text);
    cursor: pointer; margin-inline-start: auto;
    transition: border-color .15s;
    flex-shrink: 0;
}
.bell:hover { border-color: var(--primary2); }
.bell-badge {
    position: absolute; top: -5px; inset-inline-end: -5px;
    min-width: 19px; height: 19px; padding: 0 4px;
    background: var(--danger); color: #fff;
    border-radius: 999px; font-size: 11px; font-weight: 800;
    display: grid; place-items: center;
}

/* ---------- توست الإشعارات ---------- */
.toast-wrap {
    position: fixed;
    bottom: 18px; inset-inline-start: 18px;
    z-index: 9000;
    display: flex; flex-direction: column; gap: 10px;
    max-width: min(340px, 90vw);
}
.toast {
    background: linear-gradient(160deg, var(--panel), var(--bg2));
    border: 1px solid var(--primary2);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 12px 40px rgba(15,23,42,.16);
    animation: toastIn .3s ease;
}
.toast-head { font-size: 13px; color: var(--accent); }
.toast-head strong { color: var(--text); }
.toast-body { font-size: 13.5px; color: var(--text); margin-top: 4px; word-break: break-word; }
.toast-out { animation: fxOut .5s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- زر التليجرام العائم ---------- */
.tg-float {
    position: fixed;
    bottom: 92px; inset-inline-end: 18px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0088cc, #22a7e0);
    color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 8px 26px rgba(0,136,204,.5);
    z-index: 8000;
    transition: transform .15s;
}
.tg-float:hover { transform: scale(1.08); color: #fff; }

/* ---------- روابط الصفحات في الشريط الجانبي ---------- */
.side-links {
    display: flex; flex-wrap: wrap; gap: 4px 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}
.side-links a { color: var(--muted); }
.side-links a:hover { color: var(--accent); }

/* ---------- صفحات المحتوى والخطط ---------- */
.page-content {
    line-height: 2;
    color: var(--text);
    font-size: 14.5px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    min-height: 120px;
}
.page-links {
    display: flex; flex-wrap: wrap; gap: 8px 16px;
    justify-content: center;
    margin-top: 18px; padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}
.plan-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 16px;
    text-align: center;
    transition: transform .15s, border-color .15s;
}
.plan-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.plan-coins {
    font-size: 24px; font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--primary2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.plan-unit { color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.plan-price { color: var(--gold); font-weight: 800; font-size: 20px; margin-bottom: 14px; }

/* ---------- زر تحميل تطبيق الدردشة الملكة ---------- */
.install-btn {
    width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    margin-top: 16px;
    padding: 13px 18px;
    border-radius: 12px;
    border: 1px solid var(--gold);
    background: linear-gradient(135deg, rgba(251,191,36,.16), rgba(124,58,237,.18));
    color: var(--gold);
    font-family: inherit; font-size: 14.5px; font-weight: 800;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, background .15s;
}
.install-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(251,191,36,.28), rgba(124,58,237,.3));
    box-shadow: 0 8px 26px rgba(251,191,36,.25);
}
.install-hint {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--muted);
    text-align: center;
}
