/* style.css - التحديث لإظهار عدد المتصلين */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #21c68b;
    --primary-dark: #15b8a4;
    --bg-primary: #0f172a;
    --bg-secondary: #1a1f3a;
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: rgba(33, 198, 139, 0.2);
    --border-hover: rgba(33, 198, 139, 0.5);
}

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* الخلفية المتحركة */
.bg-animation { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.circle { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(33, 198, 139, 0.15) 0%, rgba(33, 198, 139, 0) 70%); opacity: 0.3; }
.circle:nth-child(1) { width: 400px; height: 400px; top: -100px; right: -100px; animation: float 8s ease-in-out infinite; }
.circle:nth-child(2) { width: 300px; height: 300px; bottom: -50px; left: -50px; animation: float 10s ease-in-out infinite reverse; }
@keyframes float { 0%, 100% { transform: translateY(0px) translateX(0px); } 50% { transform: translateY(30px) translateX(20px); } }

.container { max-width: 1400px; margin: 0 auto; }

/* === الهيدر واللوجو === */
.header { text-align: center; margin-bottom: 3rem; position: relative; animation: slideDown 0.8s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }

.logo-container {
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    perspective: 1000px;
}

.logo-img {
    max-width: 150px;
    height: auto;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 15px rgba(33, 198, 139, 0.5));
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-img:hover {
    transform: scale(1.08) translateY(-10px) rotateX(5deg);
    filter: drop-shadow(0 20px 25px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(33, 198, 139, 0.9));
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    letter-spacing: 2px;
    font-weight: 700;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* === البطاقات الرئيسية === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: cardSlide 0.6s ease-out forwards;
    opacity: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: auto;
    min-height: 180px; 
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }

@keyframes cardSlide { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(33, 198, 139, 0.15);
    background: linear-gradient(135deg, rgba(33, 198, 139, 0.1) 0%, rgba(21, 184, 164, 0.05) 100%);
}

.card-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.5rem; }
.card-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, rgba(33, 198, 139, 0.2), rgba(21, 184, 164, 0.1));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary-color); font-size: 1.2rem;
}
.card-title { color: var(--text-secondary); font-size: 1rem; font-weight: 600; }
.card-value {
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: 900;
    margin-top: 0.5rem;
    text-align: center;
    font-family: 'Courier New', monospace;
}

/* === قسم السيرفرات === */
.nodes-section-title {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    text-align: right;
    border-right: 4px solid var(--primary-color);
    padding-right: 10px;
}

.nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.node-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.6) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column; /* تغيير للعرض العمودي لإضافة سطر المستخدمين */
    gap: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
}

.node-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    background: rgba(33, 198, 139, 0.05);
}

/* السطر العلوي للبطاقة */
.node-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.node-info { display: flex; align-items: center; gap: 0.8rem; }
.node-icon { color: var(--text-muted); font-size: 1.2rem; }
.node-name { color: var(--text-primary); font-weight: 600; font-size: 0.95rem; }

/* السطر السفلي (المستخدمين) */
.node-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.users-count {
    color: var(--primary-color);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
}

.users-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.node-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.node-status.status-online { 
    color: var(--primary-color); 
    background: rgba(33, 198, 139, 0.15); 
    border: none;
}

.node-status.status-offline { 
    color: #f59e0b; 
    background: rgba(245, 158, 11, 0.15); 
    border: none; 
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.node-link-icon {
    color: var(--primary-color);
    font-size: 0.9rem;
    opacity: 0.7;
    transition: 0.3s;
    margin-right: auto; /* دفع الأيقونة لليسار */
}
.node-card:hover .node-link-icon { opacity: 1; }

/* === معلومات النظام السفلية === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 0; border: none; margin: 0;
}
.stats-grid > div { text-align: center; }
.stat-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-top: 5px;
}
.stat-label { color: var(--text-muted); font-size: 0.8rem; }

.last-update {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0.7;
}

/* تجاوب الشاشات */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    .nodes-grid { grid-template-columns: 1fr; }
}
