/* Chatbot Widget Stylesheet */
:root {
    --cb-primary: #ef1b27;
    --cb-primary-hover: #d11420;
    --cb-bg-user: #fbebeb;
    --cb-bg-bot: #f1f3f5;
    --cb-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    --cb-radius: 16px;
}

/* Chat Launcher Button - Positioned on the Right */
.chatbot-launcher {
    position: fixed;
    bottom: 90px;
    right: 30px !important;
    left: auto !important;
    width: 60px !important;
    height: 60px !important;
    padding: 0 !important;
    background-color: var(--cb-primary) !important;
    border-radius: 50% !important;
    box-shadow: var(--cb-shadow) !important;
    cursor: pointer !important;
    z-index: 99999 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-launcher:hover {
    transform: scale(1.1) !important;
    background-color: var(--cb-primary-hover) !important;
}

/* Launcher and Send Icons Override - Force visibility and fill */
.chatbot-launcher svg,
.chatbot-send-btn svg {
    width: 24px !important;
    height: 24px !important;
    fill: #ffffff !important;
    display: block !important;
    visibility: visible !important;
    margin: 0 !important;
    padding: 0 !important;
}

.chatbot-launcher svg path,
.chatbot-send-btn svg path {
    fill: #ffffff !important;
    stroke: none !important;
}

/* Chat Container Panel - Positioned on the Right */
.chatbot-panel {
    position: fixed;
    bottom: 165px;
    right: 30px !important;
    left: auto !important;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 190px);
    background-color: #ffffff;
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.chatbot-panel.open {
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.chatbot-panel.form-mode {
    width: min(520px, calc(100vw - 60px));
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--cb-primary), #b31019);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.chatbot-avatar svg {
    width: 20px !important;
    height: 20px !important;
    fill: #ffffff !important;
    display: block !important;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff !important;
    line-height: 1.2;
}

.chatbot-header-text span {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-text span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #2ecc71;
    border-radius: 50%;
}

.chatbot-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chatbot-close-btn:hover {
    opacity: 1;
}

/* Chat Log Body */
.chatbot-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar styles */
.chatbot-body::-webkit-scrollbar {
    width: 6px;
}
.chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* Messages styling */
.chatbot-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.45;
    animation: cb-fade-in 0.25s ease forwards;
}

.chatbot-msg.bot {
    align-self: flex-start;
    background-color: #ffffff;
    color: #333333;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-msg.user {
    align-self: flex-end;
    background-color: var(--cb-primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 5px rgba(239, 27, 39, 0.15);
}

/* Option Buttons - Clean, Professional slate/gray pills */
.chatbot-options-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.chatbot-opt-btn {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
    padding: 10px 14px !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: left !important;
    width: 100% !important;
    display: block !important;
    outline: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.chatbot-opt-btn:hover {
    background-color: var(--cb-primary) !important;
    border-color: var(--cb-primary) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

/* Rich links */
.chatbot-rich-link {
    display: block;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    text-decoration: none !important;
    color: #2d3748 !important;
    transition: border-color 0.2s;
}

.chatbot-rich-link:hover {
    border-color: var(--cb-primary);
}

.chatbot-rich-link strong {
    color: var(--cb-primary);
    display: block;
    font-size: 0.88rem;
    margin-bottom: 3px;
}

.chatbot-rich-link span {
    font-size: 0.78rem;
    color: #718096;
}

.chatbot-portfolio-group {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.chatbot-portfolio-group > strong {
    display: block;
    color: #111827;
    font-size: 0.86rem;
    margin-bottom: 4px;
}

.chatbot-product-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 10px;
    padding: 10px;
    background: #fbfcfd;
}

.chatbot-product-card .chatbot-rich-link {
    margin-top: 0;
    border-color: transparent;
    padding: 0;
    background: transparent;
}

.chatbot-product-card p,
.chatbot-small-note {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.45;
}

.chatbot-quote-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid var(--cb-primary);
    border-radius: 6px;
    background: #ffffff;
    color: var(--cb-primary);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.chatbot-quote-btn:hover {
    background: var(--cb-primary);
    color: #ffffff;
}

.chatbot-faq-result {
    background-color: #ffffff;
    padding: 10px;
    border-left: 3px solid var(--cb-primary);
    border-radius: 4px;
    margin-top: 8px;
    font-size: 0.88rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.chatbot-faq-result strong {
    color: #333333;
    display: block;
    margin-bottom: 4px;
}

.chatbot-faq-result span {
    color: #555555;
}

/* In-chat Lead Form */
.chatbot-lead-form {
    background: #ffffff;
    border-radius: 8px;
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 8px;
    width: 100%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.chatbot-lead-form p {
    margin: 0 0 10px 0;
    font-size: 0.82rem;
    color: #666;
    font-weight: 500;
}

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

.chatbot-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chatbot-form-group label {
    display: block;
    margin-bottom: 4px;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
}

.chatbot-hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.chatbot-form-group input,
.chatbot-form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    background-color: #fbfbfb;
    box-sizing: border-box;
}

.chatbot-form-group input:focus,
.chatbot-form-group textarea:focus {
    border-color: var(--cb-primary);
    background-color: #ffffff;
}

.chatbot-form-submit {
    width: 100%;
    padding: 9px;
    background-color: var(--cb-primary);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.chatbot-form-note {
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.35;
    margin-top: 8px;
    text-align: center;
}

.chatbot-form-success,
.chatbot-form-error {
    font-weight: 700;
    text-align: center;
    padding: 12px 0;
    line-height: 1.45;
}

.chatbot-form-success {
    color: #15803d;
}

.chatbot-form-error {
    color: #ef1b27;
}

/* Chat Input Footer Area */
.chatbot-input-area {
    padding: 12px 16px;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-text-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    background-color: #f8f9fa;
}

.chatbot-text-input:focus {
    border-color: var(--cb-primary);
    background-color: #ffffff;
}

/* Send Button Geometry safety overrides */
.chatbot-send-btn {
    background-color: var(--cb-primary) !important;
    border: none !important;
    color: #ffffff !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0 !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.chatbot-send-btn:hover {
    background-color: var(--cb-primary-hover) !important;
    transform: scale(1.05) !important;
}

/* Keyframes */
@keyframes cb-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background-color: #a0aec0;
    border-radius: 50%;
    display: inline-block;
    animation: cb-typing 1.4s infinite ease-in-out both;
}

.chatbot-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes cb-typing {
    0%, 80%, 100% { 
        transform: scale(0);
    } 
    40% { 
        transform: scale(1.0);
    }
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .chatbot-panel {
        bottom: 140px;
        left: 15px;
        right: 15px;
        width: auto;
        height: calc(100% - 155px);
        max-height: none;
    }
    .chatbot-panel.form-mode {
        width: auto;
    }
    .chatbot-launcher {
        bottom: 75px;
        right: 20px !important;
        left: auto !important;
        width: 50px !important;
        height: 50px !important;
    }
    .chatbot-form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
