/* ============================================================================
   AvA Yachts Chatbot Widget — frontend styles
   Loaded by FrontendWidget class on non-admin pages.
   ============================================================================ */

#chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 360px;
    max-height: 640px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
    z-index: 9999;
}

#chatbox-header {
    background-color: #004080;
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

#chatbox .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chatbox .logo {
    height: 36px;
}

#chatbox .assistant-title {
    font-size: 18px;
    font-weight: bold;
    color: white;
}

#chatbox .header-right {
    display: flex;
    gap: 4px;
    margin-left: auto;   /* keep buttons at far right even when .header-left is hidden */
    flex: 0 0 auto;      /* don't stretch — content width only */
}

/* Strong override — WordPress themes often style <button> with large padding/min-width.
   !important keeps − and × tight together regardless of theme. */
#chatbox-header button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2px 6px !important;
    margin: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: white !important;
    font-size: 20px !important;
    font-weight: normal !important;
    line-height: 1 !important;
    cursor: pointer;
}

/* Minimized: hide only the message list — input stays visible */
#chatbox.minimized #messages { display: none; }

/* Collapsed: only the two buttons remain */
#chatbox.collapsed .header-left,
#chatbox.collapsed #messages,
#chatbox.collapsed #input { display: none; }

/* Thinner bar in collapsed state */
#chatbox.collapsed #chatbox-header { padding: 4px 10px; }

/* When everything below the header is hidden (collapsed only), round all four corners */
#chatbox.collapsed #chatbox-header { border-radius: 10px; }

#chatbox #messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.4em;
}

#chatbox #input {
    display: flex;
    border-top: 1px solid #ccc;
    margin: 0 !important;
    padding: 0 !important;
}

#chatbox #input input {
    flex: 1;
    padding: 10px !important;
    margin: 0 !important;
    border: none;
    border-radius: 0 0 0 10px;
    box-sizing: border-box;
}

#chatbox #input button {
    padding: 10px !important;
    margin: 0 !important;
    background: #004080;
    color: white;
    border: none;
    border-radius: 0 0 10px 0;
    cursor: pointer;
    box-sizing: border-box;
}

#chatbox .typing {
    font-style: italic;
    color: gray;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

#chatbox .typing-dots {
    display: inline-flex;
    margin-left: 4px;
}

#chatbox .typing-dots span {
    width: 5px;
    height: 5px;
    margin: 0 1px;
    background: gray;
    border-radius: 50%;
    display: inline-block;
    animation: ava-chatbot-typing-blink 1.4s infinite both;
}

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

@keyframes ava-chatbot-typing-blink {
    0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-2px); }
}
