/* ==========================================================================
   AI Chat Widget — ArkhyzGo
   ========================================================================== */

/* Button */
#ach-btn {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    border-radius: 50% !important;
    background: #FF6B00 !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 107, 0, 0.4);
    z-index: 10000;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0 !important;
    box-sizing: border-box !important;
}
#ach-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(255, 107, 0, 0.5);
}
#ach-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}
#ach-btn .ach-icon-close {
    display: none;
}
#ach-btn.ach-active .ach-icon-chat {
    display: none;
}
#ach-btn.ach-active .ach-icon-close {
    display: block;
}

/* Notification dot */
#ach-btn .ach-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid #fff;
}
#ach-btn.ach-active .ach-dot,
#ach-btn.ach-seen .ach-dot {
    display: none;
}

/* Window */
#ach-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#ach-window.ach-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Header */
.ach-header {
    background: #FF6B00;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.ach-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ach-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.ach-header-text .ach-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
.ach-header-text .ach-subtitle {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.2;
}
.ach-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.ach-close:hover {
    opacity: 1;
}

/* Body (messages) */
.ach-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafafa;
}

/* Messages */
.ach-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.ach-msg a {
    color: inherit;
    text-decoration: underline;
}
.ach-msg-assistant {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.ach-msg-user {
    background: #FF6B00;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.ach-msg-user a {
    color: #fff;
}

/* Typing indicator */
.ach-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    align-items: center;
}
.ach-typing span {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: ach-bounce 1.4s infinite ease-in-out;
}
.ach-typing span:nth-child(2) {
    animation-delay: 0.2s;
}
.ach-typing span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes ach-bounce {
    0%, 80%, 100% { transform: scale(0.4); }
    40% { transform: scale(1); }
}

/* Footer (input) */
.ach-footer {
    padding: 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}
.ach-footer input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}
.ach-footer input:focus {
    border-color: #FF6B00;
}
#ach-send {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 50% !important;
    background: #FF6B00 !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0;
    box-sizing: border-box !important;
    font-size: 20px;
    line-height: 1;
    color: #fff !important;
    transition: background 0.15s;
}
#ach-send:hover {
    background: #e55f00 !important;
}
#ach-send:disabled {
    background: #ccc !important;
    cursor: default;
}

/* Mobile */
@media (max-width: 480px) {
    #ach-btn {
        bottom: 80px;
        right: 16px;
        width: 54px;
        height: 54px;
    }
    #ach-btn.ach-active {
        display: none;
    }
    #ach-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100dvh;
    }
}
