/* ============================================
   ASBN Projects - AI Chatbot Widget
   ============================================ */

/* Chat Toggle Button - hidden until page fully loads */
.asbn-chat-toggle {
    position: fixed;
    bottom: 85px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F7D780 0%, #F0B83C 40%, #ECAA35 70%, #F5CC5A 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(240, 184, 60, 0.4);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease, opacity 0.4s ease, visibility 0.4s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.asbn-chat-toggle.asbn-chat-ready {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.asbn-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(240, 184, 60, 0.55);
}

.asbn-chat-toggle svg {
    width: 28px;
    height: 28px;
    fill: #1C1917;
    transition: transform 0.3s ease;
}
.asbn-chat-toggle img.chat-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    filter: brightness(0);
}

.asbn-chat-toggle.active svg.chat-icon,
.asbn-chat-toggle.active img.chat-icon { display: none; }
.asbn-chat-toggle:not(.active) svg.close-icon { display: none; }

/* Chat notification badge */
.asbn-chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: asbn-badge-pulse 2s infinite;
}

@keyframes asbn-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Proactive greeting bubble */
.asbn-chat-hint {
    position: fixed;
    bottom: 160px;
    right: 30px;
    background: #1C1917;
    color: #F0B83C;
    padding: 12px 18px;
    border-radius: 14px 14px 4px 14px;
    font-size: 14px;
    font-family: 'Red Hat Display', sans-serif;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    z-index: 99997;
    max-width: 230px;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    border-left: 3px solid #F0B83C;
}

.asbn-chat-hint.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.asbn-chat-hint::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 22px;
    width: 14px;
    height: 14px;
    background: #1C1917;
    transform: rotate(45deg);
}

.asbn-chat-hint-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

/* Chat Window */
.asbn-chat-window {
    position: fixed;
    bottom: 160px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.25);
    z-index: 99998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.asbn-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Chat Header */
.asbn-chat-header {
    background: #1C1917;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.asbn-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F7D780 0%, #F0B83C 40%, #ECAA35 70%, #F5CC5A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asbn-chat-header-avatar svg {
    width: 20px;
    height: 20px;
    fill: #1C1917;
}
.asbn-chat-header-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    filter: brightness(0);
}

.asbn-chat-header-info {
    flex: 1;
}

.asbn-chat-header-title {
    color: #F0B83C;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Red Hat Display', sans-serif;
    margin: 0;
    line-height: 1.2;
}

.asbn-chat-header-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    margin: 0;
}

.asbn-chat-header-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

/* Chat Messages Area */
.asbn-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f8f8;
}

.asbn-chat-messages::-webkit-scrollbar {
    width: 5px;
}

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

.asbn-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Message Bubbles */
.asbn-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    font-family: 'Red Hat Display', sans-serif;
    animation: asbn-msg-in 0.3s ease;
}

@keyframes asbn-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.asbn-msg.bot {
    background: #fff;
    color: #333;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.asbn-msg.user {
    background: #1C1917;
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.asbn-msg a {
    color: #C9950A;
    font-weight: 600;
    text-decoration: underline;
}

.asbn-msg.user a {
    color: #F0B83C;
}

.asbn-msg strong {
    color: #1C1917;
    font-weight: 700;
}

.asbn-msg.user strong {
    color: #F0B83C;
}

/* Typing Indicator */
.asbn-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}

.asbn-typing span {
    width: 7px;
    height: 7px;
    background: #bbb;
    border-radius: 50%;
    animation: asbn-typing-bounce 1.4s infinite ease-in-out;
}

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

@keyframes asbn-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Quick Reply Buttons */
.asbn-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.asbn-quick-btn {
    background: transparent;
    border: 1.5px solid #F0B83C;
    color: #1C1917;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 12.5px;
    font-family: 'Red Hat Display', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.asbn-quick-btn:hover {
    background: #F0B83C;
    color: #1C1917;
}

/* Chat Input Area */
.asbn-chat-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.asbn-chat-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: 'Red Hat Display', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
    background: #fafafa;
}

.asbn-chat-input:focus {
    border-color: #F0B83C;
    background: #fff;
}

.asbn-chat-input::placeholder {
    color: #aaa;
}

.asbn-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F7D780 0%, #F0B83C 40%, #ECAA35 70%, #F5CC5A 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.asbn-chat-send:hover {
    transform: scale(1.08);
}

.asbn-chat-send svg {
    width: 18px;
    height: 18px;
    fill: #1C1917;
}

/* Powered-by */
.asbn-chat-footer {
    text-align: center;
    padding: 6px;
    background: #fff;
    font-size: 10px;
    color: #bbb;
    font-family: 'Red Hat Display', sans-serif;
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .asbn-chat-window {
        right: 10px;
        bottom: 150px;
        width: calc(100vw - 20px);
        max-height: calc(100vh - 180px);
        border-radius: 14px;
    }
}

@media (max-width: 480px) {
    .asbn-chat-window {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .asbn-chat-toggle {
        bottom: 80px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .asbn-chat-toggle.active {
        bottom: auto;
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        z-index: 100000;
        box-shadow: none;
        background: rgba(255,255,255,0.15);
    }

    .asbn-chat-toggle.active svg {
        width: 22px;
        height: 22px;
        fill: #fff;
    }

    .asbn-chat-hint {
        bottom: 142px;
        right: 16px;
        max-width: 200px;
        font-size: 12px;
    }

    .asbn-chat-badge {
        top: -4px;
        right: -4px;
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* Calendly inline inside chatbot */
.asbn-calendly-bubble {
    background: transparent !important;
    padding: 4px 0 !important;
    box-shadow: none !important;
    width: 100%;
    max-width: 100%;
}
.asbn-calendly-bubble .calendly-inline-widget {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(240, 184, 60, 0.25);
}