/* Fenêtre de surveillance admin */
#admin-monitor-window {
    position: fixed;
    left: 20px;
    top: 20px;
    width: 400px;
    max-height: 80vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

#admin-monitor-window.minimized {
    max-height: 60px;
    overflow: hidden;
}

#monitor-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    position: relative;
}

#monitor-header::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 6px rgba(74, 222, 128, 0);
    }
}

#monitor-header h3 {
    margin: 0;
    margin-left: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

#monitor-header-actions {
    display: flex;
    gap: 10px;
}

#close-monitor {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

#close-monitor:hover {
    background: rgba(255, 255, 255, 0.3);
}

#monitor-stats {
    background: #f8f9fa;
    padding: 15px 20px;
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid #e9ecef;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

#monitor-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    max-height: calc(80vh - 140px);
}

#lobbies-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lobby-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.lobby-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.lobby-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.lobby-state {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.lobby-state-waiting {
    background: #ffeaa7;
    color: #d63031;
}

.lobby-state-playing {
    background: #55efc4;
    color: #00b894;
}

.lobby-state-finished {
    background: #dfe6e9;
    color: #636e72;
}

.lobby-info {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #666;
}

.players-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-item-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    gap: 10px;
}

.player-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-name-admin {
    font-weight: 500;
    color: #333;
}

.player-score {
    color: #667eea;
    font-weight: 600;
}

.btn-send-msg {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.btn-send-msg:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

/* Bouton toggle fixe */
#toggle-monitor {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
}

#toggle-monitor:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

/* Modale popup */
#popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#popup-modal .modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#popup-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 20px 20px 0 0;
}

#popup-modal .modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

#popup-modal .modal-body {
    padding: 30px;
}

.popup-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.popup-info strong {
    color: #667eea;
}

#popup-message {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#popup-message:focus {
    outline: none;
    border-color: #667eea;
}

.popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.popup-actions button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#send-popup-btn {
    background: #667eea;
    color: white;
}

#send-popup-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

#cancel-popup-btn {
    background: #6c757d;
    color: white;
}

#cancel-popup-btn:hover {
    background: #5a6268;
}

/* Scrollbar personnalisée */
#monitor-content::-webkit-scrollbar {
    width: 8px;
}

#monitor-content::-webkit-scrollbar-track {
    background: #f8f9fa;
}

#monitor-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

#monitor-content::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Responsive */
@media (max-width: 768px) {
    #admin-monitor-window {
        width: calc(100% - 40px);
        max-width: 400px;
        left: 20px;
        right: auto;
    }
    
    #toggle-monitor {
        left: 50%;
        transform: translateX(-50%);
        bottom: 80px;
    }
}

/* Section du monitoring */
.monitor-section {
    margin-bottom: 20px;
}

.monitor-section h4 {
    color: #667eea;
    font-size: 0.95em;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

/* Liste des utilisateurs */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item-admin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
    border-left: 3px solid #667eea;
    border-radius: 6px;
    gap: 10px;
    font-size: 0.9em;
}

.user-name {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.user-status {
    font-size: 0.85em;
    color: #666;
    background: white;
    padding: 2px 8px;
    border-radius: 12px;
}

@media (max-width: 1200px) {
    #admin-monitor-window {
        width: 350px;
    }
}

