/* ===== متغيرات الألوان والمتغيرات العامة ===== */
:root {
    --gold: #c9a84c;
    --gold-light: #e8c97a;
    --gold-dim: rgba(201, 168, 76, 0.15);
    --dark: #080b10;
    --dark-2: #0e1219;
    --dark-3: #141922;
    --dark-4: #1a2030;
    --card: #111520;
    --border: rgba(201, 168, 76, 0.18);
    --border-hover: rgba(201, 168, 76, 0.45);
    --text: #e8eaf0;
    --text-dim: #8a90a0;
    --text-muted: #555f75;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 40px rgba(0,0,0,0.6);
    --shadow-gold: 0 0 30px rgba(201, 168, 76, 0.12);
}

/* ===== إعادة الضبط ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Cairo', sans-serif;
    background: var(--dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ===== خلفية متحركة ===== */
.bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(201,168,76,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201,168,76,0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 0%, transparent 100%);
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: glowPulse 8s ease-in-out infinite alternate;
}

.glow-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(201,168,76,0.15) 0%, transparent 70%);
    top: -200px; left: -200px;
    animation-delay: 0s;
}

.glow-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(30,60,120,0.2) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    animation-delay: 4s;
}

@keyframes glowPulse {
    from { opacity: 0.3; transform: scale(0.95); }
    to { opacity: 0.5; transform: scale(1.05); }
}

/* ===== شريط التنبيه ===== */
.alert-bar {
    background: linear-gradient(90deg, #7a1e1e, #9c2626);
    color: #ffd0d0;
    text-align: center;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 10;
    border-bottom: 1px solid rgba(255,100,100,0.3);
}

.alert-icon {
    font-size: 15px;
    color: #ff9a9a;
}

/* ===== الهيدر ===== */
header {
    position: relative;
    z-index: 5;
    padding: 50px 20px 40px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(201,168,76,0.04) 0%, transparent 100%);
}

.header-inner {
    max-width: 900px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.logo-wrap {
    position: relative;
}

.logo-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(201,168,76,0.1) 0%, transparent 70%);
    box-shadow: 0 0 0 6px rgba(201,168,76,0.08), var(--shadow-gold);
    animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { box-shadow: 0 0 0 6px rgba(201,168,76,0.08), 0 0 30px rgba(201,168,76,0.1); }
    50% { box-shadow: 0 0 0 10px rgba(201,168,76,0.04), 0 0 50px rgba(201,168,76,0.2); }
}

.logo-ring img {
    width: 65px;
    filter: drop-shadow(0 0 12px rgba(201,168,76,0.5));
}

.header-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 2px;
    text-transform: uppercase;
    background: var(--gold-dim);
    border: 1px solid var(--border);
    padding: 5px 18px;
    border-radius: 50px;
}

.header-text h1 {
    font-size: clamp(20px, 4vw, 30px);
    font-weight: 900;
    color: var(--text);
    line-height: 1.4;
    margin: 8px 0;
}

.header-divider {
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 12px auto;
}

.header-sub {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 400;
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30,200,100,0.08);
    border: 1px solid rgba(30,200,100,0.2);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    color: #5de0a0;
}

.badge-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #3dcb88;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== الصفحات ===== */
.page {
    display: none;
    max-width: 980px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    position: relative;
    z-index: 5;
    animation: fadeIn 0.4s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== قسم العنوان ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 1px;
}

.section-title .line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border));
}

.section-title .line:first-child {
    background: linear-gradient(270deg, transparent, var(--border));
}

/* ===== شبكة الخدمات ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.service-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201,168,76,0.05) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.service-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold), var(--shadow);
}

.service-card:hover::before { opacity: 1; }

.service-icon {
    font-size: 28px;
    width: 54px; height: 54px;
    background: var(--gold-dim);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-info { flex: 1; }
.service-info h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.service-info p { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

.service-arrow {
    font-size: 20px;
    color: var(--gold);
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
}

.service-card:hover .service-arrow {
    opacity: 1;
    transform: translateX(-5px);
}

/* ===== بحث سريع ===== */
.search-section { margin-bottom: 30px; }

.search-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
}

.search-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.search-row {
    display: flex;
    gap: 12px;
}

.search-row input {
    flex: 1;
}

.search-btn {
    background: linear-gradient(135deg, var(--gold), #a07820);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #0a0a0a;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201,168,76,0.3);
}

/* ===== إحصائيات ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px 16px;
    text-align: center;
    transition: border-color 0.3s;
}

.stat-box:hover { border-color: var(--border-hover); }

.stat-num {
    font-size: 28px;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== عن الديوان ===== */
.about-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.about-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.about-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 10px;
}

.about-card p {
    font-size: 14px;
    line-height: 1.9;
    color: var(--text-dim);
}

/* ===== عناوين الصفحات ===== */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.page-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--text);
}

.back-btn {
    background: var(--dark-4);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.back-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

/* ===== نماذج الطلبات ===== */
.form-card, .login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.field-group {
    margin-bottom: 18px;
}

.field-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.required { color: #e06060; }

input, textarea, select {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    transition: border-color 0.25s, box-shadow 0.25s;
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
    background: rgba(201,168,76,0.03);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

textarea { resize: vertical; min-height: 120px; }

select { cursor: pointer; }
select option { background: var(--dark-3); }

.form-note {
    background: rgba(201,168,76,0.06);
    border: 1px solid rgba(201,168,76,0.15);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--gold-light);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), #a07820);
    border: none;
    padding: 13px 36px;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #050505;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201,168,76,0.35);
}

/* ===== صفحة اللوجين ===== */
.login-card {
    max-width: 480px;
    text-align: center;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-card .btn-primary {
    width: 100%;
}

/* ===== لوحة الإدارة ===== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-user-badge {
    font-size: 12px;
    color: var(--gold);
    font-weight: 600;
    margin-top: 4px;
}

.btn-logout {
    background: rgba(200, 50, 50, 0.15);
    border: 1px solid rgba(200,50,50,0.3);
    color: #e07070;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(200,50,50,0.25);
    border-color: rgba(200,50,50,0.5);
}

/* ===== تابات الإدارة ===== */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== بطاقات التذاكر ===== */
.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ticket {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    transition: border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.ticket::before {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: 2px;
}

.ticket.status-review::before { background: #e8a020; }
.ticket.status-accepted::before { background: #2ecc71; }
.ticket.status-rejected::before { background: #e74c3c; }
.ticket.status-closed::before { background: #555f75; }

.ticket:hover { border-color: var(--border-hover); }

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.ticket-id {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
}

.ticket-body {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-dim);
}

.ticket-body strong { color: var(--text); }

.ticket-text-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 8px 0;
    font-size: 13px;
    line-height: 1.7;
}

.ticket-footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== الحالات ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
}

.badge.review { background: rgba(232,160,32,0.15); color: #e8a020; border: 1px solid rgba(232,160,32,0.3); }
.badge.review::before { background: #e8a020; }

.badge.accepted { background: rgba(46,204,113,0.12); color: #2ecc71; border: 1px solid rgba(46,204,113,0.25); }
.badge.accepted::before { background: #2ecc71; }

.badge.rejected { background: rgba(231,76,60,0.12); color: #e74c3c; border: 1px solid rgba(231,76,60,0.25); }
.badge.rejected::before { background: #e74c3c; }

.badge.closed { background: rgba(100,110,130,0.15); color: #7a8290; border: 1px solid rgba(100,110,130,0.25); }
.badge.closed::before { background: #7a8290; }

/* ===== أزرار الإجراءات في التذاكر ===== */
.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 7px 16px;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-accept {
    background: rgba(46,204,113,0.12);
    border-color: rgba(46,204,113,0.3);
    color: #2ecc71;
}
.btn-accept:hover { background: rgba(46,204,113,0.2); }

.btn-reject {
    background: rgba(231,76,60,0.1);
    border-color: rgba(231,76,60,0.3);
    color: #e74c3c;
}
.btn-reject:hover { background: rgba(231,76,60,0.2); }

.btn-close {
    background: rgba(100,110,130,0.1);
    border-color: rgba(100,110,130,0.25);
    color: #7a8290;
}
.btn-close:hover { background: rgba(100,110,130,0.2); }

.btn-delete {
    background: rgba(180,30,30,0.1);
    border-color: rgba(180,30,30,0.25);
    color: #cc5555;
}
.btn-delete:hover { background: rgba(180,30,30,0.2); }

/* ===== فوتر ===== */
footer {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 50px 20px 40px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer-logo { font-size: 30px; margin-bottom: 10px; }
.footer-title { font-size: 15px; font-weight: 700; color: var(--text-dim); margin-bottom: 6px; }
.footer-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.footer-note { font-size: 11px; color: #3a4050; }

/* ===== تحميل وتوست ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,11,16,0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.loading-overlay.hidden { display: none; }

.loading-spinner {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { color: var(--text-dim); font-size: 14px; font-weight: 600; }

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--dark-3);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    transition: all 0.3s;
    opacity: 0;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: rgba(46,204,113,0.4); color: #2ecc71; }
.toast.error { border-color: rgba(231,76,60,0.4); color: #e74c3c; }
.toast.hidden { display: none; }

/* ======================================================
   قسم المتفاعلين (Activity List Table) - مضاف حديثاً
   ====================================================== */

#activityList table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 15px;
    background: var(--dark-3);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

#activityList th {
    background: var(--gold-dim);
    color: var(--gold);
    padding: 15px;
    font-weight: 700;
    font-size: 14px;
    text-align: right;
    border-bottom: 2px solid var(--border);
}

#activityList td {
    padding: 15px;
    color: var(--text);
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#activityList tr:last-child td {
    border-bottom: none;
}

#activityList tr:hover td {
    background: rgba(201,168,76,0.05);
}

/* التنسيق الخاص بعدد الطلبات */
#activityList .count-badge {
    background: var(--gold);
    color: #000;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 12px;
}

/* ===== الاستجابة ===== */
@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .search-row { flex-direction: column; }
    .form-card, .login-card { padding: 24px 18px; }
    .header-text h1 { font-size: 18px; }
    .services-grid { grid-template-columns: 1fr; }
    .admin-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 450px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .about-card { flex-direction: column; }
}

/* =========================================================
   نظام Live Chat — إضافات CSS
   ========================================================= */

/* مؤشر الأونلاين في بطاقة الخدمة */
.online-indicator {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
}

.online-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: blink 1.5s ease-in-out infinite;
}

.online-dot.green { background: #3dcb88; box-shadow: 0 0 6px rgba(61,203,136,0.6); }
.online-dot.red   { background: #e74c3c; box-shadow: 0 0 6px rgba(231,76,60,0.6); animation: none; }

/* بطاقة الشات */
.chat-card .service-info p { color: var(--text-dim); }
.chat-card .online-indicator { color: #3dcb88; }
.chat-card .online-indicator.offline { color: #e74c3c; }

/* حاوية الشات */
.chat-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 72vh;
    min-height: 480px;
}

/* هيدر الشات */
.chat-header-info {
    background: var(--dark-3);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    flex-shrink: 0;
}

.chat-hdr-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.chat-hdr-status {
    font-size: 12px;
    font-weight: 600;
}

/* منطقة الرسائل */
.chat-messages-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-messages-box::-webkit-scrollbar { width: 5px; }
.chat-messages-box::-webkit-scrollbar-track { background: transparent; }
.chat-messages-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* رسائل */
.chat-msg {
    display: flex;
    max-width: 75%;
}

.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.admin { align-self: flex-start; }

.chat-msg.system {
    align-self: center;
    max-width: 90%;
}

.chat-msg.system span {
    background: var(--dark-3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 16px;
    border-radius: 50px;
    text-align: center;
}

.chat-bubble {
    background: var(--dark-3);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 14px;
    max-width: 100%;
}

.chat-msg.user .chat-bubble {
    background: var(--gold-dim);
    border-color: rgba(201,168,76,0.3);
    border-bottom-right-radius: 4px;
}

.chat-msg.admin .chat-bubble {
    border-bottom-left-radius: 4px;
}

.chat-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 5px;
}

.chat-msg.user .chat-sender { text-align: right; }

.chat-bubble p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
    margin: 0;
}

.chat-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 5px;
    text-align: left;
}

.chat-msg.user .chat-time { text-align: right; }

/* وسائط */
.chat-media-img {
    max-width: 220px;
    max-height: 200px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s;
    display: block;
}
.chat-media-img:hover { opacity: 0.85; }

.chat-media-video {
    max-width: 240px;
    border-radius: 10px;
    display: block;
}

.chat-media-text {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 5px;
}

/* منطقة الإدخال */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--dark-3);
    flex-shrink: 0;
}

.chat-text-input {
    flex: 1;
    background: var(--dark-4);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 10px 18px;
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    direction: rtl;
}
.chat-text-input:focus { border-color: var(--gold); }

.chat-send-btn {
    background: var(--gold);
    border: none;
    color: #000;
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.chat-send-btn:hover { opacity: 0.85; }

.chat-media-btn {
    background: var(--dark-4);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-media-btn:hover { border-color: var(--gold); color: var(--gold); }

.chat-closed-notice {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    width: 100%;
}

.chat-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 40px;
}

/* نافذة المسؤول */
.admin-chat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,11,16,0.7);
    backdrop-filter: blur(6px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-chat-overlay.hidden { display: none; }

.admin-chat-box {
    background: var(--dark-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 680px;
    height: 80vh;
    max-height: 680px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.admin-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--dark-3);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    color: var(--gold);
    flex-shrink: 0;
}

.admin-chat-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.admin-chat-close:hover { color: #e74c3c; }

/* مودال لا يوجد مسؤولين */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,11,16,0.85);
    backdrop-filter: blur(10px);
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--dark-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease;
}

/* فاصل قسم المحادثات في "متابعة طلباتي" */
.chat-section-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 0 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
}
.chat-section-divider .line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border));
}
.chat-section-divider .line:first-child {
    background: linear-gradient(270deg, transparent, var(--border));
}

/* موبايل */
@media (max-width: 700px) {
    .chat-container { height: 78vh; }
    .chat-msg { max-width: 88%; }
    .admin-chat-box { height: 90vh; max-height: 100%; }
    .chat-input-area { padding: 10px 12px; gap: 8px; }
    .chat-text-input { font-size: 12px; }
}

/* ===== Presence Bar للمسؤول ===== */
.presence-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.presence-bar.online {
    background: rgba(46,204,113,0.07);
    border-color: rgba(46,204,113,0.25);
}

.presence-bar.offline {
    background: rgba(100,110,130,0.07);
    border-color: rgba(100,110,130,0.2);
}

.presence-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.presence-admin {
    color: var(--gold);
    font-size: 12px;
    background: var(--gold-dim);
    padding: 2px 10px;
    border-radius: 50px;
    border: 1px solid var(--border);
}

.presence-btn {
    padding: 9px 22px;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.2s;
    white-space: nowrap;
}

.presence-btn.online-btn {
    background: rgba(46,204,113,0.12);
    border-color: rgba(46,204,113,0.35);
    color: #2ecc71;
}
.presence-btn.online-btn:hover {
    background: rgba(46,204,113,0.22);
}

.presence-btn.offline-btn {
    background: rgba(231,76,60,0.1);
    border-color: rgba(231,76,60,0.3);
    color: #e74c3c;
}
.presence-btn.offline-btn:hover {
    background: rgba(231,76,60,0.2);
}

/* ===== بطاقة حالة السيرفر ===== */
.server-status-card {
    display: flex;
    align-items: stretch;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0 auto 32px;
    max-width: 860px;
    box-shadow: var(--shadow);
    position: relative;
}

.server-status-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(244,5,82,0.04) 0%, transparent 50%, rgba(88,101,242,0.04) 100%);
    pointer-events: none;
}

.server-status-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 24px;
    text-align: center;
}

.server-divider {
    width: 1px;
    background: var(--border);
    margin: 20px 0;
    flex-shrink: 0;
}

.server-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-brand-name {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: 0.5px;
}

.server-players-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.server-players-num {
    font-size: 42px;
    font-weight: 900;
    color: #f40552;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.server-players-num.discord-color {
    font-size: 28px;
    color: #5865F2;
}

.server-players-max {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}

.server-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--dark-3);
    padding: 5px 14px;
    border-radius: 50px;
    border: 1px solid var(--border);
}

.server-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s;
    border: 1px solid transparent;
    white-space: nowrap;
    margin-top: 4px;
}

.fivem-btn {
    background: rgba(244,5,82,0.12);
    border-color: rgba(244,5,82,0.35);
    color: #f40552;
}
.fivem-btn:hover {
    background: rgba(244,5,82,0.22);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(244,5,82,0.2);
}

.discord-btn {
    background: rgba(88,101,242,0.12);
    border-color: rgba(88,101,242,0.35);
    color: #5865F2;
}
.discord-btn:hover {
    background: rgba(88,101,242,0.22);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(88,101,242,0.2);
}

@media (max-width: 600px) {
    .server-status-card { flex-direction: column; }
    .server-divider { width: 100%; height: 1px; margin: 0; }
    .server-players-num { font-size: 36px; }
}
