/**
 * =============================================================================
 * chat.css — Braskit Segurança Eletrônica
 * =============================================================================
 * Estilos exclusivos da página de chat de suporte (chat.html).
 * Complementa styles.css (navbar, footer, dark mode base).
 *
 * Índice:
 *  01. Variáveis CSS locais
 *  02. Container & Header do chat
 *  03. Área de mensagens (bubbles assistente/usuário)
 *  04. Typing indicator (três pontos animados)
 *  05. Área de opções — botões de escolha
 *  06. Animações de entrada/saída dos botões (stagger)
 *  07. Estado desabilitado dos botões (durante typewriter)
 *  08. Input de texto livre
 *  09. Input WhatsApp inline (wa-chat-*)
 *  10. Scrollbar personalizada
 *  11. Dark Mode overrides
 *  12. Responsivo
 *
 * Autor: BMS Developer
 * Última atualização: Fevereiro 2026
 * =============================================================================
 */

/* Variables */
:root {
    --primary: #0B2B4C;
    --secondary: #4A90E2;
    --accent: #F5F3E8;
    --light-bg: #F4F7FB;
    --text: #222831;
    --text-light: #6B7280;
    --success: #10B981;
    --danger: #EF4444;
}

/* Chat Container */
.chat-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem 2rem 1rem;
    min-height: calc(100vh - 200px);
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 2rem;
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.chat-header h1 i {
    margin-right: 0.5rem;
}

.chat-header p {
    opacity: 0.95;
    font-size: 0.95rem;
}

.chat-box {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.assistant .message-content {
    background: var(--light-bg);
    color: var(--text);
    border-left: 4px solid var(--secondary);
}

.message.user .message-content {
    background: var(--secondary);
    color: white;
    border-radius: 12px;
}

.message.system .message-content {
    background: var(--success);
    color: white;
    text-align: center;
    max-width: 90%;
    font-size: 0.95rem;
}

.chat-input-area {
    border-top: 1px solid #E5E7EB;
    padding: 1.5rem;
    background: white;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
}

/* Animação de entrada dos botões */
@keyframes btnFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animação de entrada para botões DESABILITADOS (vai até 0.45, não 1) */
@keyframes btnFadeInDisabled {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 0.45;
        transform: translateY(0);
    }
}

/* Animação de saída dos botões */
@keyframes btnFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}

.option-btn {
    padding: 0.75rem 1.2rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
    font-weight: 500;
    font-family: inherit;
    flex: 1;
    min-width: 140px;
    animation: btnFadeIn 0.3s ease both;
}

.option-btn:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.option-btn:active {
    transform: translateY(0);
}

/* Botões desabilitados enquanto o texto é animado */
.option-btn.options-disabled,
.option-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
    /* Usa a animação própria que chega até 0.45 */
    animation: btnFadeInDisabled 0.3s ease both;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.input-group input {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.input-group input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.input-group button {
    padding: 0.8rem 1.5rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.input-group button:hover {
    background: var(--primary);
}

.input-group button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Scrollbar personalizada */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--light-bg);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Typing Indicator Animation */
.typing-indicator .message-content {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1rem 1.2rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .message-content {
        max-width: 90%;
    }

    .option-btn {
        min-width: 100px;
        flex: auto;
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }

    .chat-header h1 {
        font-size: 1.5rem;
    }

    .nav-menu {
        gap: 1rem;
    }

    .logo img {
        width: 200px;
    }
}

/* ===== DARK MODE STYLES FOR CHAT ===== */
html[data-theme="dark"] .chat-container {
    background: transparent;
}

html[data-theme="dark"] .chat-header {
    background: #0A1F35;
    color: white;
}

html[data-theme="dark"] .chat-header h1 {
    color: white;
}

html[data-theme="dark"] .chat-header p {
    color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .chat-box {
    background: #2D2D2D;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .chat-messages {
    background: #2D2D2D;
}

html[data-theme="dark"] .message.assistant .message-content {
    background: #1A1A1A;
    color: #E8E8E8;
    border-left-color: var(--secondary);
}

html[data-theme="dark"] .message.user .message-content {
    background: var(--secondary);
    color: white;
}

html[data-theme="dark"] .message.system .message-content {
    background: var(--success);
    color: white;
}

html[data-theme="dark"] .chat-input-area {
    background: #1A1A1A;
    border-top-color: #404040;
}

html[data-theme="dark"] .option-btn {
    background: var(--secondary);
    color: white;
}

html[data-theme="dark"] .option-btn:hover {
    background: #6BA3F5;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.5);
}

html[data-theme="dark"] .input-group input {
    background: #2D2D2D;
    color: #E8E8E8;
    border-color: #404040;
}

html[data-theme="dark"] .input-group input::placeholder {
    color: #B0B0B0;
}

html[data-theme="dark"] .input-group input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

html[data-theme="dark"] .input-group button {
    background: var(--secondary);
    color: white;
}

html[data-theme="dark"] .input-group button:hover {
    background: #6BA3F5;
}

html[data-theme="dark"] .input-group button:disabled {
    background: #555;
    color: #999;
}

html[data-theme="dark"] .chat-messages::-webkit-scrollbar-track {
    background: #1A1A1A;
}

html[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb {
    background: var(--secondary);
}

html[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6BA3F5;
}

html[data-theme="dark"] .typing-indicator span {
    background: #B0B0B0;
}

/* ===== WA CHAT INLINE INPUT ===== */
.wa-chat-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    animation: btnFadeIn 0.35s ease both;
}

.wa-chat-textarea {
    width: 100%;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    padding: 0.8rem;
    font-size: 1rem;
    color: var(--text);
    background: white;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.wa-chat-textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.wa-chat-textarea:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wa-chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
}

.wa-chat-send {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1.2rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
}

.wa-chat-send:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.wa-chat-send:active {
    transform: translateY(0);
}

.wa-chat-new {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1.2rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
}

.wa-chat-new:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.wa-chat-new:active {
    transform: translateY(0);
}

.wa-chat-send:disabled,
.wa-chat-send.options-disabled,
.wa-chat-new:disabled,
.wa-chat-new.options-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none;
    animation: btnFadeInDisabled 0.3s ease both;
}

/* Dark mode */
html[data-theme="dark"] .wa-chat-textarea {
    background: #2D2D2D;
    border-color: #404040;
    color: #E8E8E8;
}

html[data-theme="dark"] .wa-chat-textarea::placeholder {
    color: #B0B0B0;
}

html[data-theme="dark"] .wa-chat-textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

html[data-theme="dark"] .wa-chat-send {
    background: var(--secondary);
    color: white;
}

html[data-theme="dark"] .wa-chat-send:hover {
    background: #6BA3F5;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.5);
}

html[data-theme="dark"] .wa-chat-new {
    background: var(--secondary);
    color: white;
}

html[data-theme="dark"] .wa-chat-new:hover {
    background: #6BA3F5;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.5);
}

