/* Estilos para LiveKit Chat de Voz */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --dark-color: #1d3557;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: var(--light-color);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Formulario de conexión */
.connection-form {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--box-shadow);
    max-width: 500px;
    margin: 0 auto;
}

.connection-form h1 {
    color: var(--success-color);
    margin-bottom: 10px;
    font-size: 2rem;
}

.connection-form p {
    color: #a9d6e5;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #a9d6e5;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    margin: 0 5px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray-color);
    color: white;
}

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

.btn-control {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-control.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Área principal */
.main-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Indicador de estado */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius);
    width: fit-content;
}

.status-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-icon.connected {
    background: #2ecc71;
    box-shadow: 0 0 10px #2ecc71;
}

.status-icon.disconnected {
    background: #e74c3c;
}

.status-icon.connecting {
    background: #f39c12;
    animation: pulse 1.5s infinite;
}

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

/* Contenedor de videos */
.videos-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    flex-grow: 1;
}

.video-container {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-container.local {
    border: 3px solid var(--primary-color);
}

.participant-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-size: 14px;
}

/* Contenedor de chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 10px;
    border-radius: var(--border-radius);
    max-width: 80%;
    word-wrap: break-word;
}

.message.user {
    align-self: flex-end;
    background: var(--primary-color);
}

.message.agent {
    align-self: flex-start;
    background: rgba(76, 201, 240, 0.2);
    border-left: 3px solid var(--success-color);
}

.message.system {
    align-self: center;
    background: rgba(248, 150, 30, 0.2);
    font-style: italic;
    text-align: center;
    width: 100%;
    max-width: 100%;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    margin-right: 10px;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Controles de medios */
.controls-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius);
}

.control-icon {
    font-size: 20px;
}

/* Modal de participantes */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #1d3557;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: white;
}

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

.participant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.participant-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2ecc71;
}

.participant-status.offline {
    background: #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .videos-container {
        grid-template-columns: 1fr;
    }
    
    .connection-form {
        padding: 20px;
    }
    
    .controls-container {
        flex-wrap: wrap;
    }
    
    .chat-container {
        height: 250px;
    }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}