@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&family=JetBrains+Mono:wght@500&display=swap');
 
:root {
    --bg: #15130f;
    --bg-panel: #1e1a13;
    --bg-panel-2: #26201703;
    --line: #382f20;
    --gold: #e3a627;
    --gold-bright: #f6c452;
    --text: #f1ead9;
    --text-dim: #a89a7c;
    --danger: #d9634f;
    --ok: #7bb87f;
    --radius: 10px;
}
 
* { box-sizing: border-box; }
 /* --- 1. متصفحات كروم، إيدج، وسافاري (WebKit) --- */

/* تحديد عرض وارتفاع شريط التمرير الكلي */
::-webkit-scrollbar {
  width: 12px;               /* عرض الشريط العمودي */
  height: 12px;              /* ارتفاع الشريط الأفقي */
}

/* خلفية المجرى الذي يتحرك فيه الشريط */
::-webkit-scrollbar-track {
  background: #000000;       /* لون الخلفية */
  border-radius: 10px;       /* جعل الحواف دائرية */
}

/* الجزء المتحرك الذي يمسكه المستخدم (المقبض) */
::-webkit-scrollbar-thumb {
    background: #5caa059c;
    border-radius: 10px;
    border: 3px solid #000000;
}

/* تغيير لون الجزء المتحرك عند تمرير الماوس فوقه (Hover) */
::-webkit-scrollbar-thumb:hover {
  background: #555;          /* لون أغمق عند التقريب */
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    min-height: 100vh;
    position: relative;
}
 
/* شبكة خلايا سداسية خافتة في الخلفية - العنصر المميز للتصميم */
.rayf-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.35;
    background-image:
        radial-gradient(circle at 25% 15%, #5caa05f5 0, #00000000 40%), 
        repeating-linear-gradient(60deg, transparent 0 34px, #5caa0545 34px 36px), 
        repeating-linear-gradient(-60deg, transparent 0 34px, #5caa0545 34px 36px), 
        repeating-linear-gradient(0deg, transparent 0 34px, #5caa0545 34px 36px);
    pointer-events: none;
}
 
.topbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    /* border-bottom: 1px solid var(--line); */
}
 
.brand {
    display: flex;
    gap: 10px;
    font-weight: 900;
    font-size: 22px;
    color: #5caa05;
    text-decoration: none;
    flex-direction: row-reverse;
    align-items: center;
}
 
nav { display: flex; align-items: center; gap: 14px; }
 
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-dim);
}
.user-chip img {
    width: 26px; height: 26px; border-radius: 50%;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}
 
.container {
    position: relative;
    z-index: 1;
    max-width: 880px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}
 
/* -------- زرار -------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius);
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary {
    background: linear-gradient(149deg, #ffffff, #ffffff94);
    color: #1a1408;
    box-shadow: 0px 8px 18px -6px #ffffff66;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-dim);
}
.btn-ghost:hover { border-color: #a9ff65; color: #a9ff65; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
 
/* -------- الصفحة الرئيسية -------- */
.hero { padding: 60px 0; max-width: 640px; }
.eyebrow {
    color: #a9ff65;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
}
.hero h1 {
    font-size: 42px;
    font-weight: 900;
    line-height: 1.3;
    margin: 14px 0 18px;
}
.lede { color: var(--text-dim); font-size: 16px; line-height: 1.9; margin-bottom: 30px; }
 
/* -------- شبكة السيرفرات -------- */
.page-title { font-size: 26px; font-weight: 900; margin-bottom: 4px; }
.page-sub { color: var(--text-dim); margin-bottom: 30px; }
 
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
}
.cell {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 14px;
    text-align: center;
}
.cell-disabled { opacity: .55; }
.cell-icon {
    width: 56px; height: 56px; margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-panel);
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; color: #a9ff65; font-size: 20px;
    /* clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); */
}
.cell-icon img { width: 100%; height: 100%; object-fit: cover; }
.cell-name { font-weight: 700; margin-bottom: 14px; font-size: 14px; }
.empty { color: var(--text-dim); margin-top: 40px; }
 
/* -------- صفحة إعدادات السيرفر -------- */
.back-link { color: var(--text-dim); text-decoration: none; font-size: 14px; }
.back-link:hover { color: #a9ff65; }
 
.guild-head { display: flex; align-items: center; gap: 14px; margin: 18px 0 30px; }
.guild-icon { width: 48px; height: 48px; border-radius: 50%; }
 
.toast {
    background: #7bb87f22;
    border: 1px solid #7bb87f55;
    color: var(--ok);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-weight: 700;
    font-size: 14px;
}
 
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 18px;
}
.protection-warning {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: -7px 0 18px;
    padding: 8px 10px;
    border-right: 2px solid rgba(248, 70, 85, 0.75);
    color: #f46b74;
    font-size: 12px;
    line-height: 1.8;
    font-weight: 600;
}
.protection-warning strong {
    color: #ff525d;
    font-weight: 800;
}
.protection-warning-icon {
    flex: 0 0 auto;
    font-size: 12px;
    line-height: 1.8;
}

.panel-title {
    font-size: 25px;
    color: var(--gold-bright);
    margin: 0 0 16px;
    font-weight: 700;
}
.field-list { display: flex; flex-direction: column; gap: 14px; }
.field-row {
    display: contents;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.field-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-desc {
    font-size: 0.82rem;
    color: #888888; /* لون رمادي هادئ للوصف */
    font-weight: normal;
}
.field-row label { font-size: 14px; color: var(--text); }
.field-row select {
    background: #15130f;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    min-width: 220px;
}
.field-row select:focus { outline: 2px solid var(--gold); }
 
/* -------- سويتش تفعيل/تعطيل الحمايات -------- */
.toggle-switch {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.toggle-opt {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-dim);
    background: #15130f;
    transition: background .15s ease, color .15s ease;
    user-select: none;
}
.toggle-opt input[type="radio"] {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.toggle-opt.toggle-on:has(input:checked) {
    background: linear-gradient(270deg, #5caa05, #012d02);
    color: #1a1408;
}
.toggle-opt.toggle-off:has(input:checked) {
    background: #d9634f33;
    color: var(--danger);
}
.toggle-opt:has(input:focus-visible) {
    outline: 2px solid #a9ff65;
}
/* ==================== شبكة بطاقات قنوات اللوقات ==================== */
.log-channel-select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    transition: opacity .2s ease;
}
.log-channel-select:focus { outline: 2px solid var(--gold); }
 
.log-channel-card.card-disabled .log-channel-select {
    opacity: 0.55;
}
 
.log-channel-footer {
    display: block;
}
 
/* -------- سويتش بسيط (iOS style) لتفعيل/تعطيل قنوات اللوقات -------- */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background-color: #3a3a42;
    border-radius: 999px;
    transition: background-color .2s ease;
}
.switch-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.switch input:checked + .switch-slider {
    background-color: #4d9505;
}
.switch input:checked + .switch-slider::before {
    transform: translateX(18px);
}
.switch input:focus-visible + .switch-slider {
    outline: 2px solid #a9ff65;
    outline-offset: 2px;
}
/* ==================== أزرار مستويات العقوبة (Penalty Pills) ==================== */
.penalty-group {
    display: inline-flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.penalty-opt {
    position: relative;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e9297;
    background: transparent;
    border: 1px solid transparent;
}

.penalty-opt input[type="radio"] {
    display: none;
}

.penalty-opt:hover {
    color: #ffffff;
}
/* ==================== شبكة بطاقات الحماية ==================== */
.protection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 15px;
}

.protection-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
}

.protection-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.protection-card.card-disabled {
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.15);
}

.protection-card.card-disabled .card-footer {
    pointer-events: none;
    opacity: 0.4;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    margin-bottom: 10px;
}

.card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    flex: 1 1 220px;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.card-desc {
    font-size: 0.82rem;
    color: #8e9297;
    margin: 0 0 14px 0;
    line-height: 1.4;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    transition: opacity 0.2s ease;
    flex-wrap: balance;
}
.penalty-info {
 font-size: 0.78rem;
}
.penalty-label {
    font-size: 0.78rem;
    color: #b9bbbe;
}

/* ==================== أزرار مستويات العقوبة المصغرة ==================== */
.penalty-group {
    display: inline-flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 8px;
}

.penalty-opt {
    cursor: pointer;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    transition: all 0.2s ease;
    color: #72767d;
}

.penalty-opt input[type="radio"] { display: none; }

.penalty-opt.penalty-low:has(input:checked) {
    background: rgba(231, 76, 60, 0.25);
    color: #ff4757;
    border: 1px solid #ff4757;
}

.penalty-opt.penalty-medium:has(input:checked) {
    background: rgba(243, 156, 18, 0.25);
    color: #ffa502;
    border: 1px solid #ffa502;
}

.penalty-opt.penalty-high:has(input:checked) {
    background: rgba(46, 204, 113, 0.25);
    color: #2ed573;
    border: 1px solid #2ed573;
}

.role-multiselect { position: relative; min-width: 220px; }
.role-chip-field {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    min-height: 40px; padding: 6px 10px; border-radius: var(--radius);
    background: var(--bg); border: 1px solid var(--line); cursor: text;
}
.role-chip-field:focus-within { outline: 2px solid var(--gold); }
.role-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(227, 166, 39, 0.14); border: 1px solid rgba(227, 166, 39, 0.4);
    border-radius: 999px; padding: 3px 8px 3px 12px;
    font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--gold-bright); white-space: nowrap;
}
.role-chip .chip-remove {
    background: transparent; border: none; color: var(--text-dim); cursor: pointer;
    font-size: 15px; line-height: 1; padding: 2px; border-radius: 50%;
}
.role-chip .chip-remove:hover { color: var(--danger); }
.role-search-input {
    flex: 1 1 90px; min-width: 90px; background: transparent; border: none; outline: none;
    color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 13px; padding: 4px 2px;
}
.role-search-input::placeholder { color: var(--text-dim); }
.role-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
    background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius);
    max-height: 220px; overflow-y: auto; box-shadow: 0 10px 24px rgba(0,0,0,.45);
}
.role-option {
    padding: 9px 14px; cursor: pointer;
    font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text);
}
.role-option:hover { background: rgba(227, 166, 39, 0.08); color: var(--gold-bright); }
.role-option[hidden] { display: none; }
.role-empty-msg { padding: 9px 14px; font-size: 12px; color: var(--text-dim); }

/* ==================== بريميوم ==================== */
.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-inline-start: auto;
}
.plan-badge.plan-premium {
    background: rgba(227, 166, 39, 0.15);
    border: 1px solid rgba(227, 166, 39, 0.5);
    color: var(--gold-bright);
}
.plan-badge.plan-free {
    background: rgba(168, 154, 124, 0.12);
    border: 1px solid var(--line);
    color: var(--text-dim);
}

.premium-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-bright);
    background: rgba(227, 166, 39, 0.15);
    border: 1px solid rgba(227, 166, 39, 0.4);
    border-radius: 999px;
    padding: 2px 8px;
    margin-inline-start: 6px;
    vertical-align: middle;
}

.protection-card.card-locked {
    opacity: 0.55;
    background: rgba(227, 166, 39, 0.04);
    border-color: rgba(227, 166, 39, 0.25);
}
.protection-card.card-locked .toggle-opt {
    cursor: not-allowed;
}
.premium-lock-msg {
    color: var(--gold-bright) !important;
    font-weight: 600;
}
/* -------- الأشخاص الموثوقون (Trusted Users) -------- */
.trusted-add-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}
.btn-trusted-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    background: linear-gradient(149deg, #5caa05, #012d02);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 8px 18px -8px rgb(85 247 87 / 60%);
}
.btn-trusted-add:hover { transform: translateY(-1px); }
.btn-trusted-add:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-trusted-add .plus-icon { font-size: 16px; line-height: 1; }

.trusted-id-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}
.trusted-id-input:focus { outline: 2px solid var(--gold); }
.trusted-id-input::placeholder { color: var(--text-dim); }

.trusted-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin: 8px 2px 0;
}

.trusted-list {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.trusted-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 22px 10px;
    margin: 0;
}
.trusted-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 8px;
}
.trusted-row:hover { background: var(--bg-panel); }
.trusted-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text);
}
.trusted-remove-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--danger);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.trusted-remove-btn:hover { background: rgba(217, 99, 79, 0.15); border-color: var(--danger); }

@media (max-width: 640px) {
    .trusted-add-row { flex-direction: column; align-items: stretch; }
}
 
.config-form > .btn { margin-top: 6px; }
 
.error-box { text-align: center; padding: 80px 0; }
.error-box h1 { color: var(--danger); }
.error-box p { color: var(--text-dim); margin-bottom: 24px; }
 
@media (max-width: 560px) {
    .topbar { padding: 16px 20px; }
    .container { padding: 32px 16px 60px; }
    .hero h1 { font-size: 30px; }
    .field-row { flex-direction: column; align-items: flex-start; }
    .field-row select { width: 100%; }
    .role-multiselect { width: 100%; }
}

/* ==================== سجل تعديلات RAYF ==================== */
.audit-history-panel { overflow: hidden; }
.audit-history-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:16px; }
.audit-history-list { display:flex; flex-direction:column; gap:12px; }
.audit-entry { background:rgba(255,255,255,.025); border:1px solid var(--line); border-radius:12px; padding:14px; }
.audit-entry-head { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
.audit-entry-head > div { display:flex; align-items:center; gap:8px; min-width:0; }
.audit-entry-head time { color:var(--text-dim); font-size:12px; }
.audit-source { display:inline-flex; align-items:center; border:1px solid rgba(227,166,39,.35); color:var(--gold-bright); background:rgba(227,166,39,.08); border-radius:999px; padding:3px 8px; font-size:11px; font-weight:700; }
.audit-change-list { display:flex; flex-direction:column; gap:7px; }
.audit-change { display:grid; grid-template-columns:minmax(150px,1.2fr) minmax(100px,1fr) auto minmax(100px,1fr); gap:8px; align-items:center; padding:8px 10px; background:rgba(0,0,0,.12); border-radius:8px; }
.audit-change-label { color:var(--text); font-weight:600; min-width:0; overflow-wrap:anywhere; }
.audit-change-value { border-radius:7px; padding:5px 8px; font-size:12px; min-width:0; overflow-wrap:anywhere; }
.audit-change-value.old { color:#ff9b8d; background:rgba(217,99,79,.08); }
.audit-change-value.new { color:#9ee29f; background:rgba(123,184,127,.08); }
.audit-arrow { color:var(--text-dim); text-align:center; }
@media (max-width: 640px) {
  .audit-change { grid-template-columns:1fr; }
  .audit-arrow { transform:rotate(-90deg); justify-self:start; }
}


.audit-pagination { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:7px; margin-top:16px; }
.audit-page-btn { min-width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; padding:0 9px; border:1px solid var(--line); border-radius:9px; color:var(--text); text-decoration:none; background:rgba(255,255,255,.025); transition:all .15s ease; }
.audit-page-btn:hover { border-color:rgba(227,166,39,.45); background:rgba(227,166,39,.07); }
.audit-page-btn.active { color:#111; background:var(--gold-bright); border-color:var(--gold-bright); font-weight:800; }
.audit-page-ellipsis { color:var(--text-dim); padding:0 2px; }
.protection-credit-panel { border-color:rgba(227,166,39,.22); }
.protection-credit-head { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.credit-counter { min-width:72px; padding:9px 13px; text-align:center; border:1px solid rgba(227,166,39,.35); border-radius:12px; background:rgba(227,166,39,.08); color:var(--gold-bright); font-size:19px; font-weight:900; }
.credit-info-line, .credit-emergency-active, .credit-footnote { margin-top:12px; }
.credit-emergency-active { padding:10px 12px; border-radius:10px; background:rgba(227,166,39,.09); border:1px solid rgba(227,166,39,.25); }
.credit-exhausted { opacity:.72; }
.credit-footnote { color:var(--text-dim); font-size:12px; }
.premium-emergency-msg { color:#f0c35a; }
@media (max-width: 640px) {
  .protection-credit-head { align-items:flex-start; }
  .credit-counter { min-width:58px; font-size:17px; }
}
