/* /mindmap/mapConversationalAgent.css */

#aiConversationOverlay {
    position: fixed;
    inset: 0;
    z-index: 1000; /* High, but below potential system UI like permission prompts */
    display: flex;
    align-items: flex-end; /* Position at the bottom for mobile */
    justify-content: center;
    padding: 0; /* Panel will have its own padding */
    background-color: rgba(0, 0, 0, 0.1); /* Very subtle backdrop */
    -webkit-backdrop-filter: blur(8px); /* iOS Safari blur */
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

#aiConversationOverlay.visible {
    opacity: 1;
    visibility: visible;
}

.ai-conversation-panel {
    width: 100%;
    max-width: 600px; /* Max width on larger screens */
    height: 75vh; /* Max height, adjust as needed */
    max-height: 600px;
    margin: 0 auto 1rem auto; /* Bottom margin on mobile, centered on desktop */
    background-color: rgba(255, 255, 255, 0.65); /* Glassmorphism base */
    -webkit-backdrop-filter: blur(20px); /* Stronger blur for panel content */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px 24px 0 0; /* Rounded top corners only */
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2); /* Subtle shadow */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%); /* Start off-screen */
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease-out;
}

.dark .ai-conversation-panel {
    background-color: rgba(26, 32, 44, 0.75); /* Darker glassmorphism (gray-900 base) */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

#aiConversationOverlay.visible .ai-conversation-panel {
    transform: translateY(0);
    opacity: 1;
}

.ai-conversation-header {
    flex-shrink: 0;
    padding: 0.75rem 1rem; /* p-3 sm:p-4 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.dark .ai-conversation-header {
    border-bottom: 1px solid rgba(75, 85, 99, 0.3); /* gray-600/30 */
}
.ai-conversation-header h2 {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600;
    color: #374151; /* gray-700 */
}
.dark .ai-conversation-header h2 {
    color: #e5e7eb; /* gray-200 */
}
.ai-conversation-header .close-btn {
    padding: 0.25rem; /* p-1 */
    border-radius: 9999px;
    color: #6b7280; /* gray-500 */
    background: transparent;
    border: none;
    cursor: pointer;
}
.dark .ai-conversation-header .close-btn {
    color: #9ca3af; /* gray-400 */
}
.ai-conversation-header .close-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.dark .ai-conversation-header .close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.ai-conversation-transcript {
    flex-grow: 1;
    padding: 1rem; /* p-4 */
    overflow-y: auto;
    display: flex;
    flex-direction: column; /* Newest messages at the bottom */
    gap: 0.75rem; /* space-y-3 equivalent */
}

.transcript-bubble {
    max-width: 80%;
    padding: 0.5rem 0.75rem; /* py-2 px-3 */
    border-radius: 1rem; /* rounded-xl */
    font-size: 0.875rem; /* text-sm */
    line-height: 1.4;
    word-wrap: break-word;
}

.transcript-bubble.user {
    background-color: #8b5cf6; /* purple-500 */
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem; /* Slightly different rounding */
}
.dark .transcript-bubble.user {
    background-color: #7c3aed; /* purple-600 */
}

.transcript-bubble.ai {
    background-color: rgba(229, 231, 235, 0.8); /* gray-200 with opacity */
    color: #1f2937; /* gray-800 */
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}
.dark .transcript-bubble.ai {
    background-color: rgba(55, 65, 81, 0.8); /* gray-700 with opacity */
    color: #f3f4f6; /* gray-100 */
}

.ai-conversation-input-area {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.dark .ai-conversation-input-area {
    border-top: 1px solid rgba(75, 85, 99, 0.3);
}

.mic-button {
    padding: 0.75rem; /* p-3 */
    border-radius: 9999px;
    background-color: #8b5cf6; /* purple-500 */
    color: white;
    transition: background-color 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.mic-button:hover {
    background-color: #7c3aed; /* purple-600 */
}
.mic-button:active {
    transform: scale(0.95);
}
.mic-button.listening {
    background-color: #ef4444; /* red-500 */
    animation: pulse-mic 1.5s infinite ease-in-out;
}
.dark .mic-button.listening {
    background-color: #dc2626; /* red-600 */
}

@keyframes pulse-mic {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.status-text {
    flex-grow: 1;
    font-size: 0.8rem; /* text-xs */
    color: #6b7280; /* gray-500 */
    text-align: center;
    font-style: italic;
    min-height: 1.2em; /* Ensure it doesn't jump around too much */
}
.dark .status-text {
    color: #9ca3af; /* gray-400 */
}
.status-text.thinking svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.25rem;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar for Transcript */
.ai-conversation-transcript::-webkit-scrollbar {
    width: 5px;
}
.ai-conversation-transcript::-webkit-scrollbar-track {
    background: transparent;
}
.ai-conversation-transcript::-webkit-scrollbar-thumb {
    background-color: rgba(139, 92, 246, 0.3); /* purple-500 with opacity */
    border-radius: 10px;
}
.dark .ai-conversation-transcript::-webkit-scrollbar-thumb {
    background-color: rgba(124, 58, 237, 0.4); /* purple-600 with opacity */
}







/* /mindmap/mapConversationalAgent.css - Add these styles */

#aiVoiceInputPill {
    position: fixed;
    bottom: 20px; /* Adjust as needed */
    left: 50%;
    /* transform: translateX(-50%); */ /* Initial transform done by JS for animation */
    z-index: 999; /* Below main modal (1000), but above most map elements */
    
    background-color: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px; 
    padding: 10px 15px;
    
    display: flex;
    align-items: center;
    gap: 10px;
    
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    
    opacity: 0;
    transform: translateX(-50%) translateY(100%); /* Start off-screen below */
    transition: opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}

.dark #aiVoiceInputPill {
    background-color: rgba(26, 32, 44, 0.75); 
    border-color: rgba(255, 255, 255, 0.1);
}

#aiVoiceInputPill.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.voice-pill-text {
    font-size: 0.875rem; 
    color: #374151; 
    font-weight: 500; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; 
}
.dark .voice-pill-text {
    color: #e5e7eb; 
}

.voice-pill-stop-btn {
    padding: 4px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.05);
    color: #4b5563; 
    transition: background-color 0.2s;
    display: flex; 
    align-items: center;
    justify-content: center;
    border: none; /* ensure no default button border */
    cursor: pointer;
}
.dark .voice-pill-stop-btn {
    background-color: rgba(255,255,255,0.1);
    color: #d1d5db; 
}
.voice-pill-stop-btn:hover {
    background-color: rgba(0,0,0,0.1);
}
.dark .voice-pill-stop-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Voice Wave Animation */
.voice-wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 24px; 
    height: 16px;
}

.voice-wave-bar {
    width: 3px;
    height: 4px; 
    background-color: #8b5cf6; 
    border-radius: 1.5px;
    animation: voiceWave 1.2s ease-in-out infinite alternate;
}
.dark .voice-wave-bar {
    background-color: #a78bfa; 
}

.voice-wave-bar:nth-child(1) { animation-delay: -0.4s; }
.voice-wave-bar:nth-child(2) { animation-delay: -0.2s; }
.voice-wave-bar:nth-child(3) { animation-delay: 0s; }

@keyframes voiceWave {
    0% { height: 4px; opacity: 0.7; }
    50% { height: 16px; opacity: 1; }
    100% { height: 4px; opacity: 0.7; }
}

#aiVoiceInputPill:not(.listening):not(.speaking) .voice-wave-container {
    display: none; 
}
#aiVoiceInputPill:not(.listening):not(.speaking) .static-mic-icon {
    display: block; 
}
.static-mic-icon {
    display: none; 
    color: #8b5cf6; /* purple-500 */
}
.dark .static-mic-icon {
    color: #a78bfa; /* purple-400 */
}

/* Ensure full modal's backdrop is visually distinct from pill's implied one if they overlap */
#aiConversationOverlay { /* This is the full modal's backdrop */
    /* z-index: 1000; */ /* Ensure it's set, already in your CSS */
}