/* ========================================
   SYSTÈME DE WEBCAMS FLOTTANTES - CSS
   Compatible tous navigateurs
   ======================================== */

/* Contrôles du mode webcam */
.webcam-mode-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.webcam-control-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(236, 72, 153, 0.1);
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 25px;
    color: #f472b6;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.webcam-control-btn:hover {
    background: rgba(236, 72, 153, 0.2);
    border-color: #ec4899;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(236, 72, 153, 0.3);
}

.webcam-control-btn .icon {
    font-size: 18px;
}

/* ========================================
   MODE GRILLE
   ======================================== */

.webcams-grid-mode {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin: 15px;
    min-height: 100px;
    transition: all 0.3s ease;
}

.webcam-grid-item {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 4/3;
    transition: all 0.3s ease;
}

.webcam-grid-item:hover {
    border-color: #ec4899;
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.5);
    transform: scale(1.02);
}

.webcam-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.webcam-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.webcam-username {
    color: #f472b6;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.webcam-status {
    display: flex;
    gap: 8px;
}

.status-icon {
    font-size: 18px;
    opacity: 0.3;
    transition: all 0.3s;
}

.status-icon.active {
    opacity: 1;
    filter: drop-shadow(0 0 8px currentColor);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.webcam-hover-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.webcam-grid-item:hover .webcam-hover-controls {
    opacity: 1;
}

.webcam-mini-btn {
    width: 35px;
    height: 35px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(236, 72, 153, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webcam-mini-btn:hover {
    background: rgba(236, 72, 153, 0.8);
    border-color: #ec4899;
    transform: scale(1.1);
}

/* ========================================
   MODE FLOTTANT
   ======================================== */

.webcams-floating-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.floating-webcam-window {
    position: absolute;
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid rgba(236, 72, 153, 0.5);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    pointer-events: auto;
    transition: box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.floating-webcam-window:hover {
    box-shadow: 0 15px 50px rgba(236, 72, 153, 0.4);
    border-color: #ec4899;
}

.floating-webcam-window.minimized {
    height: 50px !important;
}

.floating-webcam-window.minimized .floating-webcam-video,
.floating-webcam-window.minimized .floating-webcam-status,
.floating-webcam-window.minimized .resize-handles {
    display: none;
}

/* Header draggable */
.floating-webcam-header {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(157, 23, 77, 0.3));
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid rgba(236, 72, 153, 0.2);
    flex-shrink: 0;
}

.floating-webcam-title {
    color: #f472b6;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.floating-webcam-buttons {
    display: flex;
    gap: 5px;
}

.floating-btn {
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(236, 72, 153, 0.3);
    border-radius: 4px;
    color: #f472b6;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.floating-btn:hover {
    background: rgba(236, 72, 153, 0.3);
    border-color: #ec4899;
    transform: scale(1.1);
}

/* Vidéo */
.floating-webcam-video {
    width: 100%;
    flex: 1;
    object-fit: cover;
    background: #000;
}

/* Status bar */
.floating-webcam-status {
    background: rgba(0, 0, 0, 0.8);
    padding: 6px 12px;
    display: flex;
    gap: 10px;
    justify-content: center;
    border-top: 1px solid rgba(236, 72, 153, 0.2);
    flex-shrink: 0;
}

/* Resize handles */
.resize-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: rgba(236, 72, 153, 0.5);
    border: 2px solid #ec4899;
    border-radius: 50%;
    pointer-events: auto;
    transition: all 0.2s;
    z-index: 10;
}

.resize-handle:hover {
    background: #ec4899;
    transform: scale(1.3);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.8);
}

.resize-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .webcams-grid-mode {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }
}

@media (max-width: 768px) {
    .webcams-grid-mode {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
        margin: 10px;
    }
    
    .floating-webcam-window {
        min-width: 200px !important;
        min-height: 150px !important;
    }
    
    .webcam-mode-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .webcam-control-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .webcam-control-btn .label {
        display: none;
    }
}

/* Support tactile */
@media (hover: none) and (pointer: coarse) {
    .webcam-hover-controls {
        opacity: 1;
    }
    
    .resize-handle {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.webcam-grid-item,
.floating-webcam-window {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar personnalisée pour Chrome/Edge */
.webcams-grid-mode::-webkit-scrollbar {
    width: 8px;
}

.webcams-grid-mode::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.webcams-grid-mode::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ec4899, #9d174d);
    border-radius: 10px;
}

.webcams-grid-mode::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #f472b6, #ec4899);
}
