:root {
    --bg: #000000;
    --card-bg: #0f0f0f;
    --neon-green: #ff9900; /* تم التغيير لبرتقالي */
    --neon-red: #ff0000;   /* أحمر نيون ساطع */
    --neon-blue: #ff4500;  /* برتقالي محمر بدلاً من الأزرق */
    --text: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Cairo', sans-serif; }

body {
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* هيدر احترافي */
.main-header {
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #222;
}

.logo { font-family: 'Orbitron', sans-serif; font-size: 24px; font-weight: 900; }
.neon-text { color: var(--neon-red); text-shadow: 0 0 10px var(--neon-red); }

/* عداد المتصلين */
.online-badge {
    background: rgba(0, 255, 0, 0.1); border: 1px solid var(--neon-green);
    color: var(--neon-green); padding: 5px 15px; border-radius: 20px;
    font-size: 14px; display: flex; align-items: center; gap: 8px;
    margin-right: auto; margin-left: 20px;
}

/* زر القائمة الكريتف */
.menu-wrapper {
    cursor: pointer; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.hamburger {
    width: 30px; height: 3px; background: var(--neon-blue);
    position: relative; transition: 0.4s;
}
.hamburger::before, .hamburger::after {
    content: ''; position: absolute; width: 100%; height: 3px; background: var(--neon-blue); transition: 0.4s;
}
.hamburger::before { top: -10px; } .hamburger::after { top: 10px; }

/* القائمة الجانبية */
.side-nav {
    position: fixed; top: 0; right: -300px; width: 300px; height: 100vh;
    background: rgba(10, 10, 10, 0.95); backdrop-filter: blur(10px);
    z-index: 1000; transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding-top: 100px;
}
.side-nav.open { right: 0; }
.side-nav ul { list-style: none; }
.side-nav li a {
    display: block; padding: 20px 40px; color: white; text-decoration: none;
    font-size: 18px; border-bottom: 1px solid #222; transition: 0.3s;
}
.side-nav li a:hover { color: var(--neon-green); background: rgba(57, 255, 20, 0.1); }

/* الكروت الرئيسية */
.studio-hub {
    height: 80vh; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
}
.welcome-text { text-align: center; margin-bottom: 50px; }
.welcome-text h1 { font-size: 45px; font-family: 'Orbitron'; }
.cyan-text { color: var(--neon-blue); text-shadow: 0 0 15px var(--neon-blue); }

.main-options { display: flex; gap: 30px; }
.opt-card {
    background: var(--card-bg); width: 250px; padding: 40px 20px;
    border-radius: 20px; text-align: center; cursor: pointer;
    transition: 0.4s; border: 1px solid #222;
}
.opt-card:hover { transform: translateY(-15px); }
.green-glow:hover { border-color: var(--neon-green); box-shadow: 0 0 30px rgba(57, 255, 20, 0.2); }
.red-glow:hover { border-color: var(--neon-red); box-shadow: 0 0 30px rgba(255, 0, 60, 0.2); }
.blue-glow:hover { border-color: var(--neon-blue); box-shadow: 0 0 30px rgba(0, 243, 255, 0.2); }

.icon-box { font-size: 50px; margin-bottom: 20px; color: #555; transition: 0.3s; }
.opt-card:hover .icon-box { color: inherit; }

/* الشات */
.chat-widget { position: fixed; bottom: 30px; left: 30px; z-index: 999; }
.chat-btn {
    width: 65px; height: 65px; background: var(--neon-blue);
    border-radius: 50%; display: flex; justify-content: center;
    align-items: center; font-size: 28px; cursor: pointer; color: black;
    box-shadow: 0 0 20px var(--neon-blue);
}
.unread-dot {
    position: absolute; top: 0; right: 5px; width: 18px; height: 18px;
    background: #007bff; border-radius: 50%; border: 3px solid var(--bg);
    display: none; animation: pulse 1.5s infinite;
}
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

.chat-container {
    position: absolute; bottom: 80px; left: 0; width: 350px; height: 500px;
    background: #111; border: 1px solid #333; border-radius: 15px;
    display: none; flex-direction: column; overflow: hidden;
}
.chat-header { background: #222; padding: 15px; display: flex; justify-content: space-between; }
.chat-messages { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.message { background: #222; padding: 10px; border-radius: 10px; max-width: 80%; }
.chat-footer { padding: 15px; display: flex; gap: 10px; background: #0a0a0a; }
.chat-footer input { flex: 1; background: #111; border: 1px solid #333; color: white; padding: 10px; border-radius: 5px; }

/* السبورة والعمل */
.workspace {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg); z-index: 100; display: none; padding: 20px;
    overflow: hidden; /* منع التمرير أثناء الرسم */
}
.back-btn { background: var(--neon-red); color: white; border: none; padding: 10px 20px; cursor: pointer; border-radius: 5px; margin-bottom: 10px; }
.sys-content { height: calc(100% - 40px); width: 100%; position: relative; }

/* حاوية السبورة وأدوات التحكم */
#board-system { display: none; height: 100%; }
.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

canvas { 
    display: block; 
    width: 100%; 
    height: 100%; 
    cursor: crosshair; 
    touch-action: none; /* مهم جداً للموبايل لمنع السكرول أثناء الرسم */
}

/* شريط التنقل العلوي للسبورة */
.board-top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 20;
}

.nav-controls { display: flex; align-items: center; gap: 15px; }

/* نافذة الإعدادات الجديدة (Modal) */
.settings-modal {
    position: absolute;
    top: 45px; /* أسفل الهيدر مباشرة */
    right: 10px; /* محاذاة لليمين */
    left: auto;
    transform: translateY(-10px);
    width: 300px;
    background: #151515;
    border: 1px solid var(--neon-blue);
    border-radius: 15px;
    padding: 20px;
    z-index: 2000;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    display: none;
    opacity: 0;
    transition: 0.3s ease;
}

.settings-modal.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* زر الخروج الدائري */
.exit-circle-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--neon-red);
    color: white; border: none;
    font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 10px var(--neon-red);
    transition: 0.3s;
}
.exit-circle-btn:hover { transform: scale(1.1); }

.settings-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; border-bottom: 1px solid #333; padding-bottom: 10px;
}
.settings-header h3 { color: var(--neon-blue); margin: 0; }
.close-settings { display: none; } /* إخفاء زر الإغلاق الداخلي */

.settings-body { display: flex; flex-direction: column; gap: 15px; max-height: 60vh; overflow-y: auto; }

.tool-section { background: #222; padding: 10px; border-radius: 8px; }
.tool-section h4 { font-size: 12px; color: #aaa; margin-bottom: 8px; }
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.tool-btn { width: 100%; padding: 10px; cursor: pointer; background: #333; color: white; border: 1px solid #444; border-radius: 8px; transition: 0.3s; font-size: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.tool-btn:hover { background: var(--neon-blue); color: black; }
.tool-btn.active { background: var(--neon-green); color: black; font-weight: bold; box-shadow: 0 0 10px var(--neon-green); }

/* أزرار الألوان */
.color-palette { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.color-swatch { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2px solid #555; transition: 0.2s; }
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.active { border-color: white; box-shadow: 0 0 5px white; }

input[type="range"] { width: 100%; accent-color: var(--neon-blue); }
input[type="color"] { width: 100%; height: 30px; border: none; padding: 0; background: none; cursor: pointer; }

/* أنيميشن التنبيهات */
@keyframes bounceIn {
    0% { transform: translateX(-50%) scale(0.3); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.05); opacity: 1; }
    70% { transform: translateX(-50%) scale(0.9); }
    100% { transform: translateX(-50%) scale(1); }
}

/* تحسين التجاوب للموبايل */
@media (max-width: 768px) {
    .main-header { padding: 15px 20px; }
    .logo { font-size: 18px; }
    
    .studio-hub { height: auto; padding: 50px 0; }
    .welcome-text h1 { font-size: 30px; }
    
    .main-options { flex-direction: column; }
    .opt-card { width: 100%; max-width: 300px; }
    
    .side-nav { width: 250px; right: -250px; }
    
    .chat-widget { bottom: 20px; left: 20px; }
    .chat-btn { width: 50px; height: 50px; font-size: 20px; }
    .chat-container { width: 90%; left: 5%; bottom: 80px; height: 60vh; }
    
    /* تعديل الشريط للموبايل ليكون في الأسفل بدلاً من الجانب لتوفير المساحة */
    .settings-modal { width: 95%; }
    .tools-grid { grid-template-columns: repeat(3, 1fr); }
    
    .pdf-wrapper { flex-direction: column; }
    .pdf-sidebar { width: 100%; height: 120px; flex-direction: row; border-left: none; border-top: 1px solid #333; order: 2; }
    .pdf-thumb { width: 100px; height: 100%; flex-shrink: 0; }
}

/* تنسيقات واجهة PDF */
.pdf-wrapper { display: flex; height: 100%; width: 100%; overflow: hidden; }
.pdf-main-area { flex: 1; position: relative; height: 100%; }
.pdf-sidebar {
    width: 220px; background: #151515; border-left: 1px solid #333;
    overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 15px;
    z-index: 50;
}
.pdf-thumb {
    width: 100%; height: 140px; background: #222; border: 2px solid #333;
    cursor: pointer; border-radius: 8px; overflow: hidden; position: relative;
    transition: 0.3s;
}
.pdf-thumb:hover { border-color: var(--neon-blue); transform: translateY(-2px); }
.pdf-thumb.active { border-color: var(--neon-green); box-shadow: 0 0 10px rgba(57, 255, 20, 0.2); }
.pdf-thumb img { width: 100%; height: 100%; object-fit: contain; background: white; }
.pdf-thumb-num {
    position: absolute; bottom: 5px; right: 5px; background: rgba(0,0,0,0.8);
    color: white; padding: 2px 8px; font-size: 12px; border-radius: 4px; font-weight: bold;
}

/* شاشة تسجيل الدخول */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 9999; display: flex;
    flex-direction: column; justify-content: center; align-items: center;
}
.login-card {
    background: #111; padding: 40px; border-radius: 20px;
    border: 1px solid var(--neon-blue); text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8); width: 90%; max-width: 400px;
}
.role-btn {
    padding: 15px 30px; margin: 10px; font-size: 18px; width: 100%;
    background: #222; color: white; border: 1px solid #444;
    border-radius: 10px; cursor: pointer; transition: 0.3s;
}
.role-btn:hover { background: var(--neon-blue); color: black; border-color: var(--neon-blue); }
.pass-input {
    padding: 15px; margin-top: 20px; width: 100%;
    background: #222; border: 1px solid #444; color: white;
    border-radius: 10px; display: none; font-size: 18px; text-align: center;
}
.pass-input:focus { outline: none; border-color: var(--neon-green); }

/* زر تسجيل الشاشة (للمستر فقط) */
.record-widget {
    position: fixed; bottom: 30px; right: 30px; z-index: 1000;
    display: none; /* مخفي افتراضياً */
}
.record-btn {
    width: 60px; height: 60px; border-radius: 50%;
    background: #222; border: 2px solid var(--neon-red);
    color: var(--neon-red); font-size: 24px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 15px var(--neon-red); transition: 0.3s;
}
.record-btn:hover { transform: scale(1.1); }
.record-btn.recording {
    background: var(--neon-red); color: white;
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }