/* Binary Waves Chatbot Widget - Fully Enhanced Styles */

/* ============================================
   BASE CONTAINER
   ============================================ */
.bw-chatbot {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    font-family: inherit;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.bw-chatbot--hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    pointer-events: none;
}

/* ============================================
   LAUNCHER BUTTON
   ============================================ */
.bw-chatbot-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    box-shadow: 0 12px 40px rgba(10, 14, 23, 0.10);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.bw-chatbot-launcher:hover {
    transform: translateY(-4px);
    border-color: rgba(249, 95, 14, 0.25);
    box-shadow: 0 18px 60px rgba(10, 14, 23, 0.14);
}

.bw-chatbot-launcher__icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(249, 95, 14, 0.10);
    color: var(--bw-accent, #f95f0e);
    font-size: 18px;
}

.bw-chatbot-launcher__text {
    font-family: "Sora", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bw-ink, #0a0e17);
}

/* ============================================
   CHAT PANEL
   ============================================ */
.bw-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 60px;
    width: 320px;
    max-width: calc(100vw - 36px);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 30px 70px rgba(10, 14, 23, 0.18);
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.bw-chatbot.is-open .bw-chatbot-panel {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   HEADER
   ============================================ */
.bw-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px;
    background: linear-gradient(180deg,
            rgba(10, 14, 23, 0.96) 0%,
            rgba(10, 14, 23, 0.92) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bw-chatbot-header__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bw-chatbot-badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(249, 95, 14, 0.14);
    color: var(--bw-accent, #f95f0e);
    border: 1px solid rgba(249, 95, 14, 0.25);
}

.bw-chatbot-name {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.1;
}

.bw-chatbot-subtitle {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.75rem;
    margin-top: 2px;
}

.bw-chatbot-close {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bw-chatbot-close:hover {
    background: rgba(249, 95, 14, 0.15);
    border-color: rgba(249, 95, 14, 0.3);
    transform: rotate(90deg);
}

/* ============================================
   CHAT BODY & SCROLLBAR
   ============================================ */
.bw-chatbot-body {
    padding: 16px;
    height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(10, 14, 23, 0.02);
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.bw-chatbot-body::-webkit-scrollbar {
    width: 6px;
}

.bw-chatbot-body::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.bw-chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(249, 95, 14, 0.2);
    border-radius: 3px;
    transition: background 0.2s;
}

.bw-chatbot-body::-webkit-scrollbar-thumb:hover {
    background: rgba(249, 95, 14, 0.4);
}

/* ============================================
   MESSAGES - ENHANCED STYLING
   ============================================ */
.bw-chat-msg {
    display: flex;
    margin-bottom: 12px;
    animation: bw-msg-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    animation-fill-mode: forwards;
}

@keyframes bw-msg-slide-in {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bw-chat-msg--user {
    justify-content: flex-end;
}

/* Base Bubble Styles */
.bw-chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.6;
    letter-spacing: -0.01em;
    word-wrap: break-word;
    position: relative;
    transition: transform 0.2s ease;
}

/* Bot Message Styling */
.bw-chat-msg--bot .bw-chat-bubble {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--bw-ink, #0a0e17);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 3px solid var(--bw-accent, #f95f0e);
    border-radius: 18px 18px 18px 4px;
    box-shadow:
        0 2px 12px rgba(10, 14, 23, 0.04),
        0 1px 3px rgba(249, 95, 14, 0.05);
}

/* User Message Styling */
.bw-chat-msg--user .bw-chat-bubble {
    background: linear-gradient(135deg, rgba(249, 95, 14, 0.1) 0%, rgba(249, 95, 14, 0.05) 100%);
    border: 1px solid rgba(249, 95, 14, 0.18);
    border-radius: 18px 18px 4px 18px;
    color: var(--bw-ink, #0a0e17);
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(249, 95, 14, 0.06);
}

/* Typography Enhancements */
.bw-chat-bubble strong,
.bw-chat-bubble b {
    color: var(--bw-accent, #f95f0e);
    font-weight: 600;
}

.bw-chat-bubble p {
    margin: 0 0 10px 0;
}

.bw-chat-bubble p:last-child {
    margin-bottom: 0;
}

/* Styled Lists */
.bw-chat-bubble ul,
.bw-chat-bubble ol {
    margin: 10px 0;
    padding-left: 0;
    list-style: none;
}

.bw-chat-bubble li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 6px;
    line-height: 1.5;
}

.bw-chat-bubble li:before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    background: var(--bw-accent, #f95f0e);
    border-radius: 50%;
    opacity: 0.8;
}

.bw-chat-bubble li:last-child {
    margin-bottom: 0;
}

/* Enhanced Links */
.bw-chat-bubble a {
    color: var(--bw-accent, #f95f0e);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(249, 95, 14, 0.25);
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

.bw-chat-bubble a:hover {
    border-bottom-color: var(--bw-accent, #f95f0e);
    background: rgba(249, 95, 14, 0.06);
    border-radius: 2px;
    padding: 0 4px 1px;
    margin: 0 -4px;
}

/* "Learn More" & Section Headers */
.bw-chat-bubble br+br+strong,
.bw-chat-bubble .section-header {
    display: inline-block;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(10, 14, 23, 0.08);
    color: var(--bw-ink, #0a0e17);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    width: 100%;
}

/* Info Snippets/Callouts */
.bw-chat-bubble .info-snippet,
.bw-chat-bubble blockquote {
    background: rgba(249, 95, 14, 0.04);
    border-left: 3px solid rgba(249, 95, 14, 0.3);
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    color: rgba(10, 14, 23, 0.85);
}

/* Code/Technical Terms */
.bw-chat-bubble code {
    background: rgba(10, 14, 23, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85em;
    color: var(--bw-accent, #f95f0e);
    font-weight: 600;
}

/* Horizontal Rules */
.bw-chat-bubble hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(249, 95, 14, 0.2) 20%,
            rgba(249, 95, 14, 0.2) 80%,
            transparent 100%);
    margin: 14px 0;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.bw-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}

.bw-typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(249, 95, 14, 0.4);
    border-radius: 50%;
    animation: bw-typing-bounce 1.4s infinite ease-in-out both;
}

.bw-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.bw-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.bw-typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bw-typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
        background: var(--bw-accent, #f95f0e);
    }
}

/* ============================================
   QUICK REPLY BUTTONS
   ============================================ */
.bw-chatbot-quick {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.bw-chatbot-quick__btn {
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--bw-ink, #0a0e17);
    background: #fff;
    border: 1px solid rgba(249, 95, 14, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* Removed redundant scrollbar hide for grid layout */


.bw-chatbot-quick__btn:hover {
    background: rgba(249, 95, 14, 0.12);
    border-color: rgba(249, 95, 14, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 95, 14, 0.1);
}

.bw-chatbot-quick__btn:active {
    transform: translateY(0);
}

/* ============================================
   INPUT AREA
   ============================================ */
.bw-chatbot-input {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.bw-chatbot-input__field {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    outline: none;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: rgba(10, 14, 23, 0.01);
}

.bw-chatbot-input__field:focus {
    border-color: rgba(249, 95, 14, 0.4);
    box-shadow: 0 0 0 0.2rem rgba(249, 95, 14, 0.12);
    background: #fff;
}

.bw-chatbot-input__field::placeholder {
    color: rgba(10, 14, 23, 0.4);
}

.bw-chatbot-input__send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(249, 95, 14, 0.25);
    background: var(--bw-accent, #f95f0e);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.bw-chatbot-input__send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(249, 95, 14, 0.35);
}

.bw-chatbot-input__send:active {
    transform: scale(0.95);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .bw-chatbot-panel {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .bw-chatbot-panel {
        width: 380px;
        max-width: calc(100vw - 40px);
        bottom: 75px;
    }
}

@media (max-width: 480px) {
    .bw-chatbot {
        right: 12px;
        bottom: 12px;
    }

    .bw-chatbot-launcher__text {
        display: none;
    }

    .bw-chatbot-launcher {
        width: 56px;
        height: 56px;
        padding: 0;
        justify-content: center;
        border-radius: 20px;
    }

    .bw-chatbot-launcher__icon {
        width: 24px;
        height: 24px;
        margin: 0;
        border-radius: 0;
        background: transparent;
    }

    .bw-chatbot-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: none;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 10000;
        display: flex;
        flex-direction: column;
        border: none;
    }

    .bw-chatbot-header {
        padding: 18px 16px;
        border-radius: 0;
        flex-shrink: 0;
    }

    .bw-chatbot-body {
        flex: 1;
        height: auto !important;
        padding: 20px 16px;
    }

    /* Mobile Message Enhancements */
    .bw-chat-bubble {
        max-width: 90%;
        font-size: 0.95rem;
        padding: 14px 18px;
    }

    .bw-chat-msg--bot .bw-chat-bubble {
        border-radius: 20px 20px 20px 4px;
    }

    .bw-chat-msg--user .bw-chat-bubble {
        border-radius: 20px 20px 4px 20px;
    }

    .bw-chatbot-quick {
        padding: 12px;
        gap: 6px;
    }

    .bw-chatbot-quick__btn {
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    .bw-chatbot-input {
        padding: 14px 16px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
        flex-shrink: 0;
    }

    .bw-chatbot.is-open .bw-chatbot-launcher {
        display: none;
    }
}

/* Landscape orientation for mobile */
@media (max-height: 480px) and (orientation: landscape) {
    .bw-chatbot-panel {
        height: 100vh;
        max-height: 100vh;
    }

    .bw-chatbot-body {
        height: auto;
    }

    .bw-chat-bubble {
        max-width: 80%;
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */
@keyframes bw-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes bw-pop-in {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Focus visible for accessibility */
.bw-chatbot button:focus-visible,
.bw-chatbot input:focus-visible {
    outline: 2px solid var(--bw-accent, #f95f0e);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    .bw-chat-msg,
    .bw-chatbot,
    .bw-chatbot-panel,
    .bw-chatbot-launcher,
    .bw-chatbot-quick__btn,
    .bw-chatbot-input__send,
    .bw-chatbot-close {
        animation: none !important;
        transition: none !important;
    }
}