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

.voice-agent-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.voice-agent-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

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

.voice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.voice-agent-fab svg,
.voice-icon svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s ease;
}

.voice-agent-fab.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.voice-agent-fab.listening {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.voice-agent-fab.processing {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    cursor: wait;
}

.voice-agent-fab.processing svg {
    display: none;
}

.voice-agent-fab.processing::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.voice-agent-fab.speaking {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.voice-agent-tooltip {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    font-weight: 500;
}

.voice-agent-fab:hover .voice-agent-tooltip,
.voice-agent-fab.listening .voice-agent-tooltip,
.voice-agent-fab.processing .voice-agent-tooltip,
.voice-agent-fab.speaking .voice-agent-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   VOICE AGENT MODAL
   ============================================ */

.voice-agent-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
}

.voice-agent-modal.hidden {
    display: none;
}

.voice-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    z-index: 10001;
    transition: box-shadow 0.3s ease;
    overflow: hidden;
}

.voice-modal-content:hover {
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
}

.voice-modal-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 16px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.voice-header-visual {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.professor-icon-wrapper {
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.professor-icon-wrapper svg {
    color: white;
    width: 24px;
    height: 24px;
}

.voice-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.voice-modal-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    margin: 2px 0 0 0;
    font-weight: 400;
}

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

.voice-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.voice-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

/* ============================================
   MODE TOGGLE
   ============================================ */

.mode-toggle-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.mode-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.mode-toggle-btn.active {
    background: white;
    color: #10b981;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mode-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.mode-panel {
    display: none;
    flex-direction: column;
    flex: 1;
}

.mode-panel.active {
    display: flex;
}

/* ============================================
   VOICE MODE
   ============================================ */

.voice-interaction-area {
    text-align: center;
    margin-bottom: 16px;
}

.mic-animation-state {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.mic-visual-pulse {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mic-visual-pulse svg {
    width: 36px;
    height: 36px;
}

.mic-status-text {
    font-weight: 500;
    color: #475569;
    font-size: 14px;
    min-height: 20px;
    line-height: 1.5;
}

.mic-animation-state.listening .mic-visual-pulse {
    background: #fef2f2;
    color: #ef4444;
    animation: pulse-red 1.5s infinite;
}

.mic-animation-state.processing .mic-visual-pulse {
    background: #fef3c7;
    color: #f59e0b;
    animation: spin 1s linear infinite;
}

.mic-animation-state.speaking .mic-visual-pulse {
    background: #d1fae5;
    color: #10b981;
    animation: pulse-green 2s infinite;
}

.btn-falar-agora {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-weight: 700;
    font-size: 15px;
    padding: 14px 20px;
    border-radius: 12px;
    width: 100%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-falar-agora:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-falar-agora:active:not(:disabled) {
    transform: translateY(0);
}

.btn-falar-agora:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   CHAT MODE
   ============================================ */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 16px;
    min-height: 300px;
    max-height: 400px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
    padding: 40px 20px;
}

.chat-empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-empty-state p {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #64748b;
}

.chat-empty-state span {
    font-size: 13px;
    color: #94a3b8;
}

.chat-message {
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-content {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-message.user .chat-message-content {
    flex-direction: row-reverse;
}

.chat-message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
}

.chat-message.user .chat-message-text {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.chat-message.assistant .chat-message-text {
    background: #10b981;
    color: white;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.2s ease;
    line-height: 1.5;
}

.chat-input:focus {
    outline: none;
    border-color: #10b981;
}

.chat-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.btn-send-message {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-send-message:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-send-message:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-send-message:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send-message svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   DARK MODE
   ============================================ */

@media (prefers-color-scheme: dark) {
    .voice-modal-content {
        background: #1e293b;
    }

    .voice-modal-body {
        background: #1e293b;
    }

    .mic-status-text {
        color: #cbd5e1;
    }

    .mic-visual-pulse {
        background: #334155;
        color: #94a3b8;
    }

    .mic-animation-state.listening .mic-visual-pulse {
        background: #7f1d1d;
        color: #fca5a5;
    }

    .mic-animation-state.processing .mic-visual-pulse {
        background: #78350f;
        color: #fcd34d;
    }

    .mic-animation-state.speaking .mic-visual-pulse {
        background: #064e3b;
        color: #6ee7b7;
    }

    .chat-messages {
        background: #0f172a;
    }

    .chat-message-text {
        background: #334155;
        color: #e2e8f0;
    }

    .chat-input {
        background: #334155;
        border-color: #475569;
        color: #e2e8f0;
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .voice-agent-fab {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .voice-modal-content {
        width: 95%;
        max-width: 380px;
    }

    .voice-modal-header {
        padding: 14px 16px;
    }

    .voice-modal-body {
        padding: 20px 16px;
        min-height: 350px;
    }

    .voice-modal-title {
        font-size: 15px;
    }

    .voice-modal-subtitle {
        font-size: 11px;
    }

    .professor-icon-wrapper {
        width: 36px;
        height: 36px;
    }

    .professor-icon-wrapper svg {
        width: 20px;
        height: 20px;
    }

    .mic-visual-pulse {
        width: 70px;
        height: 70px;
    }

    .mic-visual-pulse svg {
        width: 32px;
        height: 32px;
    }

    .mic-status-text {
        font-size: 13px;
    }

    .btn-falar-agora {
        padding: 12px 18px;
        font-size: 14px;
    }

    .mode-toggle-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .chat-messages {
        min-height: 250px;
        max-height: 300px;
    }

    .chat-message-text {
        font-size: 13px;
        max-width: 85%;
    }
}