/* style.css */
@import url('[https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap](https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap)');

:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --color-green: #10b981;
    --color-green-glow: rgba(16, 185, 129, 0.5);
    
    --color-red: #ef4444;
    --color-red-glow: rgba(239, 68, 68, 0.5);
    
    --color-yellow: #f59e0b;
    --color-yellow-glow: rgba(245, 158, 11, 0.6);
    
    --color-empty: #334155;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    
    --color-category: #8b5cf6;
}

/* إخفاء أشرطة التمرير نهائياً للصفحات العامة فقط */
body::-webkit-scrollbar { display: none; }
body {
    -ms-overflow-style: none; scrollbar-width: none;
    font-family: 'Tajawal', sans-serif;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    color: var(--text-main);
    direction: rtl;
    margin: 0; padding: 0;
    min-height: 100vh; max-width: 100vw;
    overflow-x: hidden;
}

/* تمرير مخصص للعناصر الداخلية (الجداول، الكانبان) */
.custom-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 10px; }
.custom-scroll::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 10px; }

/* =========================================
   تنسيقات لوحة المشرف (Admin Dashboard)
========================================= */
.admin-header {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glass);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: sticky; top: 0; z-index: 100;
}

.admin-header h1 {
    margin: 0; font-size: 24px; font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* التبويبات (Tabs) */
.tabs { display: flex; gap: 10px; margin-right: 30px; }
.tab-btn {
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border-glass); border-radius: 8px;
    padding: 8px 20px; font-family: 'Tajawal', sans-serif; font-weight: 700; font-size: 16px;
    cursor: pointer; transition: 0.3s ease;
}
.tab-btn:hover { background: rgba(255,255,255,0.05); color: white; }
.tab-btn.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

.admin-layout {
    display: grid; grid-template-columns: 1fr 450px; gap: 30px;
    padding: 30px; max-width: 1600px; margin: 0 auto;
    align-items: start; /* يمنع تمدد الجهة اليمنى مع زيادة الأسئلة في الجهة اليسرى */
}

/* البطاقات */
.card {
    background: var(--bg-card); backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass); border-radius: 16px;
    padding: 25px; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.card h2, .card h3 { margin-top: 0; margin-bottom: 20px; font-size: 20px; border-bottom: 1px solid var(--border-glass); padding-bottom: 10px; color: #e2e8f0; }

/* =========================================
   تنسيقات بنك الأسئلة (Question Bank)
========================================= */
.bank-layout { padding: 30px; max-width: 1600px; margin: 0 auto; display: none; }
.filters-bar { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.form-control {
    background: rgba(15, 23, 42, 0.6); color: white;
    border: 1px solid var(--border-glass); border-radius: 8px;
    padding: 10px 15px; font-family: inherit; outline: none; transition: 0.3s;
}
.form-control:focus { border-color: var(--color-primary); }

/* Table View */
.table-wrapper { overflow-x: auto; background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border-glass); }
.q-table { width: 100%; border-collapse: collapse; text-align: right; }
.q-table th, .q-table td { padding: 15px; border-bottom: 1px solid var(--border-glass); }
.q-table th { background: rgba(0,0,0,0.2); color: var(--color-yellow); font-weight: 700; }
.q-table tr:hover { background: rgba(255,255,255,0.03); }
.badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: bold; }
.badge.easy { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge.medium { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge.hard { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge.used { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.badge.new { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge.category { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }

/* Kanban View */
.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.kanban-col { background: rgba(15, 23, 42, 0.4); border-radius: 12px; padding: 15px; border: 1px solid var(--border-glass); min-height: 400px; }
.kanban-header { font-size: 18px; font-weight: bold; text-align: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid; }
.kanban-header.easy { border-color: var(--color-green); color: var(--color-green); }
.kanban-header.medium { border-color: var(--color-yellow); color: var(--color-yellow); }
.kanban-header.hard { border-color: var(--color-red); color: var(--color-red); }
.kanban-card { background: var(--bg-card); border: 1px solid var(--border-glass); border-radius: 10px; padding: 15px; margin-bottom: 15px; position: relative; }
.kanban-card .k-letter { position: absolute; top: -10px; left: -10px; background: var(--color-primary); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

/* نافذة التعديل (Modal) */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(5px);
    display: none; justify-content: center; align-items: center; z-index: 2000;
}
.modal-content {
    background: var(--bg-main); border: 1px solid var(--border-glass);
    padding: 30px; border-radius: 16px; width: 600px; max-width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: scaleIn 0.3s ease;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-glass); padding-bottom: 15px; margin-bottom: 20px; }
.modal-header h2 { margin: 0; color: var(--color-primary); }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; }
.close-btn:hover { color: var(--color-red); }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 14px; }

@keyframes scaleIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* =========================================
   تنسيقات الشبكة السداسية والإطار
========================================= */
.hex-board-container { display: flex; justify-content: center; align-items: center; padding: 20px; }

/* الإطار المحيط بالشبكة */
.board-frame {
    padding: 40px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.4);
    border-top: 8px solid var(--color-green);
    border-bottom: 8px solid var(--color-green);
    border-right: 8px solid var(--color-red);
    border-left: 8px solid var(--color-red);
    box-shadow: 
        inset 0 0 20px rgba(0,0,0,0.5),
        0 -15px 30px -10px var(--color-green-glow),
        0 15px 30px -10px var(--color-green-glow),
        15px 0 30px -10px var(--color-red-glow),
        -15px 0 30px -10px var(--color-red-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 600px; 
    min-height: 500px;
    overflow: hidden;
}

.hex-board { display: flex; flex-direction: column; align-items: flex-start; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3)); }
.hex-row { display: flex; margin-bottom: -31px; }
.hex-row:nth-child(even) { margin-right: 60px; }
.hex-row:nth-child(odd) { margin-right: 0px; }
.hex {
    width: 110px; height: 125px; margin-left: 10px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex; justify-content: center; align-items: center;
    font-size: 42px; font-weight: 800; cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s;
    user-select: none; position: relative; color: white;
}
.hex:hover { transform: scale(1.08); z-index: 5; }
.hex.empty { background: linear-gradient(135deg, #475569, #334155); color: #cbd5e1; }
.hex.active { background: linear-gradient(135deg, #fbbf24, #d97706); color: #111; transform: scale(1.15); z-index: 10; filter: drop-shadow(0 0 15px var(--color-yellow-glow)); }
.hex.green { background: linear-gradient(135deg, #34d399, #059669); filter: drop-shadow(0 0 15px var(--color-green-glow)); }
.hex.red { background: linear-gradient(135deg, #f87171, #dc2626); filter: drop-shadow(0 0 15px var(--color-red-glow)); }

/* =========================================
   الأزرار والبطاقات
========================================= */
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.btn {
    font-family: 'Tajawal', sans-serif; font-weight: 700; font-size: 15px;
    padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
    transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; color: white;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:active { transform: translateY(2px); }
.btn:hover { filter: brightness(1.1); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.btn-primary { background: var(--color-primary); }
.btn-success { background: var(--color-green); }
.btn-danger { background: var(--color-red); }
.btn-warning { background: var(--color-yellow); color: #111; }
.btn-dark { background: #334155; border: 1px solid var(--border-glass); }

.question-card {
    background: rgba(15, 23, 42, 0.6); padding: 15px; margin-bottom: 15px;
    border-radius: 10px; border-right: 4px solid var(--color-primary); transition: transform 0.2s ease;
}
.question-card:hover { transform: translateX(-5px); }
.question-card p { margin: 8px 0; font-size: 16px; line-height: 1.5; }
.question-card .q-tags { margin-bottom: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.question-card .q-diff { font-size: 12px; padding: 3px 8px; border-radius: 4px; background: #334155; }
.question-card .q-ans { color: var(--color-green); font-weight: 700; font-size: 18px;}

/* =========================================
   شاشة الجمهور
========================================= */
.public-display { display: flex; justify-content: center; align-items: center; height: 100vh; overflow: hidden; }
#question-overlay {
    position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(15px);
    padding: 40px; border-radius: 20px; border: 2px solid var(--color-yellow);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px var(--color-yellow-glow);
    text-align: center; display: none; z-index: 1000; width: 85%; max-width: 1200px;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#public-question-text { font-size: 46px; font-weight: 800; line-height: 1.4; margin: 0; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 50px); } to { opacity: 1; transform: translate(-50%, 0); } }
.alert-box { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--color-red); color: #fca5a5; padding: 15px; border-radius: 8px; margin-bottom: 20px; line-height: 1.6; }
