/* ===== المتغيرات العامة ===== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ecc94b;
    --info: #4299e1;
    --light: #f7fafc;
    --dark: #2d3748;
    --gray: #a0aec0;
    --white: #ffffff;
    
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);
    --shadow-hover: 0 15px 40px rgba(102, 126, 234, 0.2);
    
    --border-radius-sm: 10px;
    --border-radius-md: 15px;
    --border-radius-lg: 25px;
    --border-radius-xl: 35px;
    --border-radius-full: 50px;
}

/* ===== الأساسيات ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Cairo', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf2 100%);
    min-height: 100vh;
    position: relative;
    direction: rtl;
}

/* تأثير الخلفية المتحركة */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ===== شريط التنقل ===== */
.navbar {
    background: var(--gradient-1);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    color: var(--white);
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-brand i {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2));
    animation: pulse 2s infinite;
}

.navbar-brand:hover {
    color: var(--white);
    transform: scale(1.02);
    transition: transform 0.3s;
}

/* ===== بطاقات الإحصائيات ===== */
.stat-card {
    background: var(--gradient-1);
    color: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-card small {
    opacity: 0.8;
    font-size: 0.9rem;
}

.stat-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 5rem;
    opacity: 0.2;
    transition: all 0.3s;
}

.stat-card:hover .stat-icon {
    transform: translateY(-50%) scale(1.1);
    opacity: 0.3;
}

/* تدرجات مختلفة للبطاقات */
.stat-card.gradient-1 { background: var(--gradient-1); }
.stat-card.gradient-2 { background: var(--gradient-2); }
.stat-card.gradient-3 { background: var(--gradient-3); }
.stat-card.gradient-4 { background: var(--gradient-4); }
.stat-card.gradient-5 { background: var(--gradient-5); }

/* شريط التقدم */
.progress {
    height: 8px;
    border-radius: var(--border-radius-full);
    background: rgba(255,255,255,0.2);
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar {
    background: var(--white);
    border-radius: var(--border-radius-full);
    position: relative;
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* ===== بطاقات القائمة ===== */
.menu-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.menu-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.menu-card:hover::before {
    transform: scaleX(1);
}

.menu-icon {
    font-size: 3rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.menu-card:hover .menu-icon {
    transform: scale(1.1) rotate(5deg);
}

.menu-card h5 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 10px;
}

.menu-card small {
    color: var(--gray);
    font-size: 0.9rem;
}

/* ===== حالة الاتصال ===== */
.connection-status {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    position: relative;
}

.status-connected {
    background-color: var(--success);
    animation: pulse-green 2s infinite;
}

.status-disconnected {
    background-color: var(--danger);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(72, 187, 120, 0); }
    100% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0); }
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(245, 101, 101, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 101, 101, 0); }
}

/* ===== صفحة ربط الواتساب ===== */
.qr-container {
    background: var(--white);
    border-radius: var(--border-radius-xl);
    padding: 50px;
    max-width: 600px;
    margin: 50px auto;
    box-shadow: var(--shadow-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(10px);
}

.qr-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(102, 126, 234, 0.1) 50%, 
        transparent 70%);
    animation: shimmer 3s infinite;
    transform: rotate(30deg);
}

@keyframes shimmer {
    0% { transform: rotate(30deg) translateX(-100%); }
    100% { transform: rotate(30deg) translateX(100%); }
}

.qr-code {
    width: 280px;
    height: 280px;
    margin: 30px auto;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf2 100%);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
}

.qr-code img {
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-sm);
}

.instance-id {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecf2 100%);
    padding: 15px;
    border-radius: var(--border-radius-full);
    font-family: monospace;
    font-size: 1.3rem;
    direction: ltr;
    margin: 20px 0;
    border: 2px dashed var(--primary);
    color: var(--primary);
}

/* ===== صفحة الإعدادات ===== */
.settings-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.settings-card h5 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.form-label {
    color: var(--dark);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-control {
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius-md);
    padding: 12px 15px;
    transition: all 0.3s;
    background: #f8fafc;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: var(--white);
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-left: 10px;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn {
    padding: 12px 30px;
    border-radius: var(--border-radius-full);
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-1);
    border: none;
}

.btn-primary:hover {
    background: var(--gradient-1);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* ===== الجداول والقوائم ===== */
.list-group-item {
    border: none;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: var(--border-radius-md) !important;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.list-group-item:hover {
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.badge {
    padding: 8px 15px;
    border-radius: var(--border-radius-full);
    font-weight: 500;
}

.badge.bg-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #ecc94b 0%, #d69e2e 100%) !important;
}

/* ===== الأزرار السريعة ===== */
.quick-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--gradient-1);
    border-color: transparent;
    color: var(--white);
}

/* ===== الأنيميشن ===== */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===== التجاوب مع الشاشات ===== */
@media (max-width: 768px) {
    .stat-card h2 {
        font-size: 2.2rem;
    }
    
    .stat-icon {
        font-size: 3.5rem;
    }
    
    .menu-card {
        padding: 20px;
    }
    
    .qr-container {
        margin: 20px;
        padding: 30px;
    }
    
    .qr-code {
        width: 220px;
        height: 220px;
    }
    
    .navbar-brand {
        font-size: 1.4rem;
    }
    
    .navbar-brand i {
        font-size: 1.8rem;
    }
}

/* ===== تأثيرات إضافية ===== */
.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.animated-gradient {
    background-size: 200% 200%;
    animation: gradient 5s ease infinite;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.rotate-hover:hover {
    animation: spin 1s linear infinite;
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* ===== التذييل ===== */
.footer {
    margin-top: 50px;
    padding: 20px;
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}