/**
 * Registre Numérique - Styles meeting Cloudflare RealtimeKit
 *
 * @package        Front - permanences - Télépermanences
 * @author         Nicolas Simplot nsimplot@publilegal.fr
 * @copyright      2026 Publilégal
 * @license        commercial
 * @version        1.0.0
 */

/* Container principal */
.cloudflare-meeting-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    background: #1e1e1e;
    overflow: hidden;
}

/* UI Kit Cloudflare */
#cloudflare-meeting-ui {
    width: 100%;
    height: 100%;
}

/* Overlay de contrôles */
.meeting-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meeting-info {
    display: flex;
    gap: 20px;
    align-items: center;
    color: white;
}

.meeting-status {
    font-size: 16px;
    font-weight: 500;
}

.meeting-timer {
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(244, 67, 54, 0.9);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 500;
    animation: pulse-recording 2s ease-in-out infinite;
}

.recording-indicator i {
    color: white;
    animation: blink 1s ease-in-out infinite;
}

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

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Sidebar */
.meeting-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.meeting-sidebar.hidden {
    transform: translateX(100%);
}

/* Tabs sidebar */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #f5f5f5;
}

.sidebar-tab {
    flex: 1;
    padding: 15px 10px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.sidebar-tab:hover {
    background: rgba(33, 150, 243, 0.1);
}

.sidebar-tab.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
    background: white;
}

.sidebar-tab i {
    margin-right: 5px;
}

/* Contenu sidebar */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.sidebar-panel {
    display: none;
    height: 100%;
}

.sidebar-panel.active {
    display: flex;
    flex-direction: column;
}

/* Bouton fermeture sidebar */
.sidebar-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sidebar-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Bouton toggle sidebar */
.btn-toggle-sidebar {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    font-size: 24px;
    z-index: 150;
    transition: all 0.3s;
}

.btn-toggle-sidebar:hover {
    background: #1976D2;
    transform: scale(1.1);
}

/* Chat */
#panel-chat {
    padding: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fafafa;
}

.chat-message {
    margin-bottom: 15px;
}

.chat-message-system {
    display: block;
    text-align: center;
    font-size: 13px;
    color: #666;
    font-style: italic;
    padding: 8px;
}

.chat-message-system i {
    margin-right: 5px;
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.chat-author {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.chat-time {
    font-size: 12px;
    color: #999;
}

.chat-message-content {
    background: white;
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    color: #333;
    word-wrap: break-word;
}

.chat-message-local .chat-message-content {
    background: #E3F2FD;
    border: 1px solid #2196F3;
}

.chat-input-wrapper {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

#chat-input {
    flex: 1;
    margin-right: 10px;
    border-radius: 20px;
}

#btn-send-chat {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fichiers */
#panel-files {
    padding: 20px;
}

.file-upload-area {
    margin-bottom: 20px;
}

#file-input {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed #2196F3;
    border-radius: 8px;
    cursor: pointer;
    background: #f5f5f5;
    transition: all 0.3s;
}

.file-upload-label:hover {
    background: #E3F2FD;
    border-color: #1976D2;
}

.file-upload-label i {
    font-size: 48px;
    color: #2196F3;
    margin-bottom: 10px;
}

.file-upload-label span {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.file-upload-label small {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    gap: 10px;
}

.file-item i:first-child {
    font-size: 24px;
    color: #2196F3;
}

.file-name {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-status {
    font-size: 12px;
    color: #666;
}

.file-status-uploading {
    opacity: 0.6;
}

.file-status-uploading .file-status {
    color: #FF9800;
}

.file-status-uploaded .file-status {
    color: #4CAF50;
}

.file-status-error {
    border-color: #f44336;
}

.file-status-error .file-status {
    color: #f44336;
}

/* Participants */
#panel-participants {
    padding: 15px;
}

.participants-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.participant-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    gap: 10px;
}

.participant-item i:first-child {
    font-size: 20px;
    color: #2196F3;
}

.participant-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.participant-status {
    font-size: 16px;
}

.participant-status.muted {
    color: #f44336;
}

.participant-status.unmuted {
    color: #4CAF50;
}

/* Responsive */
@media (max-width: 768px) {
    .meeting-sidebar {
        width: 100%;
    }

    .btn-toggle-sidebar {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 80px;
    }

    .meeting-controls-overlay {
        padding: 10px;
    }

    .meeting-info {
        gap: 10px;
        font-size: 14px;
    }

    .meeting-timer {
        font-size: 16px;
    }

    .sidebar-tab {
        padding: 12px 5px;
        font-size: 12px;
    }

    .sidebar-tab i {
        display: block;
        margin: 0 0 5px 0;
    }
}

/* Mode plein écran */
.cloudflare-meeting-wrapper:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

.cloudflare-meeting-wrapper:-moz-full-screen {
    width: 100vw;
    height: 100vh;
}

.cloudflare-meeting-wrapper:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
}

.cloudflare-meeting-wrapper:fullscreen {
    width: 100vw;
    height: 100vh;
}

/* Accessibilité */
.sidebar-tab:focus,
.sidebar-close:focus,
.btn-toggle-sidebar:focus,
#btn-send-chat:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

/* Scrollbar personnalisée */
.chat-messages::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animation d'entrée */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.meeting-sidebar:not(.hidden) {
    animation: slideInRight 0.3s ease;
}
