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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

.header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.2em;
}

.header .subtitle {
    color: #7f8c8d;
    font-size: 1.1em;
}

.status-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.status-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.status-card:hover {
    transform: translateY(-5px);
}

.status-card i {
    font-size: 2em;
    margin-bottom: 10px;
}

.status-card.online { border-right: 4px solid #27ae60; }
.status-card.offline { border-right: 4px solid #e74c3c; }
.status-card.total { border-right: 4px solid #3498db; }

.device-tree {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.device-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-header:hover {
    transform: translateX(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.device-header.online {
    background: linear-gradient(135deg, #27ae60, #219a52);
}

.device-header.offline {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.device-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.device-name {
    font-size: 1.3em;
    font-weight: bold;
}

.device-details {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    opacity: 0.9;
}

.cameras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.camera-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.camera-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.camera-card.online {
    border-right: 4px solid #27ae60;
}

.camera-card.offline {
    border-right: 4px solid #e74c3c;
    opacity: 0.7;
}

.camera-status {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.camera-status.online { background: #27ae60; }
.camera-status.offline { background: #e74c3c; }

.camera-name {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #2c3e50;
}

.camera-details {
    font-size: 0.85em;
    color: #7f8c8d;
    margin-bottom: 15px;
}

.camera-detail-item {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.camera-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn i { font-size: 0.9em; }

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219a52;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.75em;
}

.refresh-section {
    text-align: center;
    margin: 20px 0;
}

.btn-refresh {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.loading i {
    font-size: 2em;
    margin-bottom: 10px;
}

/* مشغل الفيديو */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.btn-close {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container {
    flex: 1;
    padding: 20px;
    background: #000;
}

#jsDecoderPlayer {
    width: 100%;
    height: 500px;
    background: #000;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
}

.player-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

/* تحسينات للاستجابة */
@media (max-width: 768px) {
    .cameras-grid {
        grid-template-columns: 1fr;
    }
    
    .device-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .device-details {
        flex-wrap: wrap;
    }
    
    .status-cards {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .modal-content {
        width: 95%;
        height: 95%;
    }
    
    #jsDecoderPlayer {
        height: 300px;
    }
}

/* أنيميشن للتحميل */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}