/* KrooBot Widget Styles */
.kroobot-widget {
    position: fixed;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* Widget Position Classes */
.kroobot-widget-bottom-right {
    bottom: 20px;
    right: 20px;
}

.kroobot-widget-bottom-left {
    bottom: 20px;
    left: 20px;
}

.kroobot-widget-top-right {
    top: 20px;
    right: 20px;
}

.kroobot-widget-top-left {
    top: 20px;
    left: 20px;
}

.kroobot-widget-open {
    display: flex;
}

.kroobot-widget-header {
    background: var(--widget-color, #3b82f6);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.kroobot-widget-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.kroobot-widget-icon {
    font-size: 20px;
}

.kroobot-widget-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kroobot-widget-mode-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kroobot-widget-mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.kroobot-widget-mode-btn.active {
    background: rgba(255, 255, 255, 0.4);
}

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

.kroobot-widget-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.kroobot-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kroobot-widget-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kroobot-widget-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.kroobot-widget-message-user {
    align-self: flex-end;
    background: var(--widget-color, #3b82f6);
    color: white;
    border-bottom-right-radius: 6px;
}

.kroobot-widget-message-user::after {
    content: "";
    position: absolute;
    bottom: -5px;
    right: -5px;
    font-size: 12px;
    background: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.kroobot-widget-message-bot {
    align-self: flex-start;
    background: #f3f4f6;
    color: #374151;
    border-bottom-left-radius: 6px;
}

.kroobot-widget-message-bot::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: -5px;
    font-size: 12px;
    background: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.kroobot-widget-message-error {
    align-self: center;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
}

.kroobot-widget-message-system {
    align-self: center;
    background: #fef3c7;
    color: #d97706;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

.kroobot-widget-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.kroobot-widget-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.kroobot-widget-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.kroobot-widget-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.kroobot-widget-input-area {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.kroobot-widget-text-mode {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#kroobotMessageInput {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 15px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#kroobotMessageInput:focus {
    border-color: var(--widget-color, #3b82f6);
}

.kroobot-widget-send-btn {
    background: var(--widget-color, #3b82f6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.kroobot-widget-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.kroobot-widget-voice-mode {
    text-align: center;
}

.kroobot-widget-voice-controls {
    margin-bottom: 15px;
}

.kroobot-widget-voice-btn {
    background: var(--widget-color, #3b82f6);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.kroobot-widget-voice-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.kroobot-widget-voice-btn.recording {
    background: #dc2626;
    animation: pulse 1.5s infinite;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

@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); }
}

.kroobot-widget-voice-status {
    font-size: 14px;
    color: #6b7280;
    margin-top: 5px;
    text-align: center;
    font-weight: 500;
}

.kroobot-widget-voice-indicator {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f3f4f6;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s;
    border: 2px solid #e5e7eb;
}

.kroobot-widget-voice-indicator.recording {
    background: #dc2626;
    color: white;
    animation: pulse 1.5s infinite;
    border-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

/* Audio Player Styles */
.kroobot-widget-audio-player {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.kroobot-widget-audio-player.playing {
    box-shadow: 0 0 0 2px var(--widget-color, #3b82f6);
    background: #eff6ff;
}

.kroobot-widget-audio-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 14px;
    animation: pulse 1.5s infinite;
}

.kroobot-widget-audio-indicator.playing {
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Voice Button Improvements */
.kroobot-widget-voice-btn {
    background: var(--widget-color, #3b82f6);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.kroobot-widget-voice-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.kroobot-widget-voice-btn.recording {
    background: #dc2626;
    animation: pulse 1.5s infinite;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Audio Controls Enhancement */
.kroobot-widget-audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.kroobot-widget-audio-controls button {
    background: var(--widget-color, #3b82f6);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.kroobot-widget-audio-controls button:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.kroobot-widget-toggle {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Toggle Button Position Classes */
.kroobot-widget-toggle-bottom-right {
    bottom: 20px;
    right: 20px;
}

.kroobot-widget-toggle-bottom-left {
    bottom: 20px;
    left: 20px;
}

.kroobot-widget-toggle-top-right {
    top: 20px;
    right: 20px;
}

.kroobot-widget-toggle-top-left {
    top: 20px;
    left: 20px;
}

.kroobot-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.kroobot-widget-toggle-icon {
    color: white;
}

/* Responsive Design */
@media (max-width: 480px) {
    .kroobot-widget {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        left: 20px;
        right: 20px;
    }
    
    .kroobot-widget-bottom-right,
    .kroobot-widget-bottom-left {
        bottom: 10px;
    }
    
    .kroobot-widget-top-right,
    .kroobot-widget-top-left {
        top: 10px;
    }
    
    .kroobot-widget-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Scrollbar Styling */
.kroobot-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.kroobot-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.kroobot-widget-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.kroobot-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Loading States */
.kroobot-widget-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Error States */
.kroobot-widget-error {
    border-color: #dc2626;
}

/* Success States */
.kroobot-widget-success {
    border-color: #059669;
} 

/* Voice chat states */
.kroobot-widget-voice-btn.active {
    background: #28a745 !important;
    color: white !important;
}

.kroobot-widget-voice-btn.listening {
    background: #dc3545 !important;
    animation: pulse 1.5s infinite;
}

.kroobot-widget-voice-btn.processing {
    background: #ffc107 !important;
    color: #212529 !important;
}

.kroobot-widget-voice-btn.speaking {
    background: #17a2b8 !important;
    color: white !important;
}

.kroobot-widget-voice-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
}

.kroobot-widget-voice-indicator.active {
    display: flex;
}

.kroobot-widget-voice-indicator::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dc3545;
    animation: voice-pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes voice-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
} 