/* ============================================
   CBRIAN - Chatbot Widget Styles
   ============================================ */

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --chatbot-primary: #2563eb;
    --chatbot-primary-dark: #1d4ed8;
    --chatbot-secondary: #06b6d4;
    --chatbot-accent: #a855f7;
    --chatbot-bg: #ffffff;
    --chatbot-surface: #f8fafc;
    --chatbot-border: #e2e8f0;
    --chatbot-text: #1e293b;
    --chatbot-text-light: #64748b;
    --chatbot-shadow: rgba(0, 0, 0, 0.1);
    --chatbot-shadow-lg: rgba(0, 0, 0, 0.15);
    --chatbot-user-bg: #2563eb;
    --chatbot-user-text: #ffffff;
    --chatbot-bot-bg: #f1f5f9;
    --chatbot-bot-text: #1e293b;
}

/* ============================================
   FLOATING CHAT BUTTON
   ============================================ */
#chatbot-button {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px var(--chatbot-shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 999;
}

#chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--chatbot-shadow-lg);
}

#chatbot-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

#chatbot-button.pulse {
    animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px var(--chatbot-shadow-lg);
    }
    50% {
        box-shadow: 0 4px 12px var(--chatbot-shadow-lg), 0 0 0 10px rgba(37, 99, 235, 0.1);
    }
}

#chatbot-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Notification badge (optional) */
#chatbot-button::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#chatbot-button.has-notification::after {
    opacity: 1;
}

/* ============================================
   CHAT WIDGET CONTAINER
   ============================================ */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: var(--chatbot-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--chatbot-shadow-lg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

#chatbot-widget.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ============================================
   CHAT HEADER
   ============================================ */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.chatbot-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.chatbot-title p {
    font-size: 12px;
    margin: 0;
    opacity: 0.9;
}

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

.chatbot-header-actions button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.chatbot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-header-actions svg {
    width: 16px;
    height: 16px;
    fill: white;
}

/* ============================================
   CHAT MESSAGES
   ============================================ */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chatbot-surface);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

#chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-border);
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--chatbot-text-light);
}

/* ============================================
   MESSAGE BUBBLES
   ============================================ */
.chatbot-message {
    display: flex;
    margin-bottom: 8px;
}

.chatbot-message-user {
    justify-content: flex-end;
}

.chatbot-message-bot {
    justify-content: flex-start;
}

.chatbot-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-bubble {
    background: var(--chatbot-user-bg);
    color: var(--chatbot-user-text);
    border-bottom-right-radius: 4px;
}

.chatbot-message-bot .chatbot-bubble {
    background: var(--chatbot-bot-bg);
    color: var(--chatbot-bot-text);
    border-bottom-left-radius: 4px;
}

/* Message animation */
.chatbot-message-animate {
    animation: chatbot-message-slide 0.3s ease;
}

@keyframes chatbot-message-slide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.chatbot-typing-indicator .chatbot-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.chatbot-typing-indicator .chatbot-bubble span {
    width: 8px;
    height: 8px;
    background: var(--chatbot-text-light);
    border-radius: 50%;
    animation: chatbot-typing 1.4s infinite;
}

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

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

@keyframes chatbot-typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* ============================================
   CHAT INPUT FORM
   ============================================ */
.chatbot-footer {
    padding: 16px;
    background: var(--chatbot-bg);
    border-top: 1px solid var(--chatbot-border);
}

#chatbot-form {
    display: flex;
    gap: 8px;
}

#chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

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

#chatbot-input::placeholder {
    color: var(--chatbot-text-light);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--chatbot-shadow);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    #chatbot-button {
        bottom: 90px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    #chatbot-button svg {
        width: 24px;
        height: 24px;
    }

    #chatbot-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chatbot-bubble {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .chatbot-header {
        padding: 16px;
    }

    #chatbot-messages {
        padding: 16px;
    }

    .chatbot-footer {
        padding: 12px;
    }

    .chatbot-bubble {
        font-size: 13px;
    }
}

/* ============================================
   DARK MODE (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --chatbot-bg: #1e293b;
        --chatbot-surface: #0f172a;
        --chatbot-border: #334155;
        --chatbot-text: #f1f5f9;
        --chatbot-text-light: #94a3b8;
        --chatbot-bot-bg: #334155;
        --chatbot-bot-text: #f1f5f9;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    #chatbot-button,
    #chatbot-widget,
    .chatbot-message-animate {
        animation: none;
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
#chatbot-button:focus-visible,
.chatbot-header-actions button:focus-visible,
.chatbot-send-btn:focus-visible {
    outline: 2px solid var(--chatbot-primary);
    outline-offset: 2px;
}

#chatbot-input:focus-visible {
    outline: 2px solid var(--chatbot-primary);
    outline-offset: 0;
}
