/**
 * AI Advantage Solutions - Voice Agent Styles
 * Matches brand colors and provides smooth animations
 */

/* ========================================
   Floating Action Button (FAB)
   ======================================== */

.voice-fab {
    position: fixed;
    bottom: 30px;
    left: 30px;  /* Changed from right to left to avoid Chatbase overlap */
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-aqua) 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 195, 176, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
}

.voice-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(16, 195, 176, 0.5);
}

.voice-fab:active {
    transform: scale(0.95);
}

.voice-fab.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

/* ========================================
   Voice Panel
   ======================================== */

.voice-panel {
    position: fixed;
    bottom: 30px;
    left: 30px;  /* Changed from right to left to match button position */
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%) scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
}

.voice-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Panel Header */
.voice-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--brand-navy) 0%, #1a1f4a 100%);
    color: var(--light-text);
    border-radius: 16px 16px 0 0;
}

.voice-panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--light-text);
}

.voice-close-btn {
    background: none;
    border: none;
    color: var(--light-text);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.voice-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Panel Body */
.voice-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 24px;
}

/* Status Indicator */
.voice-status {
    margin-bottom: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--background-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-light);
    transition: all 0.3s ease;
}

.status-indicator.listening .status-dot {
    background: var(--brand-red);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.thinking .status-dot {
    background: var(--brand-gold);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.speaking .status-dot {
    background: var(--brand-teal);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.status-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
}

/* Conversation Area */
.voice-conversation {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 8px;
}

.voice-conversation::-webkit-scrollbar {
    width: 6px;
}

.voice-conversation::-webkit-scrollbar-track {
    background: transparent;
}

.voice-conversation::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.voice-conversation::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.voice-welcome {
    background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-aqua) 100%);
    color: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.voice-welcome p {
    color: white;
    margin-bottom: 8px;
}

.voice-welcome ul {
    margin: 8px 0 0 20px;
    color: white;
}

.voice-welcome li {
    margin: 4px 0;
    color: white;
}

/* Messages */
.message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    color: var(--text-light);
}

.message p {
    margin: 0;
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.5;
}

.user-message .message-label {
    color: var(--brand-navy);
}

.user-message p {
    background: var(--brand-navy);
    color: var(--light-text);
    border-bottom-right-radius: 4px;
}

.assistant-message .message-label {
    color: var(--brand-teal);
}

.assistant-message p {
    background: var(--background-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-interim p {
    opacity: 0.7;
    font-style: italic;
}

/* Controls */
.voice-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.voice-mic-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-aqua) 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 195, 176, 0.3);
    position: relative;
}

.voice-mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(16, 195, 176, 0.4);
}

.voice-mic-btn:active {
    transform: scale(0.95);
}

.voice-mic-btn.active {
    background: var(--brand-red);
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(229, 69, 99, 0.3);
    }
    50% {
        box-shadow: 0 4px 24px rgba(229, 69, 99, 0.6);
    }
}

.voice-reset-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--background-light);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-reset-btn:hover {
    background: var(--border-color);
    transform: rotate(180deg);
}

/* Error Display */
.voice-error {
    padding: 12px 16px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: var(--brand-red);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

/* Panel Footer */
.voice-panel-footer {
    padding: 16px 24px;
    background: var(--background-light);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 16px 16px;
}

.voice-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
}

.voice-hint strong {
    color: var(--text-dark);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .voice-fab {
        bottom: 20px;
        left: 20px;  /* Changed from right to left */
        width: 56px;
        height: 56px;
    }

    .voice-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }

    .voice-panel.open {
        transform: translateY(0) scale(1);
    }

    .voice-panel-header {
        border-radius: 16px 16px 0 0;
    }

    .voice-panel-footer {
        border-radius: 0;
    }
}

/* ========================================
   Accessibility
   ======================================== */

.voice-fab:focus,
.voice-mic-btn:focus,
.voice-reset-btn:focus,
.voice-close-btn:focus {
    outline: 2px solid var(--brand-teal);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .voice-panel {
        border: 2px solid var(--brand-navy);
    }

    .status-indicator {
        border: 2px solid var(--text-dark);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .voice-fab,
    .voice-panel,
    .voice-mic-btn,
    .voice-reset-btn,
    .message {
        animation: none;
        transition: none;
    }

    .status-dot {
        animation: none;
    }
}
