/* Gemini Chatbot Styles */

:root {
    --chatbot-primary: #4285f4;
    --chatbot-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --chatbot-radius: 12px;
}

#gemini-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Popup Notification */
#gemini-chatbot-popup {
    position: absolute;
    bottom: 80px;  /* เพิ่มจาก 70 → 80 */
    right: 0;
    background: white;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 250px;
    animation: popupBounce 0.5s ease;
    z-index: 9998;
}

#gemini-chatbot-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.popup-message {
    font-size: 15px;
    color: #333;
    line-height: 1.4;
    padding-right: 15px;
}

.popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 18px;
    text-align: center;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #333;
}

@keyframes popupBounce {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    50% {
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#gemini-chatbot-button {
    width: 70px;  /* เพิ่มจาก 60 → 70 */
    height: 70px; /* เพิ่มจาก 60 → 70 */
    border-radius: 50%;
    background: var(--chatbot-primary);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#gemini-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

#gemini-chatbot-button svg {
    width: 32px;  /* เพิ่มจาก 28 → 32 */
    height: 32px; /* เพิ่มจาก 28 → 32 */
}

#gemini-chatbot-window {
    position: absolute;
    bottom: 90px;  /* เพิ่มจาก 80 → 90 */
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: var(--chatbot-radius);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

#gemini-chatbot-header {
    background: var(--chatbot-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.chatbot-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chatbot-name {
    font-weight: 600;
    font-size: 16px;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 2s infinite;
}

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

#gemini-chatbot-clear,
#gemini-chatbot-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

#gemini-chatbot-clear:hover,
#gemini-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

#gemini-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

#gemini-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#gemini-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

#gemini-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: messageSlide 0.3s ease;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.bot-message .message-content {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

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

.user-message .message-content {
    background: var(--chatbot-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

#gemini-chatbot-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    align-items: center;
}

#gemini-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#gemini-chatbot-input:focus {
    border-color: var(--chatbot-primary);
}

#gemini-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

#gemini-chatbot-send:hover {
    transform: scale(1.05);
    background: #3b78e7;
}

#gemini-chatbot-send:active {
    transform: scale(0.95);
}

#gemini-chatbot-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: scale(1);
}

.error-message {
    padding: 12px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin: 0 20px;
}

/* Handoff to Human Styles */
#gemini-handoff-bar {
    padding: 10px 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    background: #f8f9fa;
}

.contact-support-btn {
    width: 100%;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.contact-support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.contact-support-btn:active {
    transform: translateY(0);
}

.contact-support-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#gemini-handoff-status {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    font-size: 13px;
    color: #856404;
}

#gemini-handoff-status.active {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

#gemini-handoff-status .handoff-status-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Admin message style */
.message.admin-message {
    display: flex;
    justify-content: flex-start;
}

.message.admin-message .message-content {
    background: #28a745;
    color: white;
}

.message.admin-message .message-avatar {
    background: #28a745;
}

/* System message style */
.message.system-message {
    justify-content: center;
    margin: 15px 0;
}

.message.system-message .message-content {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    text-align: center;
    font-style: italic;
    font-size: 13px;
    max-width: 80%;
}

.message.system-message .message-avatar {
    display: none;
}

/* Responsive */
@media (max-width: 480px) {
    #gemini-chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    #gemini-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }
    
    #gemini-chatbot-button {
        width: 56px;
        height: 56px;
    }
}
