/* ============================================================================
   Demo Call Widget - Widget flotante para llamadas de demostración
   ============================================================================ */

.demo-call-widget {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Botón flotante micrófono luminoso */
.demo-call-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.demo-call-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.demo-call-trigger:active {
    transform: scale(0.95);
}

/* Pulso de animación para el botón */
.demo-call-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0;
    }
}

/* Icono del micrófono */
.demo-call-trigger svg {
    width: 28px;
    height: 28px;
    fill: white;
    position: relative;
    z-index: 1;
}

/* Panel de llamada (expandido) */
.demo-call-panel {
    position: absolute;
    bottom: 88px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.demo-call-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
}

.demo-call-panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 20px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-call-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.demo-call-panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.demo-call-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.demo-call-panel-body {
    padding: 28px 24px;
    background: linear-gradient(to bottom, #ffffff 0%, #f7fafc 100%);
}

/* Estados del panel */
.demo-call-state {
    text-align: center;
    margin-bottom: 16px;
}

.demo-call-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f4ff;
    border-radius: 50%;
    position: relative;
}

.demo-call-state-icon svg {
    width: 40px;
    height: 40px;
    fill: #667eea;
}

/* Animación de conectando */
.demo-call-state-icon.connecting {
    background: #fff3cd;
}

.demo-call-state-icon.connecting svg {
    fill: #ffc107;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estado en llamada */
.demo-call-state-icon.in-call {
    background: #d4edda;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-call-state-icon.in-call svg {
    fill: #28a745;
    width: 48px;
    height: 48px;
}

/* Visualizador de ondas */
.demo-call-waveform {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 40px;
    margin: 12px 0;
}

.demo-call-waveform-bar {
    width: 3px;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 2px;
    animation: wave 0.5s ease-in-out infinite;
}

.demo-call-waveform-bar:nth-child(1) { animation-delay: 0s; height: 10px; }
.demo-call-waveform-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.demo-call-waveform-bar:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.demo-call-waveform-bar:nth-child(4) { animation-delay: 0.3s; height: 25px; }
.demo-call-waveform-bar:nth-child(5) { animation-delay: 0.4s; height: 15px; }

@keyframes wave {
    0%, 100% { height: 10px; }
    50% { height: 30px; }
}

/* Contador de tiempo */
.demo-call-timer {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.demo-call-status {
    font-size: 12px;
    color: #666;
    margin-bottom: 16px;
    text-align: center;
}

.demo-call-status.warning {
    color: #ff6b6b;
    font-weight: 500;
}

/* Botones de control */
.demo-call-controls {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.demo-call-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.demo-call-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.demo-call-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.demo-call-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.demo-call-btn-danger {
    background: #ff6b6b;
    color: white;
}

.demo-call-btn-danger:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

.demo-call-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.demo-call-btn-secondary:hover {
    background: #e0e0e0;
}

/* Info de duración limitada */
.demo-call-info {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #555;
    margin-bottom: 12px;
    line-height: 1.4;
}

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

/* Responsive para móvil */
@media (max-width: 480px) {
    .demo-call-widget {
        bottom: 88px;
        right: 16px;
    }
    
    .demo-call-trigger {
        width: 56px;
        height: 56px;
    }
    
    .demo-call-trigger svg {
        width: 26px;
        height: 26px;
    }
    
    .demo-call-panel {
        width: 320px;
        bottom: 80px;
    }
    
    .demo-call-panel-body {
        padding: 16px;
    }
}

/* Hint bubble */
.demo-call-hint {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #1f1f2e;
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.demo-call-hint::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 18px;
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: #1f1f2e transparent transparent transparent;
}

.demo-call-hint.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
