/* White & Blue ChatGPT-Inspired Chatbot Design - Enhanced for Responsiveness */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --brand-color-primary: #3b82f6;
    --brand-color-secondary: #2563eb;
    --text-color-primary: #1f2937;
    --text-color-secondary: #6b7280;
    --background-color-primary: #ffffff;
    --background-color-secondary: #fafafa;
    --border-color: #e5e7eb;
}

.wacf-chatbot-window {
    display: flex;
    flex-direction: column;
    background: var(--background-color-primary) !important;
    border-radius: 12px !important;
    box-shadow: 
        0 4px 24px rgba(59, 130, 246, 0.08),
        0 2px 12px rgba(59, 130, 246, 0.05),
        0 0 0 1px rgba(59, 130, 246, 0.1) !important;
    border: 1px solid var(--border-color) !important;
    overflow: hidden !important;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    transition: all 0.3s ease !important;
    /* Fluid width and height with clamp() */
    width: clamp(320px, 90vw, 1200px) !important;
    height: clamp(500px, 80vh, 800px) !important;
    max-height: 100vh;
}

.wacf-chatbot-window * {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.wacf-chatbot-window:hover {
    box-shadow: 
        0 8px 32px rgba(59, 130, 246, 0.12),
        0 4px 16px rgba(59, 130, 246, 0.08),
        0 0 0 1px rgba(59, 130, 246, 0.15);
}

/* Header */
.wacf-chatbot-header {
    background: var(--background-color-primary);
    border-bottom: 1px solid var(--border-color);
    padding: clamp(16px, 3vw, 24px) clamp(20px, 4vw, 32px);
    position: relative;
    flex-shrink: 0;
}

.wacf-chatbot-title {
    /* Fluid font size */
    font-size: clamp(18px, 2.2vw, 24px);
    font-weight: 600;
    color: var(--text-color-primary);
    margin: 0;
    letter-spacing: -0.2px;
}

.wacf-chatbot-subtitle {
    /* Fluid font size */
    font-size: clamp(14px, 1.8vw, 18px);
    color: var(--text-color-secondary);
    margin: 4px 0 0 0;
    font-weight: 400;
}

/* Chat container */
.wacf-chatbot-messages {
    padding: clamp(16px, 3vw, 32px);
    overflow-y: auto;
    background: var(--background-color-secondary);
    scroll-behavior: smooth;
    flex-grow: 1; /* Allows this element to fill available space */
}


.wacf-chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.wacf-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wacf-chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.wacf-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message bubbles */
.wacf-message {
    margin-bottom: 32px;
    animation: messageSlideIn 0.3s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.wacf-message-user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.wacf-message-bot {
    flex-direction: row;
    justify-content: flex-start;
}

/* Profile Pictures */
.wacf-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wacf-message-user .wacf-message-avatar {
    background: #f8fafc;
    color: var(--brand-color-primary);
    border-color: #e2e8f0;
}

.wacf-message-bot .wacf-message-avatar {
    background: #f8fafc;
    color: var(--text-color-secondary);
    border-color: #e2e8f0;
}

.wacf-message-avatar:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.wacf-message-user .wacf-message-avatar:hover {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
    border-color: #cbd5e1;
}

/* Avatar Images */
.wacf-message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.wacf-message-bubble {
    display: inline-block;
    padding: 16px 20px;
    border-radius: 16px;
    max-width: 85%;
    /* Fluid font size for messages */
    font-size: clamp(15px, 2vw, 18px);
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    transition: all 0.2s ease;
    font-weight: 400;
    margin-top: 2px;
}

.wacf-message-user .wacf-message-bubble {
    background: linear-gradient(135deg, var(--brand-color-primary) 0%, var(--brand-color-secondary) 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.wacf-message-bot .wacf-message-bubble {
    background: var(--background-color-primary);
    color: var(--text-color-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.wacf-message-bubble:hover {
    transform: translateY(-1px);
}

.wacf-message-user .wacf-message-bubble:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.wacf-message-bot .wacf-message-bubble:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

/* Input area */
.wacf-chatbot-input {
    padding: clamp(16px, 3vw, 24px) clamp(20px, 4vw, 32px);
    border-top: 1px solid var(--border-color);
    background: var(--background-color-primary);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.wacf-input-field {
    flex: 1 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 16px !important;
    padding: 16px 20px !important;
    /* Fluid font size */
    font-size: clamp(15px, 2vw, 18px) !important;
    font-weight: 400 !important;
    background: var(--background-color-primary) !important;
    color: var(--text-color-primary) !important;
    outline: none !important;
    transition: all 0.2s ease !important;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    min-height: 56px !important;
    line-height: 1.4 !important;
    resize: none !important;
}

.wacf-input-field:focus {
    border-color: var(--brand-color-primary) !important;
    background: var(--background-color-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.wacf-input-field::placeholder {
    color: #9ca3af !important;
    font-weight: 400 !important;
    opacity: 0.9 !important;
    font-size: clamp(15px, 2vw, 18px) !important;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.wacf-send-button {
    background: linear-gradient(135deg, var(--brand-color-primary) 0%, var(--brand-color-secondary) 100%);
    border: none;
    border-radius: 12px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.wacf-send-button:hover {
    background: linear-gradient(135deg, var(--brand-color-secondary) 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.wacf-send-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.wacf-send-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.wacf-send-button:hover::before {
    left: 100%;
}

.wacf-send-button svg {
    width: 24px;
    height: 24px;
    fill: white;
    z-index: 1;
    position: relative;
}

/* Loading Spinner Styles */
.wacf-loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

.wacf-spinner-svg {
    animation: spinner-rotate 1.5s linear infinite;
    width: 100%;
    height: 100%;
}

.wacf-spinner-circle {
    stroke-dasharray: 80, 200;
    stroke-dashoffset: 0;
    stroke: var(--brand-color-primary);
    stroke-linecap: round;
    animation: spinner-dash 1.5s ease-in-out infinite;
    fill: none;
    stroke-width: 2;
}

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

@keyframes spinner-dash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: -35px;
    }
    100% {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: -124px;
    }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .wacf-chatbot-window {
        border-radius: 0 !important;
        margin: 0;
        width: 100% !important;
        height: 100dvh !important; /* Dynamic viewport height */
        max-height: 100dvh !important;
    }
    
    .wacf-message-bubble {
        max-width: 85%;
    }
    
    .wacf-input-field {
        min-height: 48px !important;
    }
    
    .wacf-send-button {
        width: 48px;
        height: 48px;
    }
    
    .wacf-send-button svg {
        width: 20px;
        height: 20px;
    }
} 