/* ============================================================
   CHATSIDEBAR.CSS — Arte Store
   Única alteração: #007bff (azul) → acento dourado/tinta
   Toda a estrutura e lógica mobile/iOS mantida intacta.
   ============================================================ */

/* ============================================================
   DESKTOP
   ============================================================ */

.chat-sidebar {
    position: fixed;
    right: 0;
    bottom: 20px;
    width: 50vw;
    height: 50vh;
    background: var(--mac-bg);
    border-radius: 16px;
    box-shadow: var(--mac-shadow);
    overflow: hidden;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s ease;
    box-sizing: border-box;
    border: 1px solid var(--mac-border);
}

    .chat-sidebar.open {
        transform: translateX(0);
    }

/* ============================================================
   BOTÃO TOGGLE
   ============================================================ */

.chat-toggle-btn {
    position: fixed;
    right: 16px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent) !important;
    cursor: pointer;
    z-index: 10001;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

    .chat-toggle-btn i {
        font-size: 20px;
        color: #ffffff;
    }

    .chat-toggle-btn .arte-chat-label {
        display: none !important;
    }
    
    .chat-toggle-btn:hover .chat-icon {
        opacity: 0.8;
    }

/* ============================================================
   HEADER
   ============================================================ */

.chat-header {
    background: var(--mac-titlebar-bg);
    color: var(--mac-title-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    font-family: var(--font-display);
    border-bottom: 1px solid var(--mac-titlebar-border);
    position: sticky;
    top: 0;
    z-index: 10002;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--mac-title-color);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
}

    .chat-close-btn:hover {
        opacity: 1;
    }

/* ============================================================
   CONTAINER INTERNO
   ============================================================ */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
    background: var(--mac-bg);
    overflow: hidden;
}

/* ============================================================
   MENSAGENS
   ============================================================ */

.messages-window {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    background: var(--mac-bg);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

#messagesWindow {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================================
   MENSAGEM INDIVIDUAL
   ============================================================ */

.message {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 80%;
}

.user-message {
    margin-left: auto;
    flex-direction: row-reverse;
}

.bot-message {
    margin-right: auto;
}

/* ============================================================
   AVATAR
   ============================================================ */

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.user-message .avatar {
    background: var(--mac-bg);
    color: var(--accent);
}

    .user-message .avatar i {
        color: var(--accent);
    }

.bot-message .avatar {
    background: var(--mac-bg);
    color: var(--mac-title-color);
}

    .bot-message .avatar i {
        color: var(--mac-title-color);
    }

.avatar i {
    font-size: 26px;
}

/* ============================================================
   BUBBLES
   ============================================================ */

.bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.4;
    max-width: 100%;
}

.user-message .bubble {
    background: var(--mac-title-color);    /* era #007bff */
    color: var(--mac-bg);
    border-bottom-right-radius: 4px;
}

.bot-message .bubble {
    background: var(--mac-titlebar-bg);
    color: var(--mac-title-color);
    border: 1px solid var(--mac-border);
    border-bottom-left-radius: 4px;
}

/* ============================================================
   INDICADOR DE ESCRITA
   ============================================================ */

.typing-indicator {
    display: flex;
    gap: 4px;
}

    .typing-indicator span {
        width: 8px;
        height: 8px;
        background: var(--mac-subtitle-color);
        border-radius: 50%;
        animation: blink 1.4s infinite both;
    }

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

@keyframes blink {
    0%   { opacity: .2; }
    20%  { opacity: 1;  }
    100% { opacity: .2; }
}

/* ============================================================
   INPUT
   ============================================================ */

.input-area {
    margin-top: auto;
    background: transparent;
    padding: 0;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.message-input {
    width: 100%;
    height: 60px;
    padding: 14px 60px 14px 14px;
    border-radius: 12px;
    background: var(--mac-bg);
    border: 1px solid var(--mac-border);
    color: var(--mac-title-color);
    outline: none;
    resize: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    font-family: var(--font-body);
}

    .message-input:focus {
        border-color: var(--accent);
        background: var(--mac-titlebar-bg);
    }

/* ============================================================
   BOTÃO ENVIAR
   ============================================================ */

.send-icon-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mac-title-color);   /* era #007bff */
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

    .send-icon-btn:hover {
        background: var(--accent);
        transform: scale(1.1);
    }

#sendIcon {
    font-size: 22px;
    color: var(--mac-bg);
}

/* ============================================================
   SPINNER
   ============================================================ */

#chatSpinner {
    font-size: 20px;
    color: var(--mac-bg) !important;
}

/* ============================================================
   MOBILE FIRST (iOS + Android)
   ============================================================ */

@media (max-width: 768px) {

    .chat-sidebar {
        position: fixed;
        left: env(safe-area-inset-left, 0);
        right: env(safe-area-inset-right, 0);
        bottom: env(safe-area-inset-bottom, 0);
        width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
        height: calc(60vh - env(safe-area-inset-bottom, 0));
        background: var(--mac-bg);
        border-radius: 0;
        overflow: hidden;
        transform: translateX(100%) !important;
        transition: transform 0.35s ease;
        z-index: 9999;
        display: flex;
        flex-direction: column;
    }

        .chat-sidebar.open {
            transform: translateX(0) !important;
        }

    .message {
        max-width: 100% !important;
    }
}

/* Fix específico para Safari iOS */
@supports (-webkit-touch-callout: none) {
    .chat-sidebar {
        position: fixed;
        left: env(safe-area-inset-left, 0);
        right: env(safe-area-inset-right, 0);
        bottom: env(safe-area-inset-bottom, 0);
        width: calc(100vw - env(safe-area-inset-left, 0) - env(safe-area-inset-right, 0));
        height: calc(60dvh - env(safe-area-inset-bottom, 0));
        max-height: calc(60dvh - env(safe-area-inset-bottom, 0));
        background: var(--mac-bg);
        border-radius: 0;
        overflow: hidden;
        transform: translateX(100%) !important;
        transition: transform 0.35s ease;
        z-index: 9999;
        display: flex;
        flex-direction: column;
    }

    .message-input {
        width: 100%;
        height: 60px;
        font-size: 16px !important;
        padding: 14px 60px 14px 14px;
        border-radius: 12px;
        background: var(--mac-bg);
        border: 1px solid var(--mac-border);
        outline: none;
        resize: none;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }
}

/* ============================================================
   FIM DO DOCUMENTO
   ============================================================ */
