/* ============================================================
   FRECUENCIA CLASE - VOICE CHAT MODULE
   Estilos coherentes con el proyecto (modal: 900px max-width)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
    --vc-negro: #000000;
    --vc-negro-suave: #0a0a0a;
    --vc-rojo: #ff0000;
    --vc-rojo-oscuro: #8b0000;
    --vc-blanco: #ffffff;
    --vc-verde: #00ff00;
    --vc-verde-oscuro: #00cc00;
    --vc-purpura: #9900ff;
    --vc-purpura-oscuro: #6600cc;
    --vc-amarillo: #ffff00;
    --vc-gris: #1a1a1a;
}

/* Voice Chat Modal - Coherente con otros módulos */
.voice-chat-modal .modal-content {
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    background: var(--vc-negro);
    border: 2px solid var(--vc-rojo);
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.4);
    padding: 0;
    overflow: hidden;
    position: relative;
}

.voice-chat-header {
    background: linear-gradient(180deg, var(--vc-rojo-oscuro), var(--vc-negro));
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--vc-rojo);
}

.voice-chat-title {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--vc-blanco);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-chat-title::before {
    content: '🎙️';
    font-size: 1.2rem;
}

.voice-chat-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--vc-rojo);
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.voice-chat-close:hover {
    color: #fff;
    transform: scale(1.2);
}

/* Container Principal */
.voice-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(85vh - 80px);
    max-height: 600px;
    overflow: hidden;
}

/* Wave Visualizer - Dynamic Audio */
.voice-visualizer {
    height: 50px;
    background: var(--vc-negro-suave);
    border-bottom: 1px solid var(--vc-rojo);
    position: relative;
    overflow: hidden;
}

.voice-visualizer canvas {
    width: 100%;
    height: 100%;
}

.voice-visualizer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
}

.visualizer-bar {
    width: 4px;
    background: linear-gradient(to top, var(--vc-rojo), var(--vc-amarillo), var(--vc-verde));
    border-radius: 2px;
    animation: visualizer-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes visualizer-pulse {
    0% { height: 5px; opacity: 0.5; }
    100% { height: 25px; opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.visualizer-bar:nth-child(1) { animation-delay: 0s; }
.visualizer-bar:nth-child(2) { animation-delay: 0.1s; }
.visualizer-bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer-bar:nth-child(4) { animation-delay: 0.15s; }
.visualizer-bar:nth-child(5) { animation-delay: 0.25s; }
.visualizer-bar:nth-child(6) { animation-delay: 0.05s; }
.visualizer-bar:nth-child(7) { animation-delay: 0.3s; }
.visualizer-bar:nth-child(8) { animation-delay: 0.12s; }

/* Speaking Stage - Podio Principal */
.voice-stage {
    background: var(--vc-negro-suave);
    padding: 15px;
    border-bottom: 1px solid var(--vc-rojo);
}

.stage-header {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: var(--vc-verde);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-header::before {
    content: '▲';
    color: var(--vc-amarillo);
}

.speakers-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.speaker-card {
    background: var(--vc-gris);
    border: 2px solid var(--vc-rojo-oscuro);
    border-radius: 10px;
    padding: 10px;
    width: 100px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.speaker-card.speaking {
    border-color: var(--vc-verde);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    animation: speaking-pulse 1s ease-in-out infinite;
}

.speaker-card.muted {
    opacity: 0.6;
}

@keyframes speaking-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.speaker-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vc-rojo) 0%, var(--vc-negro) 100%);
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--vc-blanco);
    border: 2px solid var(--vc-rojo);
}

.speaker-card.speaking .speaker-avatar {
    border-color: var(--vc-verde);
    background: linear-gradient(135deg, var(--vc-verde) 0%, var(--vc-negro) 100%);
}

.speaker-name {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--vc-blanco);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.speaker-role {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    text-transform: uppercase;
    margin-top: 2px;
}

.speaker-role.host { color: var(--vc-amarillo); }
.speaker-role.co-host { color: var(--vc-purpura); }
.speaker-role.speaker { color: var(--vc-verde); }

.speaker-status {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.8rem;
}

.speaker-status.muted::after { content: '🔇'; }
.speaker-status.speaking::after { content: '🔊'; animation: sound-wave 0.5s infinite; }

@keyframes sound-wave {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat and Audience Section */
.voice-chat-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Audience Section */
.audience-section {
    width: 180px;
    background: var(--vc-negro-suave);
    border-right: 1px solid var(--vc-rojo-oscuro);
    display: flex;
    flex-direction: column;
}

.audience-header {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: var(--vc-amarillo);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px;
    border-bottom: 1px solid var(--vc-rojo-oscuro);
    text-align: center;
}

.audience-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.audience-item {
    display: flex;
    align-items: center;
    padding: 6px;
    margin-bottom: 6px;
    background: var(--vc-gris);
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--vc-blanco);
    gap: 6px;
}

.audience-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--vc-rojo-oscuro);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
    color: var(--vc-blanco);
}

/* Chat Section */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--vc-negro);
}

.chat-header {
    padding: 10px 15px;
    border-bottom: 1px solid var(--vc-rojo-oscuro);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vc-blanco);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 85%;
    word-wrap: break-word;
    animation: message-appear 0.3s ease;
}

@keyframes message-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.own {
    background: var(--vc-rojo);
    color: var(--vc-blanco);
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.chat-message.other {
    background: var(--vc-gris);
    color: var(--vc-blanco);
    border-bottom-left-radius: 2px;
}

.chat-message.system {
    background: transparent;
    color: var(--vc-verde);
    text-align: center;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    border: 1px dashed var(--vc-verde);
    max-width: 100%;
}

.chat-user {
    font-weight: 600;
    font-size: 0.75rem;
    margin-right: 5px;
}

.chat-user.host { color: var(--vc-amarillo); }
.chat-user.co-host { color: var(--vc-purpura); }
.chat-user.speaker { color: var(--vc-verde); }
.chat-user.listener { color: #888; }

.chat-text {
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-reaction {
    font-size: 1.2rem;
    margin-left: 5px;
}

/* Chat Input */
.chat-input-container {
    padding: 12px;
    border-top: 1px solid var(--vc-rojo-oscuro);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 15px;
    background: var(--vc-gris);
    border: 2px solid var(--vc-negro);
    border-radius: 8px;
    color: var(--vc-blanco);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--vc-rojo);
}

.chat-input::placeholder {
    color: #666;
}

/* Rebel Emojis */
.rebel-emojis {
    display: flex;
    gap: 4px;
    background: var(--vc-negro-suave);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--vc-rojo-oscuro);
    flex-wrap: wrap;
    justify-content: center;
}

.rebel-emoji {
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    user-select: none;
    animation: emoji-float 3s ease-in-out infinite;
}

.rebel-emoji:nth-child(odd) {
    animation-delay: 0.5s;
}

.rebel-emoji:nth-child(3n) {
    animation-delay: 1s;
}

.rebel-emoji:nth-child(5n) {
    animation-delay: 1.5s;
}

@keyframes emoji-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.rebel-emoji:hover {
    background: var(--vc-rojo);
    transform: scale(1.4) !important;
    text-shadow: 0 0 15px var(--vc-rojo);
    animation: none;
}

.rebel-emoji:active {
    transform: scale(1.1);
}

/* Send Button */
.send-btn {
    padding: 10px 20px;
    background: var(--vc-rojo);
    color: var(--vc-blanco);
    border: none;
    border-radius: 8px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.send-btn:hover {
    background: var(--vc-blanco);
    color: var(--vc-rojo);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

.send-btn:active {
    transform: scale(0.95);
}

/* Control Buttons */
.voice-controls {
    padding: 12px;
    border-top: 1px solid var(--vc-rojo-oscuro);
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.voice-control-btn {
    padding: 8px 16px;
    background: var(--vc-gris);
    border: 2px solid var(--vc-rojo-oscuro);
    border-radius: 8px;
    color: var(--vc-blanco);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.voice-control-btn:hover {
    background: var(--vc-rojo-oscuro);
    border-color: var(--vc-rojo);
}

.voice-control-btn.active {
    background: var(--vc-rojo);
    border-color: var(--vc-blanco);
}

.voice-control-btn.danger {
    border-color: #ff4444;
}

.voice-control-btn.danger:hover {
    background: #ff4444;
}

.voice-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Reaction Animation */
.reaction-popup {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    animation: reaction-float 2s ease-out forwards;
}

@keyframes reaction-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.5);
    }
}

/* Room Info */
.room-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
}

.room-id {
    color: #888;
}

.room-users-count {
    color: var(--vc-verde);
    display: flex;
    align-items: center;
    gap: 5px;
}

.room-users-count::before {
    content: '👥';
}

/* Responsive */
@media (max-width: 768px) {
    .voice-chat-modal .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .voice-chat-container {
        height: calc(90vh - 80px);
    }
    
    .audience-section {
        display: none;
    }
    
    .speakers-grid {
        gap: 8px;
    }
    
    .speaker-card {
        width: 80px;
        padding: 8px;
    }
    
    .speaker-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .voice-controls {
        gap: 6px;
    }
    
    .voice-control-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .voice-chat-title {
        font-size: 1rem;
    }
    
    .speakers-grid {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
    
    .speaker-card {
        min-width: 70px;
    }
}

/* Hidden state */
.voice-chat-modal.hidden {
    display: none;
}
