/* تصميم صفحة ماسح البلوتوث */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: 300;
}

.content {
    padding: 30px;
}

.stats {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
}

.stats strong {
    color: #495057;
    font-size: 1.1em;
}

.stats span {
    display: block;
    margin: 8px 0;
    color: #6c757d;
    font-size: 0.95em;
}

.controls {
    margin: 30px 0;
    text-align: center;
}

#scanButton {
    padding: 15px 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#scanButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

#addDeviceButton {
    padding: 15px 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #fd7e14 0%, #e55a00 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(253, 126, 20, 0.3);
}

#addDeviceButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 126, 20, 0.4);
}

#stopButton {
    padding: 15px 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

#stopButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.clear-button {
    padding: 12px 24px;
    font-size: 14px;
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
}

.clear-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

#devicesList {
    margin-top: 30px;
}

.device {
    background: white;
    padding: 20px;
    margin: 15px 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #007bff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.device::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.device:hover::before {
    opacity: 1;
}

.device:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.device-strong {
    border-left-color: #28a745;
}

.device-strong::before {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.device-weak {
    border-left-color: #ffc107;
}

.device-weak::before {
    background: linear-gradient(90deg, #ffc107, #ffca2c);
}

.device-very-weak {
    border-left-color: #dc3545;
}

.device-very-weak::before {
    background: linear-gradient(90deg, #dc3545, #c82333);
}

.device-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.device-details {
    flex: 1;
}

.device-details strong {
    color: #495057;
    font-weight: 600;
}

.device-details br {
    margin-bottom: 5px;
}

.signal-strength {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-align: center;
    min-width: 80px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.signal-strong {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.signal-weak {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%);
    color: #333;
}

.signal-very-weak {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.last-update {
    font-size: 12px;
    color: #6c757d;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.error {
    color: #dc3545;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #ffe6e6 0%, #ffcccc 100%);
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

.status {
    color: #007bff;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #e6f3ff 0%, #cce7ff 100%);
    border-radius: 8px;
    border: 1px solid #b3d9ff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.empty-state {
    text-align: center;
    color: #6c757d;
    padding: 40px 20px;
    font-size: 1.1em;
}

.empty-state::before {
    content: '📱';
    font-size: 3em;
    display: block;
    margin-bottom: 20px;
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .content {
        padding: 20px;
    }
    
    .device-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .signal-strength {
        align-self: flex-start;
    }
    
    .controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    #scanButton, #addDeviceButton, #stopButton, .clear-button {
        margin: 0;
        width: 100%;
    }
}

/* تأثيرات إضافية */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.scanning .device {
    animation: pulse 2s infinite;
}

/* تحسين أداء الرسوم المتحركة */
.device, #scanButton, #addDeviceButton, #stopButton, .clear-button {
    will-change: transform;
}

/* تحسين إمكانية الوصول */
button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.device:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
} 