/* Chatbot Widget Styles - Complete Working Version WITH STOP SPEAKING */
#ms-chatbot-widget-container {
    position: fixed;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    bottom: 20px;
    right: 20px;
}

#ms-chatbot-bubble {
    width: 60px;
    height: 60px;
    background: #007cba;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    font-size: 24px;
}

#ms-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
}

#ms-chatbot-window.active {
    display: flex;
}

.ms-chatbot-header {
    background: #007cba;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.ms-chatbot-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.ms-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === FIX FOR LANGUAGE DROPDOWN HEIGHT ISSUE === */
.ms-chatbot-language-section {
    max-height: 120px; /* Limit height */
    overflow-y: auto; /* Make it scrollable */
    padding: 10px 20px; /* Reduce padding */
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0; /* Don't shrink */
}

.ms-chatbot-language-selectors {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduce gap */
}

.ms-chatbot-language-group {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Reduce gap */
}

.ms-chatbot-language-group label {
    font-size: 11px; /* Smaller label */
    margin-bottom: 2px;
    font-weight: 600;
    color: #555;
}

.ms-chatbot-input-lang,
.ms-chatbot-output-lang {
    font-size: 12px; /* Smaller font */
    padding: 6px 8px; /* Smaller padding */
    height: 32px; /* Fixed height */
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.ms-chatbot-language-info {
    font-size: 10px; /* Smaller info text */
    padding: 4px;
    margin-top: 2px;
    text-align: center;
    color: #666;
}

.ms-chatbot-messages {
    flex: 1; /* Take available space */
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 150px;
}

.ms-chatbot-message {
    display: flex;
}

.ms-chatbot-message.user {
    justify-content: flex-end;
}

.ms-chatbot-message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.ms-chatbot-message.user .ms-chatbot-message-bubble {
    background: #007cba;
    color: white;
    border-bottom-right-radius: 6px;
}

.ms-chatbot-message.bot .ms-chatbot-message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 6px;
}

.ms-chatbot-input-area {
    padding: 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
    flex-shrink: 0; /* Don't shrink */
    margin-top: auto; /* Push to bottom */
}

.ms-chatbot-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.ms-chatbot-subject,
.ms-chatbot-user-name,
.ms-chatbot-user-email {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    height: 48px;
    box-sizing: border-box;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.ms-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    height: 48px;
    box-sizing: border-box;
}

.ms-chatbot-send {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    height: 48px;
    min-width: 80px;
}

.ms-chatbot-send:hover {
    background: #005a87;
    transform: scale(1.05);
}

.ms-chatbot-subject-info {
    text-align: center;
    padding: 10px 0;
    font-size: 13px;
    color: #666;
}

/* Input Method Section */
.ms-chatbot-input-method {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0;
}

.input-method-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.method-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
    justify-content: center;
    background: white;
}

.method-option input[type="radio"] {
    display: none;
}

/* Fixed: Replace :has() selector with JavaScript-compatible alternative */
.method-option input[type="radio"]:checked + .method-icon,
.method-option input[type="radio"]:checked ~ .method-label {
    color: #007cba;
}

.method-option input[type="radio"]:checked {
    border-color: #007cba;
    background-color: #e7f3ff;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.method-icon {
    font-size: 16px;
}

.method-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Voice Settings Toggle */
.voice-settings-toggle {
    margin-top: 10px;
}

.voice-settings-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.voice-settings-btn:hover {
    background: #e9ecef;
    border-color: #007cba;
}

.voice-settings-btn.active {
    background: #e7f3ff;
    border-color: #007cba;
    color: #007cba;
}

.settings-icon {
    font-size: 14px;
}

.settings-label {
    font-weight: 500;
}

.toggle-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.voice-settings-btn.active .toggle-arrow {
    transform: rotate(180deg);
}

/* Voice Settings Panel */
.voice-settings-panel {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    animation: slideDown 0.3s ease;
}

/* Compact Settings Row */
.compact-settings-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
}

.compact-setting-group {
    flex: 1;
}

.compact-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    display: block;
}

.compact-options {
    display: flex;
    gap: 6px;
}

.compact-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    background: #f8f9fa;
    font-size: 11px;
}

.compact-option input[type="radio"] {
    margin: 0;
}

/* Fixed: Replace :has() selector with JavaScript-compatible alternative */
.compact-option input[type="radio"]:checked {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.compact-option input[type="radio"]:checked + span {
    color: #007cba;
    font-weight: 600;
}

/* Read Aloud Compact */
.read-aloud-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-size: 11px;
    height: 28px;
}

.read-aloud-compact input[type="checkbox"] {
    display: none;
}

/* Fixed: Replace :has() selector with JavaScript-compatible alternative */
.read-aloud-compact input[type="checkbox"]:checked {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.read-aloud-text {
    font-weight: 500;
}

.checkmark {
    width: 14px;
    height: 14px;
    border: 2px solid #d1d5db;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Fixed: Replace :has() selector with JavaScript-compatible alternative */
.read-aloud-compact input[type="checkbox"]:checked + .checkmark {
    background: #007cba;
    border-color: #007cba;
}

/* Fixed: Replace :has() selector with JavaScript-compatible alternative */
.read-aloud-compact input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    color: white;
    font-size: 10px;
    font-weight: bold;
}

/* Voice Selection Compact */
.voice-selection-compact {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e1e5e9;
}

.voice-selection-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voice-select-compact {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    background: white;
    height: 28px;
}

.voice-test-btn {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
    height: 28px;
}

.voice-test-btn:hover {
    background: #218838;
}

.voice-test-btn.playing {
    background: #dc2626;
}

.test-icon {
    font-size: 10px;
}

/* === ADD STOP SPEAKING BUTTON STYLES === */
.voice-stop-btn {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
    height: 28px;
    margin-left: 8px;
}

.voice-stop-btn:hover {
    background: #b91c1c;
}

.voice-stop-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Speaking indicator in chat messages */
.ms-chatbot-message.bot .speaking-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 8px;
    background: #e3f2fd;
    border-radius: 12px;
    font-size: 10px;
    color: #1976d2;
}

.speaking-dots {
    display: flex;
    gap: 2px;
}

.speaking-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #1976d2;
    animation: speakingPulse 1.4s ease-in-out infinite both;
}

.speaking-dot:nth-child(1) { animation-delay: -0.32s; }
.speaking-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes speakingPulse {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Voice Input Compact */
.voice-input-compact {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e1e5e9;
}

.voice-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.voice-input-btn-compact {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    flex: 1;
}

.voice-input-btn-compact:hover {
    background: #005a87;
}

.voice-input-btn-compact.listening {
    background: #dc2626;
    animation: pulse 1.5s infinite;
}

.voice-input-feedback-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #e3f2fd;
    border-radius: 4px;
    font-size: 11px;
    color: #1976d2;
    flex: 1;
}

.voice-pulse {
    width: 8px;
    height: 8px;
    background: #2196f3;
    border-radius: 50%;
    animation: voicePulse 1.4s ease-in-out infinite both;
}

/* Voice Status */
.voice-status-message {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    background: #f8f9fa;
    font-size: 11px;
    text-align: center;
}

.voice-status-ready {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.voice-status-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.voice-status-loading {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Animations */
@keyframes voicePulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive design */
@media (max-width: 480px) {
    #ms-chatbot-window {
        width: 95vw;
        height: 80vh;
        right: 2.5vw;
    }
    
    .compact-settings-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .voice-selection-row {
        flex-direction: column;
    }
    
    .ms-chatbot-input-row {
        flex-direction: column;
    }
    
    .ms-chatbot-subject,
    .ms-chatbot-user-name,
    .ms-chatbot-user-email,
    .ms-chatbot-input,
    .ms-chatbot-send {
        height: 44px;
    }
    
    .ms-chatbot-language-section {
        max-height: 100px;
        padding: 8px 15px;
    }
}

/* Additional JavaScript-based styling for checked states */
.method-option.checked {
    border-color: #007cba;
    background-color: #e7f3ff;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.compact-option.checked {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.read-aloud-compact.checked {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.read-aloud-compact.checked .checkmark {
    background: #007cba;
    border-color: #007cba;
}

.read-aloud-compact.checked .checkmark::after {
    content: "✓";
    color: white;
    font-size: 10px;
    font-weight: bold;
}

/* === ADD THIS CSS === */
/* Continue button state */
.voice-test-btn.continue {
    background: #f59e0b;
    color: white;
}

.voice-test-btn.continue:hover {
    background: #d97706;
}

/* Paused state indicator */
.ms-chatbot-message.bot .speaking-indicator.paused {
    background: #fef3c7;
    color: #d97706;
}

.speaking-indicator.paused .speaking-dot {
    background: #d97706;
    animation: none;
    opacity: 0.5;
}




