/* Simple FAB Button (fallback mode) */
.armmage-wa-fab {
    position: fixed;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    background: #25D366;
    transition: transform 0.2s, box-shadow 0.2s;
}

.armmage-wa-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}

.armmage-wa-fab--right {
    right: 18px;
}

.armmage-wa-fab--left {
    left: 18px;
}

.armmage-wa-fab__icon {
    width: 28px;
    height: 28px;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23fff' d='M19.11 17.5c-.23-.12-1.36-.67-1.57-.75-.21-.08-.37-.12-.52.12-.15.23-.6.75-.73.9-.13.15-.27.17-.5.06-.23-.12-.97-.36-1.85-1.14-.68-.61-1.14-1.36-1.27-1.59-.13-.23-.01-.35.1-.47.1-.1.23-.27.35-.4.12-.13.15-.23.23-.38.08-.15.04-.29-.02-.4-.06-.12-.52-1.25-.71-1.71-.19-.46-.38-.4-.52-.4h-.44c-.15 0-.4.06-.6.29-.21.23-.79.77-.79 1.88 0 1.11.81 2.18.92 2.33.12.15 1.6 2.44 3.88 3.42.54.23.97.37 1.3.47.55.18 1.05.15 1.44.09.44-.06 1.36-.56 1.55-1.1.19-.54.19-1.01.13-1.1-.06-.1-.21-.15-.44-.27z'/%3E%3Cpath fill='%23fff' d='M16.01 3C9.38 3 4 8.37 4 15c0 2.25.62 4.36 1.7 6.16L4 29l8.07-1.64A12 12 0 0 0 16 27c6.63 0 12-5.37 12-12S22.64 3 16.01 3zm0 21.73c-1.93 0-3.74-.57-5.26-1.55l-.38-.24-4.78.97.98-4.66-.25-.4A9.7 9.7 0 0 1 6.3 15c0-5.36 4.35-9.7 9.71-9.7 5.36 0 9.71 4.35 9.71 9.7 0 5.36-4.35 9.71-9.71 9.71z'/%3E%3C/svg%3E");
}

/* Chat Widget (API mode) */
.armmage-wa-widget {
    position: fixed;
    z-index: 9999;
}

.armmage-wa-widget[data-position="right"] {
    right: 18px;
}

.armmage-wa-widget[data-position="left"] {
    left: 18px;
}

.armmage-wa-chat {
    width: 360px;
    max-width: calc(100vw - 36px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.armmage-wa-chat__header {
    background: #25D366;
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.armmage-wa-chat__header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.armmage-wa-chat__icon {
    width: 32px;
    height: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23fff' d='M19.11 17.5c-.23-.12-1.36-.67-1.57-.75-.21-.08-.37-.12-.52.12-.15.23-.6.75-.73.9-.13.15-.27.17-.5.06-.23-.12-.97-.36-1.85-1.14-.68-.61-1.14-1.36-1.27-1.59-.13-.23-.01-.35.1-.47.1-.1.23-.27.35-.4.12-.13.15-.23.23-.38.08-.15.04-.29-.02-.4-.06-.12-.52-1.25-.71-1.71-.19-.46-.38-.4-.52-.4h-.44c-.15 0-.4.06-.6.29-.21.23-.79.77-.79 1.88 0 1.11.81 2.18.92 2.33.12.15 1.6 2.44 3.88 3.42.54.23.97.37 1.3.47.55.18 1.05.15 1.44.09.44-.06 1.36-.56 1.55-1.1.19-.54.19-1.01.13-1.1-.06-.1-.21-.15-.44-.27z'/%3E%3Cpath fill='%23fff' d='M16.01 3C9.38 3 4 8.37 4 15c0 2.25.62 4.36 1.7 6.16L4 29l8.07-1.64A12 12 0 0 0 16 27c6.63 0 12-5.37 12-12S22.64 3 16.01 3zm0 21.73c-1.93 0-3.74-.57-5.26-1.55l-.38-.24-4.78.97.98-4.66-.25-.4A9.7 9.7 0 0 1 6.3 15c0-5.36 4.35-9.7 9.71-9.7 5.36 0 9.71 4.35 9.71 9.7 0 5.36-4.35 9.71-9.71 9.71z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex-shrink: 0;
}

.armmage-wa-chat__header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.armmage-wa-chat__header-text strong {
    font-weight: 600;
    font-size: 16px;
}

.armmage-wa-chat__header-text span {
    font-size: 12px;
    opacity: 0.9;
}

.armmage-wa-chat__toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: background 0.2s;
}

.armmage-wa-chat__toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.armmage-wa-chat__toggle-icon {
    width: 20px;
    height: 20px;
    position: relative;
}

.armmage-wa-chat__toggle-icon::before,
.armmage-wa-chat__toggle-icon::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 2px;
    background: #fff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.3s;
}

.armmage-wa-chat--open .armmage-wa-chat__toggle-icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.armmage-wa-chat--open .armmage-wa-chat__toggle-icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.armmage-wa-chat__body {
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

.armmage-wa-chat__messages {
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    background: #f0f0f0;
    flex: 1;
}

.armmage-wa-chat__message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 80%;
}

.armmage-wa-chat__message--system {
    background: #e5f5e5;
    margin-right: auto;
}

.armmage-wa-chat__message--user {
    background: #dcf8c6;
    margin-left: auto;
    text-align: right;
}

.armmage-wa-chat__message p {
    margin: 0;
    word-wrap: break-word;
}

.armmage-wa-chat__form {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.armmage-wa-chat__form-group {
    margin-bottom: 12px;
}

.armmage-wa-chat__form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.armmage-wa-chat__input,
.armmage-wa-chat__textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.armmage-wa-chat__input:focus,
.armmage-wa-chat__textarea:focus {
    outline: none;
    border-color: #25D366;
}

.armmage-wa-chat__textarea {
    resize: vertical;
    min-height: 60px;
}

.armmage-wa-chat__submit {
    width: 100%;
    padding: 12px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.armmage-wa-chat__submit:hover:not(:disabled) {
    background: #20ba5a;
}

.armmage-wa-chat__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.armmage-wa-chat__submit-loader {
    font-size: 13px;
    opacity: 0.9;
}

.armmage-wa-chat__status {
    padding: 10px 16px;
    font-size: 13px;
    display: none;
}

.armmage-wa-chat__status--success {
    background: #d4edda;
    color: #155724;
    border-top: 1px solid #c3e6cb;
}

.armmage-wa-chat__status--error {
    background: #f8d7da;
    color: #721c24;
    border-top: 1px solid #f5c6cb;
}

@media (max-width: 768px) {

    .armmage-wa-fab--right,
    .armmage-wa-widget[data-position="right"] {
        right: 14px;
    }

    .armmage-wa-fab--left,
    .armmage-wa-widget[data-position="left"] {
        left: 14px;
    }

    .armmage-wa-chat {
        width: calc(100vw - 28px);
        max-width: 360px;
    }
}