/* ============================================================
   GUSA SOUND SOLUTION — FAQ CHATBOT WIDGET
   Premium floating chat widget with modern UI
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --chat-primary: #06A3DA;
    --chat-primary-dark: #0589b8;
    --chat-secondary: #F57E33;
    --chat-bg: #f4f6f9;
    --chat-surface: #ffffff;
    --chat-text: #2d3436;
    --chat-text-muted: #7f8c8d;
    --chat-bot-bubble: #ffffff;
    --chat-user-bubble: #06A3DA;
    --chat-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    --chat-radius: 20px;
    --chat-width: 400px;
    --chat-height: 560px;
    --chat-font: 'Heebo', 'Segoe UI', sans-serif;
    --chat-transition: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Floating Toggle Button — Studio Headphone ---------- */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: radial-gradient(circle at 40% 35%, #1a1520 0%, #04000B 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(242, 103, 34, 0.35),
        0 8px 40px rgba(4, 0, 11, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.35s var(--chat-transition),
                box-shadow 0.35s var(--chat-transition);
    animation: headphoneFloat 3s ease-in-out infinite;
    overflow: visible;
}

@keyframes headphoneFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

.chatbot-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow:
        0 6px 28px rgba(242, 103, 34, 0.5),
        0 12px 48px rgba(4, 0, 11, 0.55),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    animation: none;
}

/* --- Headphone CSS Art (open state) --- */
.chatbot-toggle .chat-icon-open {
    position: absolute;
    width: 38px;
    height: 36px;
    transition: opacity 0.3s ease, transform 0.35s ease;
}

/* Headband */
.chatbot-toggle .chat-icon-open::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 16px;
    border: 3.5px solid #4A3D35;
    border-bottom: none;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 -1px 4px rgba(74, 61, 53, 0.3);
}

/* Left ear cup */
.chatbot-toggle .headphone-ear-l,
.chatbot-toggle .headphone-ear-r {
    position: absolute;
    width: 14px;
    height: 18px;
    background: linear-gradient(160deg, #1a1520 0%, #04000B 100%);
    border-radius: 4px;
    top: 12px;
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.06),
        0 2px 6px rgba(0, 0, 0, 0.4);
}

.chatbot-toggle .headphone-ear-l {
    left: 2px;
    border: 2px solid #F26722;
    border-right-color: rgba(242, 103, 34, 0.4);
}

.chatbot-toggle .headphone-ear-r {
    right: 2px;
    border: 2px solid #F26722;
    border-left-color: rgba(242, 103, 34, 0.4);
}

/* Inner ear cushion detail */
.chatbot-toggle .headphone-ear-l::after,
.chatbot-toggle .headphone-ear-r::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 10px;
    border-radius: 2px;
    background: #4A3D35;
    opacity: 0.6;
}

/* Orange accent glow on ear cups */
.chatbot-toggle .headphone-ear-l::before,
.chatbot-toggle .headphone-ear-r::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 2px;
    background: #F26722;
    border-radius: 1px;
    box-shadow: 0 0 6px rgba(242, 103, 34, 0.6);
}

/* Headphone emoji fallback label (hidden visually, accessible) */
.chatbot-toggle .headphone-label {
    position: absolute;
    bottom: -1px;
    font-size: 9px;
    letter-spacing: 0.5px;
    color: rgba(242, 103, 34, 0.85);
    font-weight: 700;
    text-transform: uppercase;
    font-family: var(--chat-font);
}

/* --- Close icon (X) --- */
.chatbot-toggle .chat-icon-close {
    position: absolute;
    font-size: 22px;
    color: #F26722;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
    transition: opacity 0.3s ease, transform 0.35s ease;
}

/* Active states */
.chatbot-toggle.active {
    animation: none;
    background: radial-gradient(circle at 40% 35%, #1a1520 0%, #04000B 100%);
}

.chatbot-toggle.active .chat-icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chatbot-toggle.active .chat-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Pulse ring — orange glow */
.chatbot-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #F26722;
    opacity: 0;
    animation: chatPulse 2.8s ease-out infinite;
    pointer-events: none;
}

/* Secondary outer glow ring */
.chatbot-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid rgba(242, 103, 34, 0.3);
    opacity: 0;
    animation: chatPulse 2.8s ease-out 0.6s infinite;
    pointer-events: none;
}

.chatbot-toggle.active::before,
.chatbot-toggle.active::after {
    animation: none;
    opacity: 0;
}

@keyframes chatPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Unread badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--chat-secondary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    transition: transform 0.3s ease, opacity 0.3s ease;
    animation: badgeBounce 0.5s ease;
}

.chatbot-badge.hidden {
    transform: scale(0);
    opacity: 0;
}

@keyframes badgeBounce {
    0%   { transform: scale(0); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ---------- Chat Window ---------- */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    z-index: 9998;
    width: var(--chat-width);
    height: var(--chat-height);
    max-height: calc(100vh - 140px);
    border-radius: var(--chat-radius);
    overflow: hidden;
    background: var(--chat-bg);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    font-family: var(--chat-font);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.35s var(--chat-transition),
                transform 0.35s var(--chat-transition),
                visibility 0.35s;
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
.chatbot-header {
    background: linear-gradient(135deg, #1a1520, #04000B);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-bottom: 2px solid #F26722;
}

.chatbot-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(242, 103, 34, 0.2);
    border: 1.5px solid rgba(242, 103, 34, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.chatbot-header-info {
    flex: 1;
    min-width: 0;
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.3;
}

.chatbot-header-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbot-header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

.chatbot-header-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-close:hover {
    color: #fff;
}

/* ---------- Messages Area ---------- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 10px;
}

/* ---------- Message Bubbles ---------- */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: msgFadeIn 0.35s ease;
}

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

.chatbot-msg.bot {
    align-self: flex-start;
}

.chatbot-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatbot-msg.user .chatbot-msg-avatar {
    background: linear-gradient(135deg, var(--chat-secondary), #e06920);
}

.chatbot-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--chat-text);
    word-wrap: break-word;
    position: relative;
}

.chatbot-msg.bot .chatbot-msg-bubble {
    background: var(--chat-bot-bubble);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chatbot-msg.user .chatbot-msg-bubble {
    background: var(--chat-user-bubble);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-time {
    font-size: 10px;
    color: var(--chat-text-muted);
    margin-top: 4px;
    display: block;
}

.chatbot-msg.user .chatbot-msg-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.65);
}

/* ---------- Typing Indicator ---------- */
.chatbot-typing {
    display: flex;
    gap: 8px;
    align-self: flex-start;
    max-width: 85%;
    animation: msgFadeIn 0.3s ease;
}

.chatbot-typing .chatbot-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.typing-dots {
    background: var(--chat-bot-bubble);
    padding: 12px 18px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 5px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b0bec5;
    animation: typingBounce 1.2s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        background: #b0bec5;
    }
    30% {
        transform: translateY(-6px);
        background: var(--chat-primary);
    }
}

/* ---------- Suggestions ---------- */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
    flex-shrink: 0;
}

.chatbot-suggestions button {
    background: var(--chat-surface);
    border: 1.5px solid rgba(6, 163, 218, 0.3);
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 12.5px;
    font-family: var(--chat-font);
    color: var(--chat-primary);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.chatbot-suggestions button:hover {
    background: var(--chat-primary);
    color: #fff;
    border-color: var(--chat-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(6, 163, 218, 0.25);
}

/* ---------- Input Area ---------- */
.chatbot-input-area {
    padding: 12px 16px;
    background: var(--chat-surface);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chatbot-input-area input {
    flex: 1;
    border: 1.5px solid #e0e6ed;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-family: var(--chat-font);
    color: var(--chat-text);
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    background: var(--chat-bg);
}

.chatbot-input-area input:focus {
    border-color: var(--chat-primary);
    box-shadow: 0 0 0 3px rgba(6, 163, 218, 0.1);
}

.chatbot-input-area input::placeholder {
    color: #aab2bd;
}

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-send-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(6, 163, 218, 0.35);
}

.chatbot-send-btn:active {
    transform: scale(0.96);
}

/* ---------- Powered By ---------- */
.chatbot-footer {
    text-align: center;
    padding: 6px 0 10px;
    font-size: 10px;
    color: var(--chat-text-muted);
    background: var(--chat-surface);
    flex-shrink: 0;
}

.chatbot-footer a {
    color: var(--chat-primary);
    text-decoration: none;
    font-weight: 600;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        bottom: 8px;
        right: 8px;
        border-radius: 16px;
    }

    .chatbot-toggle {
        bottom: 18px;
        right: 18px;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .chatbot-msg {
        max-width: 90%;
    }
}

@media (max-width: 360px) {
    .chatbot-header {
        padding: 14px 16px;
    }

    .chatbot-msg-bubble {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    .chatbot-toggle::before {
        animation: none;
    }

    .chatbot-window {
        transition: opacity 0.15s ease, visibility 0.15s;
        transform: none !important;
    }

    .chatbot-msg {
        animation: none;
    }

    .typing-dots span {
        animation: none;
    }
}
