/* Elit Tobacco Shop – Floating WhatsApp & Rule-Based Chatbot Widget */
/* Black, Gold and Cream Theme */

.floating-actions-group {
    position: fixed;
    right: 16px;
    bottom: 16px;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    max-width: calc(100vw - 24px);
}

.floating-buttons-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Chatbot Launcher Button (Black-800, 1px gold-500 ring, gold logo, red '1' badge) */
.chat-launcher-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #121212;
    border: 1px solid #D4AF37;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(212, 175, 55, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.chat-launcher-btn:hover {
    transform: scale(1.06);
    background: #1C1C1C;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.55);
}

.chat-launcher-btn:focus-visible,
.wa-launcher-btn:focus-visible,
.chat-send-btn:focus-visible {
    outline: 3px solid #F3DC8A;
    outline-offset: 3px;
}

.chat-badge-pill {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    border: 2px solid #121212;
    z-index: 2;
    pointer-events: none;
}

.chat-launcher-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    pointer-events: none;
}

/* Official WhatsApp Floating Button (#25D366 circle + pulse ping) */
.wa-launcher-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #ffffff;
    text-decoration: none;
}

.wa-launcher-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.6);
}

.wa-launcher-svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

.wa-ping-indicator {
    position: absolute;
    top: -3px;
    right: -3px;
    display: flex;
    width: 12px;
    height: 12px;
}

.wa-ping-animate {
    position: absolute;
    display: inline-flex;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #25D366;
    opacity: 0.75;
    animation: waPingAnimation 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.wa-ping-dot {
    position: relative;
    display: inline-flex;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    background-color: #ffffff;
    border: 2px solid #25D366;
}

@keyframes waPingAnimation {
    75%, 100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Chat Panel */
.chat-panel {
    width: 360px;
    width: min(360px, calc(100vw - 24px));
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(212, 175, 55, 0.40);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(5, 5, 5, 0.85);
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
}

.chat-panel[hidden] {
    display: none !important;
}

.chat-header {
    padding: 12px 16px;
    background: #121212;
    border-bottom: 1px solid rgba(212, 175, 55, 0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #D4AF37;
    display: inline-block;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

.chat-title {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: #F3DC8A;
    line-height: 1.2;
}

.chat-badge {
    display: block;
    font-size: 11px;
    color: #B9AE94;
    margin-top: 2px;
}

.chat-header-close {
    background: transparent;
    border: none;
    color: #F3DC8A;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.chat-header-close:hover {
    color: #E6C65C;
    background: rgba(212, 175, 55, 0.1);
}

.chat-chips {
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.18);
    background: rgba(10, 10, 10, 0.8);
    flex: 0 0 auto;
}

.chat-chip {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #D4AF37;
    background: transparent;
    color: #F3DC8A;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.chat-chip:hover {
    background: #D4AF37;
    color: #0A0A0A;
}

.chat-messages {
    flex: 1;
    height: 260px;
    max-height: 280px;
    min-height: 120px;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg p {
    margin: 0;
}

.chat-msg.is-bot {
    align-self: flex-start;
    background: #121212;
    color: #F5EFE0;
    border: 1px solid rgba(212, 175, 55, 0.22);
}

.chat-msg.is-user {
    align-self: flex-end;
    background: #D4AF37;
    color: #0A0A0A;
    font-weight: 600;
}

.chat-wa-cta {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 4px;
    background: #25D366;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: filter 0.2s ease;
}

.chat-wa-cta:hover {
    filter: brightness(1.08);
}

.chat-wa-cta svg {
    width: 14px;
    height: 14px;
    fill: #ffffff;
}

.chat-form {
    padding: 10px 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.18);
    display: flex;
    gap: 8px;
    background: #0A0A0A;
    flex: 0 0 auto;
}

.chat-form input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    background: #1C1C1C;
    color: #F5EFE0;
    font-size: 12px;
    outline: none;
    min-height: 38px;
    transition: border-color 0.2s ease;
}

.chat-form input:focus {
    border-color: #D4AF37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.chat-form input::placeholder {
    color: #B9AE94;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #D4AF37;
    color: #0A0A0A;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.chat-send-btn:hover {
    background: #E6C65C;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.chat-send-btn:active {
    background: #A8862A;
}

@media (max-width: 767px) {
    .floating-actions-group {
        right: 12px;
        bottom: 12px;
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .chat-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: 420px;
        margin-inline: auto;
        max-height: calc(100vh - 100px);
        max-height: min(70dvh, calc(100dvh - 100px));
    }
}

@media (max-width: 380px) {
    .floating-buttons-row {
        gap: 8px;
    }

    .chat-chip {
        padding-inline: 8px;
        font-size: 10px;
    }
}
