/* ================================================================
   Custom Chatbot Frontend Styles - Clean & Minimal
   ================================================================ */

/* ================================================================
   CSS Variables
   WCAG AA Compliance: All text colors meet minimum 4.5:1 contrast ratio
   ================================================================ */
:root {
    /* Primary Colors - Ensure sufficient contrast when used with text */
    --chatbot-primary: #F15A29;
    --chatbot-primary-dark: #D94E23;
    
    /* Background Colors */
    --chatbot-bg: #FFFFFF;
    --chatbot-input-bg: #F5F5F5;
    
    /* Text Colors - WCAG AA compliant (4.5:1+ contrast on white) */
    --chatbot-text: #2C2C2E; /* 12.6:1 contrast ratio */
    --chatbot-text-light: #8E8E93; /* 3.7:1 - use sparingly, ensure 4.5:1 where required */
    --chatbot-text-inverse: #FFFFFF; /* Used on dark backgrounds */
    
    /* Bot Message - WCAG AA compliant */
    --chatbot-bot-bg: #2C2C2E; /* Dark background */
    --chatbot-bot-text: #FFFFFF; /* 12.6:1 contrast ratio on dark */
    
    /* User Message - WCAG AA compliant */
    --chatbot-user-bg: #E9E9EB; /* Light background */
    --chatbot-user-text: #2C2C2E; /* 12.6:1 contrast ratio on light */
    
    /* Border */
    --chatbot-border: #E5E5EA;
    
    /* Shadow */
    --chatbot-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    
    /* Avatar */
    --chatbot-avatar-bg: #6366F1;
}

/* ================================================================
   Base Container
   ================================================================ */
.customchatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-align: right;
}

.customchatbot-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}
/* .customchatbot-header-avatar img {
    width: 100%;
    border-radius: 50%;
} */
.customchatbot-container.position-bottom-left .customchatbot-wrapper,
.customchatbot-container.position-top-left .customchatbot-wrapper {
    align-items: flex-start;
}

.customchatbot-container.position-bottom-left {
    right: auto;
    left: 20px;
    text-align: left;
}

.customchatbot-container.position-top-right {
    bottom: auto;
    top: 20px;
    text-align: right;
}
.customchatbot-message-avatar img {
     width: 100%;
    border-radius: 50%;
}
.customchatbot-container.position-top-left {
    bottom: auto;
    right: auto;
    top: 20px;
    left: 20px;
    text-align: left;
}

/* ================================================================
   Toggle Button
   ================================================================ */
#customchatbot-toggle.customchatbot-toggle {
    background: var(--toggle-bg-color, var(--chatbot-primary));
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.1);
}

#customchatbot-toggle.customchatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25), 0 6px 12px rgba(0, 0, 0, 0.15);
}

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

#customchatbot-toggle.customchatbot-toggle-fab {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
}

#customchatbot-toggle.customchatbot-toggle-pill {
    width: auto;
    height: auto;
    padding: 12px 18px;
    border-radius: 999px;
    gap: 10px;
}

.customchatbot-toggle-text {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.customchatbot-toggle-icon {
    width: 22px;
    height: 22px;
    color: #fff;
    fill: none;
    stroke: currentColor;
    flex-shrink: 0;
}

.customchatbot-icon-close {
    display: none;
}

.customchatbot-open .customchatbot-icon-main {
    display: none;
}

.customchatbot-open .customchatbot-icon-close {
    display: block;
}

/* Hide text when open to mimic Podium */
.customchatbot-open .customchatbot-toggle-text {
    display: none;
}

/* Make pill toggle circular when open */
.customchatbot-open #customchatbot-toggle.customchatbot-toggle-pill {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
}
#customchatbot-close {
    padding: 0 10px 0 10px;
}
/* ================================================================
   Chat Window
   ================================================================ */
.customchatbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 60vh;
    background: white;
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.customchatbot-window.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.customchatbot-window.size-small {
    width: 320px;
    height: 500px;
}

.customchatbot-window.size-large {
    width: 400px;
    height: 650px;
}

/* ================================================================
   Header
   ================================================================ */
.customchatbot-header {
    background: var(--chatbot-header-bg, #ffffff);
    border-bottom: 1px solid var(--chatbot-border);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customchatbot-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.customchatbot-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chatbot-avatar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.customchatbot-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--chatbot-text);
    font-family: inherit;
}
.customchatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.customchatbot-signin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: var(--chatbot-primary);
    color: var(--chatbot-text-inverse);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.1;
    transition: background 0.15s ease, transform 0.15s ease;
}
.customchatbot-signin-btn:hover {
    background: var(--chatbot-primary-dark);
    transform: translateY(-1px);
}
.customchatbot-signin-btn:focus-visible {
    outline: 2px solid var(--chatbot-primary-dark);
    outline-offset: 2px;
}
/* .customchatbot-header-avatar .emoji {
    display: none !important;
} */
.customchatbot-header-avatar img {
     width: 100%;
    border-radius: 50%;
}
.customchatbot-close {
    background: transparent;
    border: none;
    color: var(--chatbot-text-light);
    font-size: 20px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.customchatbot-close:hover {
    background: var(--chatbot-input-bg);
    color: var(--chatbot-text);
}

/* ================================================================
   Messages Container
   ================================================================ */
.customchatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: var(--chatbot-bg);
    font-family: inherit;
}
#customchatbot-input {
    font-family: inherit;
    font-size: 14px;
}
#customchatbot-close span {
    color: #fff;
}
.customchatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.customchatbot-messages::-webkit-scrollbar-thumb {
    background: #D1D1D6;
    border-radius: 10px;
}

.customchatbot-cta {
    position: relative;
    display: inline-flex;
    align-items: flex-start;
    gap: 14px;
    max-width: 320px;
    padding: 16px 18px 16px 16px;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
    color: var(--chatbot-text);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    margin-bottom: 14px;
}

.customchatbot-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.22);
}

.customchatbot-cta:focus {
    outline: 2px solid var(--chatbot-primary);
    outline-offset: 2px;
}

.customchatbot-cta.is-hidden {
    display: none !important;
}

.customchatbot-cta-media {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--chatbot-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 20px;
    overflow: hidden;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.18);
}

.customchatbot-cta-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.customchatbot-cta-media span {
    font-size: 20px;
}

.customchatbot-cta-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    flex: 1;
}

.customchatbot-cta-name {
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--chatbot-text-light);
    font-weight: 600;
}

.customchatbot-cta-message {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.45;
}

.customchatbot-cta-headline {
    font-size: 16px;
    font-weight: 600;
    color: var(--chatbot-text);
}

.customchatbot-cta-subheadline {
    font-size: 14px;
    color: var(--chatbot-text-light);
}

.customchatbot-cta-action {
    margin-top: 6px;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--chatbot-primary);
    background: rgba(241, 90, 41, 0.08);
    padding: 6px 12px;
    border-radius: 999px;
}

.customchatbot-cta-dismiss {
    background: transparent;
    border: none;
    color: var(--chatbot-text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
    position: absolute;
    top: 10px;
    right: 12px;
}

.customchatbot-cta-dismiss:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--chatbot-text);
}

.customchatbot-cta.is-active {
    box-shadow: 0 26px 60px rgba(241, 90, 41, 0.28);
}

.customchatbot-cta-action-icon {
    width: 14px;
    height: 14px;
}

/* ================================================================
   Messages
   ================================================================ */
.customchatbot-message {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    animation: fadeIn 0.2s ease;
    opacity: 0;
    animation-fill-mode: forwards;
}

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

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

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

/* Message Avatar */
.customchatbot-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    align-self: flex-end;
}

.customchatbot-message.bot .customchatbot-message-avatar {
/*     background: var(--chatbot-avatar-bg); */
	background: #293432;
    color: #293432;
}

/* Message Content */
.customchatbot-message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

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

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

/* ================================================================
   Typing Indicator
   ================================================================ */
.customchatbot-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: var(--chatbot-bot-bg);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.customchatbot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: typing 1.4s infinite ease-in-out;
}

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

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

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

/* ================================================================
   Input Container
   ================================================================ */
.customchatbot-input-container {
    display: flex;
    padding: 12px 14px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    gap: 8px;
    align-items: center;
}

/* Input Field */
.customchatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--chatbot-border);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: var(--chatbot-input-bg);
    color: var(--chatbot-text);
    min-height: 40px;
    transition: all 0.15s ease;
}

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

.customchatbot-input:focus {
    border-color: var(--chatbot-primary);
    background: white;
}

.customchatbot-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Validation states */
.customchatbot-input-valid {
    border-color: #10B981 !important;
    background: rgba(16, 185, 129, 0.05) !important;
}

.customchatbot-input-valid:focus {
    border-color: #10B981 !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.customchatbot-input-invalid {
    border-color: #EF4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.customchatbot-input-invalid:focus {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Send Button */
.customchatbot-send {
    width: 36px;
    height: 100%;
    background: var(--chatbot-primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

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

.customchatbot-send:active {
    transform: scale(0.95);
}

.customchatbot-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#customchatbot-send-text {
    display: none;
}

.customchatbot-send-icon {
    font-size: 16px;
}
#customchatbot-send {
    padding: 0 20px 0 20px;
}
/* ================================================================
   Error Messages
   ================================================================ */
.customchatbot-error {
    padding: 10px 12px;
    background: #FEE;
    color: #C33;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
	text-align:center;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 480px) {
    .customchatbot-container {
        bottom: 170px;
        right: 0;
        left: 0;
    }
    
    .customchatbot-cta {
        max-width: calc(100% - 40px);
        margin: 0 auto;
        align-self: center;
        /* Improve touch target size */
        min-height: 44px;
    }
    
    #customchatbot-toggle.customchatbot-toggle {
        position: fixed;
        bottom: 86px;
        right: 20px;
        /* Ensure minimum touch target size (44x44px) */
        min-width: 44px;
        min-height: 44px;
        /* Improve touch feedback */
        -webkit-tap-highlight-color: rgba(241, 90, 41, 0.3);
        /* Non-standard; use only the webkit-prefixed version */
    }

    /* Mobile pill stays as pill (matches your screenshot) */
    #customchatbot-toggle.customchatbot-toggle-pill {
        padding: 12px 18px;
        border-radius: 999px;
    }

    /* If open, keep it circular for close icon */
    .customchatbot-open #customchatbot-toggle.customchatbot-toggle-pill {
        width: 52px;
        height: 52px;
        padding: 0;
        border-radius: 50%;
    }
    
    .customchatbot-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 94vh;
        border-radius: 0;
        /* Prevent text selection on mobile */
        -webkit-user-select: none;
        user-select: none;
        /* Smooth scrolling on iOS */
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve touch targets for buttons */
    .customchatbot-send,
    .customchatbot-close {
        min-width: 44px;
        min-height: 44px;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        /* Non-standard; use only the webkit-prefixed version */
    }
    
    /* Improve input touch targets */
    .customchatbot-input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ================================================================
   Accessibility
   ================================================================ */
.customchatbot-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
