/* AI Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10002;
    font-family: 'Poppins', sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57);
    background-size: 300% 300%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 0 rgba(255, 107, 107, 0.7);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: gradientShift 3s ease infinite, pulse 2s infinite;
}

.chat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 50%;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.chat-toggle::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    border-radius: 50%;
    z-index: -1;
    animation: rotate 4s linear infinite;
    opacity: 0.7;
}

.chat-toggle:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.6), 0 0 0 10px rgba(255, 107, 107, 0.1);
    animation-duration: 1.5s;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0% { box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 0 rgba(255, 107, 107, 0.7); }
    70% { box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 10px rgba(255, 107, 107, 0); }
    100% { box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4), 0 0 0 0 rgba(255, 107, 107, 0); }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-toggle:hover::before {
    opacity: 1;
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: transform 0.3s ease;
}

.chat-toggle.active svg {
    transform: rotate(180deg);
}

.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 600px;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 107, 107, 0.1);
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.1));
    border-bottom: 1px solid rgba(255, 107, 107, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.chat-info h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-info p {
    color: #94a3b8;
    font-size: 12px;
    margin: 2px 0 0 0;
}

.chat-messages {
    flex: 1;
    padding: 15px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 107, 0.3) transparent;
    max-height: calc(100% - 140px);
}

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 107, 0.5);
    border-radius: 2px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    animation: messageSlide 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.bot {
    align-self: flex-start;
    background: rgba(31, 41, 55, 0.8);
    color: #e5e7eb;
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-bottom-left-radius: 6px;
}

.message.bot strong {
    color: #60a5fa;
}

.typing-indicator {
    align-self: flex-start;
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-input-container {
    padding: 16px 20px 20px 20px;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(17, 24, 39, 0.5);
}

.chat-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 4px;
    background: rgba(31, 41, 55, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.chat-type-option {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chat-type-option.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.chat-type-option:hover:not(.active) {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.chat-type-option svg {
    width: 14px;
    height: 14px;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
}

.chat-input {
    flex: 1;
    background: linear-gradient(145deg, #2d1810, #1a0f08);
    border: 3px solid #8b4513;
    border-radius: 25px;
    padding: 16px 100px 16px 20px;
    color: #f4e4bc;
    font-size: 14px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    max-height: 100px;
    min-height: 52px;
    line-height: 1.5;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.6),
        0 1px 3px rgba(139, 69, 19, 0.3),
        0 0 0 1px rgba(139, 69, 19, 0.2);
    position: relative;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(139, 69, 19, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(160, 82, 45, 0.1) 0%, transparent 50%),
        linear-gradient(90deg, transparent 0%, rgba(139, 69, 19, 0.05) 50%, transparent 100%);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-input::-webkit-scrollbar {
    display: none;
}

.chat-input:focus {
    border-color: #cd853f;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.6),
        0 1px 3px rgba(139, 69, 19, 0.5),
        0 0 0 2px rgba(205, 133, 63, 0.3),
        0 0 15px rgba(205, 133, 63, 0.2);
}

.chat-input::placeholder {
    color: #a0845c;
    font-style: italic;
}

.voice-btn {
    position: absolute;
    right: 100px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.stop-voice-btn {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.stop-voice-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.stop-voice-btn svg {
    width: 16px;
    height: 16px;
    color: white;
}

.voice-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.voice-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: pulseRecord 1.5s infinite;
}

.voice-btn.recording:hover {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

@keyframes pulseRecord {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.15); }
    100% { transform: translateY(-50%) scale(1); }
}

.voice-btn svg {
    width: 18px;
    height: 18px;
    color: white;
}

.chat-send {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.chat-send:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.chat-send svg {
    width: 18px;
    height: 18px;
    color: white;
}

.voice-controls {
    position: absolute;
    bottom: -24px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.voice-status {
    font-size: 11px;
    color: #94a3b8;
    background: rgba(17, 24, 39, 0.9);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(75, 85, 99, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    max-width: 200px;
    text-align: center;
    opacity: 0;
    transform: translateY(5px);
}

.voice-status:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.voice-status.listening {
    color: #10b981;
    font-weight: 600;
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
}

.voice-status.error {
    color: #ef4444;
    font-weight: 500;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
}

.welcome-message {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    padding: 20px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
    transition: all 0.3s ease;
}

.welcome-message.hidden {
    display: none;
}

.welcome-message p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.5;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-action {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    color: #60a5fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

/* Feedback Buttons Styles */
.feedback-buttons {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.feedback-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.feedback-label {
    font-size: 11px;
    color: #888;
}

.feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 30px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-btn:hover {
    background-color: #f5f5f5;
    transform: scale(1.1);
}

.feedback-btn.positive:hover {
    background-color: #e8f5e8;
    border-color: #4caf50;
}

.feedback-btn.negative:hover {
    background-color: #ffeaea;
    border-color: #f44336;
}

.feedback-recorded {
    color: #4caf50;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.response-source {
    font-size: 10px;
    color: #999;
    margin-left: auto;
    padding: 2px 6px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100vw - 30px);
        height: 75vh;
        bottom: 90px;
        left: 15px;
        right: 15px;
        border-radius: 15px;
        z-index: 10002;
    }
    
    .chat-widget {
        bottom: 20px;
        left: 20px;
        right: auto;
        z-index: 10002;
    }
    
    .chat-toggle {
        bottom: 20px;
        left: 20px;
        right: auto;
        z-index: 10002;
    }
    
    .welcome-message {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .quick-actions {
        gap: 8px;
    }
    
    .quick-action {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .chat-type-selector {
        gap: 6px;
        padding: 3px;
    }
    
    .chat-type-option {
        padding: 6px 8px;
        font-size: 11px;
        gap: 4px;
    }
    
    .chat-type-option svg {
        width: 12px;
        height: 12px;
    }
    
    .chat-input {
        padding: 12px 50px 12px 14px;
        font-size: 13px;
    }
    
    .voice-btn, .chat-send {
        width: 32px;
        height: 32px;
    }
    
    .voice-btn {
        right: 50px;
    }
    
    .voice-btn svg, .chat-send svg {
        width: 16px;
        height: 16px;
    }
    
    .feedback-container {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .feedback-btn {
        font-size: 12px;
        min-width: 26px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 80px;
        left: 10px;
        right: 10px;
        z-index: 10002;
    }
    
    .chat-widget {
        bottom: 15px;
        left: 15px;
        right: auto;
        z-index: 10002;
    }
    
    .chat-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chat-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    .chat-type-option {
        padding: 5px 6px;
        font-size: 10px;
    }
    
    .chat-input {
        padding: 10px 45px 10px 12px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .voice-btn, .chat-send {
        width: 28px;
        height: 28px;
    }
    
    .voice-btn {
        right: 40px;
    }
    
    .voice-btn svg, .chat-send svg {
        width: 14px;
        height: 14px;
    }
    
    .voice-status {
        font-size: 10px;
        padding: 3px 6px;
    }
}