/*
 * BrainSpark Digital - Chatbot Widget Styles
 * Anthropic-inspired design with warm cream backgrounds and terracotta accents
 */

/* ====== CSS VARIABLES (inherited from main styles) ====== */
:root {
    --chatbot-primary: #CC6848;
    --chatbot-primary-hover: #b85a3d;
    --chatbot-bg: #FAF7F2;
    --chatbot-bg-secondary: #F0EBE3;
    --chatbot-text: #191919;
    --chatbot-text-secondary: #3D3D3D;
    --chatbot-text-muted: #7A7A7A;
    --chatbot-border: #E5E0D8;
    --chatbot-card-beige: #E8DDD1;
    --chatbot-card-sage: #C5D6CD;
    --chatbot-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --chatbot-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --chatbot-radius-sm: 8px;
    --chatbot-radius: 16px;
    --chatbot-radius-lg: 24px;
    --chatbot-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== CHATBOT CONTAINER ====== */
.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
}

/* ====== FLOATING TOGGLE BUTTON ====== */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(204, 104, 72, 0.4);
    transition: var(--chatbot-transition);
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    background: var(--chatbot-primary-hover);
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(204, 104, 72, 0.5);
}

.chatbot-toggle:active {
    transform: scale(0.98);
}

.chatbot-toggle i {
    font-size: 24px;
    color: #fff;
    transition: var(--chatbot-transition);
}

.chatbot-toggle .chat-icon {
    position: absolute;
}

.chatbot-toggle .close-icon {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.chatbot-container.open .chatbot-toggle .chat-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.chatbot-container.open .chatbot-toggle .close-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Pulse animation for attention - DISABLED */
.chatbot-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--chatbot-primary);
    /* animation: chatbot-pulse 2s infinite; */ /* Disabled pulse */
    z-index: -1;
    opacity: 0; /* Hidden */
}

.chatbot-container.open .chatbot-toggle::before {
    animation: none;
}

@keyframes chatbot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Notification badge - HIDDEN */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #DC2626;
    border-radius: 50%;
    display: none !important; /* Force hide the red notification badge */
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border: 2px solid #fff;
    animation: chatbot-bounce 0.5s ease;
}

@keyframes chatbot-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ====== CHAT WINDOW ====== */
.chatbot-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-radius-lg);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--chatbot-transition);
    border: 1px solid var(--chatbot-border);
}

.chatbot-container.open .chatbot-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ====== CHAT HEADER ====== */
.chatbot-header {
    background: var(--chatbot-primary);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    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;
}

.chatbot-avatar i {
    font-size: 20px;
    color: #fff;
}

.chatbot-header-text h4 {
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 2px 0;
    font-family: 'Inter', sans-serif;
}

.chatbot-header-text p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

.chatbot-header-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--chatbot-transition);
}

.chatbot-header-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chatbot-header-close i {
    color: #fff;
    font-size: 14px;
}

/* ====== CHAT MESSAGES ====== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.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-muted);
}

/* Message bubbles */
.chatbot-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: message-appear 0.3s ease;
}

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

.chatbot-message.bot {
    align-self: flex-start;
}

.chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.chatbot-message.bot .chatbot-message-avatar {
    background: var(--chatbot-card-beige);
}

.chatbot-message.user .chatbot-message-avatar {
    background: var(--chatbot-primary);
}

.chatbot-message-avatar i {
    font-size: 14px;
}

.chatbot-message.bot .chatbot-message-avatar i {
    color: var(--chatbot-text);
}

.chatbot-message.user .chatbot-message-avatar i {
    color: #fff;
}

.chatbot-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbot-message-bubble {
    padding: 12px 16px;
    border-radius: var(--chatbot-radius);
    line-height: 1.5;
}

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

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

.chatbot-message-time {
    font-size: 11px;
    color: var(--chatbot-text-muted);
    padding: 0 4px;
}

.chatbot-message.user .chatbot-message-time {
    text-align: right;
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--chatbot-border);
    border-radius: var(--chatbot-radius);
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: var(--chatbot-text-muted);
    border-radius: 50%;
    animation: typing-dot 1.4s infinite ease-in-out;
}

.chatbot-typing span:nth-child(1) { animation-delay: 0s; }
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* ====== QUICK REPLIES ====== */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 16px;
}

.chatbot-quick-reply {
    background: #fff;
    border: 1px solid var(--chatbot-border);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--chatbot-text);
    cursor: pointer;
    transition: var(--chatbot-transition);
    font-family: 'Inter', sans-serif;
}

.chatbot-quick-reply:hover {
    background: var(--chatbot-primary);
    border-color: var(--chatbot-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--chatbot-shadow-sm);
}

.chatbot-quick-reply i {
    margin-right: 6px;
}

/* ====== CHAT INPUT ====== */
.chatbot-input-area {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid var(--chatbot-border);
    flex-shrink: 0;
    min-height: 68px;
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--chatbot-bg-secondary);
    border-radius: var(--chatbot-radius);
    padding: 8px 12px;
    border: 1px solid var(--chatbot-border);
    transition: var(--chatbot-transition);
}

.chatbot-input-wrapper:focus-within {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(204, 104, 72, 0.1);
}

.chatbot-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--chatbot-text);
    font-family: 'Inter', sans-serif;
    padding: 6px 0;
}

.chatbot-input::placeholder {
    color: var(--chatbot-text-muted);
}

.chatbot-send {
    width: 36px;
    height: 36px;
    background: var(--chatbot-primary);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--chatbot-transition);
    flex-shrink: 0;
}

.chatbot-send:hover {
    background: var(--chatbot-primary-hover);
    transform: scale(1.05);
}

.chatbot-send:disabled {
    background: var(--chatbot-border);
    cursor: not-allowed;
    transform: none;
}

.chatbot-send i {
    color: #fff;
    font-size: 14px;
}

/* ====== LEAD CAPTURE FORM ====== */
.chatbot-form {
    padding: 16px;
    background: var(--chatbot-card-beige);
    border-radius: var(--chatbot-radius);
    margin: 8px 0;
    animation: message-appear 0.3s ease;
}

.chatbot-form h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--chatbot-text);
    margin: 0 0 12px 0;
    font-family: 'Source Serif 4', Georgia, serif;
}

.chatbot-form-group {
    margin-bottom: 12px;
}

.chatbot-form-group:last-of-type {
    margin-bottom: 16px;
}

.chatbot-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--chatbot-text-secondary);
    margin-bottom: 6px;
}

.chatbot-form-group input,
.chatbot-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--chatbot-border);
    border-radius: var(--chatbot-radius-sm);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--chatbot-text);
    background: #fff;
    transition: var(--chatbot-transition);
}

.chatbot-form-group input:focus,
.chatbot-form-group select:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(204, 104, 72, 0.1);
}

.chatbot-form-submit {
    width: 100%;
    padding: 12px;
    background: var(--chatbot-primary);
    color: #fff;
    border: none;
    border-radius: var(--chatbot-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--chatbot-transition);
    font-family: 'Inter', sans-serif;
}

.chatbot-form-submit:hover {
    background: var(--chatbot-primary-hover);
}

.chatbot-form-submit i {
    margin-right: 8px;
}

/* ====== POWERED BY FOOTER ====== */
.chatbot-footer {
    padding: 8px 20px;
    text-align: center;
    font-size: 11px;
    color: var(--chatbot-text-muted);
    background: #fff;
    border-top: 1px solid var(--chatbot-border);
}

.chatbot-footer a {
    color: var(--chatbot-primary);
    text-decoration: none;
    font-weight: 500;
}

.chatbot-footer a:hover {
    text-decoration: underline;
}

/* ====== MOBILE RESPONSIVENESS ====== */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 16px;
        right: 16px;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-toggle i {
        font-size: 22px;
    }
    
    .chatbot-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        border-radius: var(--chatbot-radius-lg) var(--chatbot-radius-lg) 0 0;
    }
    
    .chatbot-container.open .chatbot-toggle {
        position: fixed;
        bottom: 16px;
        right: 16px;
        z-index: 10001;
    }
    
    .chatbot-messages {
        padding: 16px;
    }
    
    .chatbot-quick-replies {
        padding: 0 16px 12px;
    }
    
    .chatbot-input-area {
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    }
}

/* ====== ANIMATIONS ====== */
.chatbot-fade-in {
    animation: chatbot-fade-in 0.3s ease;
}

@keyframes chatbot-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ====== WELCOME MESSAGE STYLES ====== */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
}

.chatbot-welcome-icon {
    width: 60px;
    height: 60px;
    background: var(--chatbot-card-sage);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.chatbot-welcome-icon i {
    font-size: 28px;
    color: var(--chatbot-text);
}

.chatbot-welcome h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--chatbot-text);
    margin: 0 0 8px 0;
    font-family: 'Source Serif 4', Georgia, serif;
}

.chatbot-welcome p {
    font-size: 13px;
    color: var(--chatbot-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ====== SUCCESS STATE ====== */
.chatbot-success {
    text-align: center;
    padding: 24px;
    background: var(--chatbot-card-sage);
    border-radius: var(--chatbot-radius);
    animation: message-appear 0.3s ease;
}

.chatbot-success-icon {
    width: 56px;
    height: 56px;
    background: #4A7C59;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.chatbot-success-icon i {
    font-size: 24px;
    color: #fff;
}

.chatbot-success h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--chatbot-text);
    margin: 0 0 8px 0;
    font-family: 'Source Serif 4', Georgia, serif;
}

.chatbot-success p {
    font-size: 13px;
    color: var(--chatbot-text-secondary);
    margin: 0;
    line-height: 1.5;
}
