/* VivoRetailX - Internal Corporate Chat Styles - Responsive & Embeddable */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Container principal - Incorporável */
body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    margin: 0;
    padding: 10px 20px;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    transition: padding 0.3s ease-in-out;
}

/* Sistema de Tema Simplificado */
/* Tema Escuro (Padrão) */
body.theme-dark {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.theme-dark .chat-widget {
    background: #1e1e2e;
    border-color: rgba(139, 92, 246, 0.3);
}

body.theme-dark .chat-messages {
    background: #1a1a2a;
}

body.theme-dark .bot-message {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    color: #f9fafb;
    border-color: rgba(139, 92, 246, 0.5);
}

body.theme-dark .bot-message strong {
    color: #ddd6fe;
}

body.theme-dark .slogan-banner {
    background: #1e1e2e;
    border-color: rgba(139, 92, 246, 0.3);
}

body.theme-dark .slogan-text {
    color: #c4b5fd;
}

body.theme-dark .input-container {
    background: #2a2a3e;
    border-color: rgba(139, 92, 246, 0.4);
}

body.theme-dark .message-input {
    color: #f0f0f0;
}

body.theme-dark .chat-input {
    background: #1e1e2e;
    border-color: rgba(139, 92, 246, 0.3);
}

/* Tema Claro */
body.theme-light {
    background: linear-gradient(135deg, #f8f6ff 0%, #ede7ff 100%);
}

body.theme-light .chat-widget {
    background: #ffffff;
}

body.theme-light .chat-messages {
    background: #fdfdff;
}

body.theme-light .bot-message {
    background: linear-gradient(135deg, #f8f6ff 0%, #f3e8ff 100%);
    color: #1f2937;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

body.theme-light .bot-message strong {
    color: #374151;
}

body.theme-light .slogan-banner {
    background: linear-gradient(135deg, #fefeff 0%, #f8f6ff 100%);
    border-color: rgba(139, 92, 246, 0.08);
}

body.theme-light .slogan-text {
    color: #6610f2;
}

body.theme-light .input-container {
    background: #f8f6ff;
    border: 2px solid rgba(139, 92, 246, 0.2);
}

body.theme-light .message-input {
    color: #1f2937;
}

body.theme-light .chat-input {
    background: white;
    border-color: rgba(139, 92, 246, 0.08);
}

/* Chat Widget - Base responsiva */
.chat-widget {
    width: 100%;
    max-width: min(60vw, 800px);
    height: 100%;
    max-height: min(95vh, 850px);
    min-height: 600px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(102, 16, 242, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(102, 16, 242, 0.08);
    transition: all 0.3s ease-in-out;
}

/* Quando usado como incorporável */
.chat-widget.embedded {
    box-shadow: 0 4px 20px rgba(102, 16, 242, 0.1);
    border-radius: 12px;
    max-height: 600px;
    max-width: 100%;
    background: transparent;
}

.chat-widget.embedded body {
    background: transparent;
    padding: 0;
}

/* Estados do widget para diferentes tamanhos */
.chat-widget.compact {
    max-width: min(50vw, 600px);
    max-height: min(75vh, 650px);
}

.chat-widget.expanded {
    max-width: min(70vw, 900px);
    max-height: min(90vh, 850px);
}

/* Chat Header - Simplificado e compacto */
.chat-header {
    background: linear-gradient(135deg, #6610f2 0%, #7c3aed 50%, #8b5cf6 100%);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header.compact {
    padding: 12px 20px;
}

.header-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.theme-toggle:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.35);
}

.theme-toggle svg {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: all 0.3s ease;
    transform-origin: center;
}

.theme-toggle:hover svg {
    transform: rotate(15deg) scale(1.1);
}

/* Animação específica para troca de tema */
.theme-toggle.switching {
    animation: themeSwitch 0.4s ease;
}

@keyframes themeSwitch {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg); }
}

/* Slogan Banner */
.slogan-banner {
    background: linear-gradient(135deg, #fefeff 0%, #f8f6ff 100%);
    border-bottom: 1px solid rgba(139, 92, 246, 0.08);
    padding: 12px 24px;
    text-align: center;
    flex-shrink: 0;
}

.slogan-text {
    color: #6610f2;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #6610f2, #8b5cf6, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: sparkle 3s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: -200% -200%; }
    50% { background-position: 200% 200%; }
}

.avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #a855f7 0%, #c084fc 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.header-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.agent-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.agent-status {
    font-size: 13px;
    opacity: 0.95;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.header-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.action-button, .minimize-button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.action-button:hover, .minimize-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Removed quick-actions styles as they are no longer needed */

/* Messages - Responsivo e acessível */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fdfdff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.4s ease-out;
    max-width: 100%;
    will-change: transform, opacity;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bot-avatar {
    background: linear-gradient(135deg, #e879f9 0%, #c084fc 100%);
    color: white;
}

.user-avatar {
    background: linear-gradient(135deg, #6610f2 0%, #8b5cf6 100%);
    color: white;
}

.message-content {
    max-width: calc(100% - 42px);
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.bot-message {
    background: linear-gradient(135deg, #f8f6ff 0%, #f3e8ff 100%);
    color: #2d1b69;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(139, 92, 246, 0.12);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

.user-message {
    background: linear-gradient(135deg, #6610f2 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(102, 16, 242, 0.25);
}

.bot-message strong {
    color: #4c1d95;
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fdfdff;
    border-top: 1px solid rgba(139, 92, 246, 0.08);
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8b5cf6;
    font-size: 13px;
    font-weight: 500;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    background: #8b5cf6;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

/* Input Area - Touch-friendly e responsivo */
.chat-input {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid rgba(139, 92, 246, 0.08);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
}

.input-container {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f8f6ff;
    border: 2px solid rgba(139, 92, 246, 0.15);
    border-radius: 24px;
    padding: 12px 18px;
    transition: all 0.3s ease;
    gap: 10px;
    min-height: 48px;
}

.input-container:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
    background: #ffffff;
}

.input-icon {
    color: #9ca3af;
    flex-shrink: 0;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: #374151;
    font-weight: 500;
    min-height: 24px;
    resize: none;
    font-family: inherit;
}

.message-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.voice-button {
    background: none;
    border: none;
    color: #8b5cf6;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.voice-button:hover, .voice-button:active {
    background: rgba(139, 92, 246, 0.1);
    color: #6610f2;
}

.send-button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6610f2 0%, #8b5cf6 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(102, 16, 242, 0.3);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.send-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 16, 242, 0.4);
}

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

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Estados incorporáveis e acessibilidade */
.chat-widget.loading {
    pointer-events: none;
    opacity: 0.7;
}

.chat-widget.minimized {
    height: 60px;
    overflow: hidden;
}

.chat-widget.minimized .chat-messages,
.chat-widget.minimized .quick-actions,
.chat-widget.minimized .typing-indicator,
.chat-widget.minimized .chat-input {
    display: none;
}

/* Melhorias de acessibilidade */
.action-button:focus,
.minimize-button:focus,
.action-chip:focus,
.voice-button:focus,
.send-button:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.message-input:focus {
    outline: none;
}

/* Estados de loading */
.send-button.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Indicadores visuais para melhor UX */
.message-content.bot-message::before {
    content: '';
    position: absolute;
    top: 8px;
    left: -6px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 6px 0;
    border-color: transparent rgba(139, 92, 246, 0.12) transparent transparent;
}

.message-content.user-message::before {
    content: '';
    position: absolute;
    top: 8px;
    right: -6px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #6610f2;
}

/* Animações suaves para melhor experiência */
.chat-widget * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Performance otimizada */
.chat-messages {
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.message {
    will-change: transform, opacity;
}

/* Prevenção de zoom em iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .message-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .message-input {
        font-size: 16px !important;
    }
}

/* Classe utilitária para modo demo */
.chat-widget.demo {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 380px;
    max-height: 600px;
    box-shadow: 0 20px 60px rgba(102, 16, 242, 0.2);
}

/* Responsive Design - Mobile First */
@media (max-width: 768px) {
    body {
        padding: 8px;
        height: 100vh;
        height: -webkit-fill-available;
        align-items: stretch;
        justify-content: stretch;
    }

    .chat-widget {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        height: calc(-webkit-fill-available - 16px);
        max-height: calc(100vh - 16px);
        max-height: calc(-webkit-fill-available - 16px);
        min-height: calc(100vh - 16px);
        min-height: calc(-webkit-fill-available - 16px);
        border-radius: 12px;
        border: 1px solid rgba(139, 92, 246, 0.2);
        margin: 0;
    }

    .chat-widget.embedded {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: -webkit-fill-available;
        border-radius: 8px;
        border: 1px solid rgba(139, 92, 246, 0.15);
        box-shadow: none;
    }

    .chat-header {
        padding: 16px;
    }

    .avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .agent-name {
        font-size: 16px;
    }

    .agent-status {
        font-size: 11px;
    }

    .quick-actions {
        padding: 12px 16px;
        gap: 6px;
    }

    .action-chip {
        padding: 8px 10px;
        font-size: 10px;
        gap: 4px;
    }

    .action-chip svg {
        width: 12px;
        height: 12px;
    }

    .chat-messages {
        padding: 12px 16px;
        gap: 10px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .message-content {
        max-width: calc(100% - 38px);
        padding: 10px 14px;
        font-size: 12px;
    }

    .chat-input {
        padding: 16px 12px;
        gap: 10px;
        background: white;
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .input-container {
        padding: 10px 14px;
        border-radius: 20px;
        min-height: 44px;
        flex: 1;
    }

    .message-input {
        font-size: 14px;
        min-height: 24px;
    }

    .send-button {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
        margin-left: auto;
    }

    .send-button svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 4px;
        height: 100vh;
        height: -webkit-fill-available;
    }

    .chat-widget {
        width: calc(100vw - 8px);
        max-width: calc(100vw - 8px);
        height: calc(100vh - 8px);
        height: calc(-webkit-fill-available - 8px);
        max-height: calc(100vh - 8px);
        max-height: calc(-webkit-fill-available - 8px);
        border-radius: 8px;
        margin: 0;
        border: 1px solid rgba(139, 92, 246, 0.15);
    }

    .chat-widget.embedded {
        border-radius: 6px;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100vh;
        max-height: -webkit-fill-available;
        border: none;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .agent-name {
        font-size: 15px;
    }

    .agent-status {
        font-size: 10px;
    }

    .avatar {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .action-chip {
        padding: 6px 8px;
        font-size: 9px;
        min-width: auto;
    }

    .message-content {
        padding: 8px 12px;
        font-size: 11px;
        line-height: 1.4;
    }

    .chat-input {
        padding: 10px 12px;
    }

    .input-container {
        padding: 6px 10px;
        min-height: 36px;
    }

    .message-input {
        font-size: 12px;
    }

    .send-button {
        width: 32px;
        height: 32px;
    }

    .send-button svg {
        width: 14px;
        height: 14px;
    }
}

/* Tablets - Portrait */
@media (min-width: 481px) and (max-width: 768px) and (orientation: portrait) {
    .chat-widget {
        width: 90vw;
        max-width: 90vw;
        height: 85vh;
        max-height: 85vh;
        border-radius: 12px;
    }

    .chat-widget.embedded {
        width: 95vw;
        max-width: 95vw;
        height: 90vh;
        max-height: 90vh;
    }
}

/* Tablets - Landscape */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    body {
        padding: 15px;
    }

    .chat-widget {
        width: 65vw;
        max-width: 750px;
        height: 80vh;
        max-height: 650px;
    }

    .chat-widget.embedded {
        width: 70vw;
        max-width: 800px;
        height: 85vh;
        max-height: 700px;
    }
}

/* Desktop pequeno */
@media (min-width: 1025px) and (max-width: 1366px) {
    body {
        padding: 10px 20px;
    }

    .chat-widget {
        width: 55vw;
        max-width: 700px;
        height: 92vh;
        max-height: 92vh;
    }
}

/* Desktop grande */
@media (min-width: 1367px) {
    body {
        padding: 10px 30px;
    }

    .chat-widget {
        width: 50vw;
        max-width: 800px;
        height: 90vh;
        max-height: 90vh;
    }

    .chat-widget.expanded {
        width: 60vw;
        max-width: 900px;
        height: 92vh;
        max-height: 92vh;
    }
}

/* Orientação específica para mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .chat-widget {
        height: 95vh;
        max-height: 95vh;
    }

    .chat-messages {
        padding: 8px 16px;
    }

    .quick-actions {
        padding: 8px 16px;
    }

    .chat-input {
        padding: 8px 16px;
    }
}

/* Dark mode support - Melhor contraste */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    .chat-widget {
        background: #1e1e2e;
        border-color: rgba(139, 92, 246, 0.3);
    }

    .chat-messages {
        background: #1a1a2a;
    }

    .bot-message {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        color: #f9fafb;
        border-color: rgba(139, 92, 246, 0.5);
    }

    .bot-message strong {
        color: #ddd6fe;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }

    .slogan-banner {
        background: #1e1e2e;
        border-color: rgba(139, 92, 246, 0.3);
    }

    .slogan-text {
        color: #c4b5fd;
        background: linear-gradient(135deg, #c4b5fd, #a78bfa, #8b5cf6);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .quick-actions {
        background: #1e1e2e;
        border-color: rgba(139, 92, 246, 0.3);
    }

    .action-chip {
        background: linear-gradient(135deg, #2a2a3e 0%, #1e1e2e 100%);
        color: #c4b5fd;
        border-color: rgba(139, 92, 246, 0.4);
    }

    .action-chip:hover, .action-chip:active {
        background: linear-gradient(135deg, #6610f2 0%, #8b5cf6 100%);
        color: white;
    }

    .input-container {
        background: #2a2a3e;
        border-color: rgba(139, 92, 246, 0.4);
    }

    .input-container:focus-within {
        background: #1e1e2e;
        border-color: #8b5cf6;
    }

    .message-input {
        color: #f0f0f0;
    }

    .message-input::placeholder {
        color: #9ca3af;
    }

    .typing-content {
        color: #c4b5fd;
    }

    .typing-dot {
        background: #c4b5fd;
    }
}

/* Tema escuro manual */
.chat-widget.dark-theme {
    background: #1e1e2e;
    border-color: rgba(139, 92, 246, 0.3);
}

.chat-widget.dark-theme .chat-messages {
    background: #1a1a2a;
}

.chat-widget.dark-theme .bot-message {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    color: #f9fafb;
    border-color: rgba(139, 92, 246, 0.5);
}

.chat-widget.dark-theme .bot-message strong {
    color: #ddd6fe;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.chat-widget.dark-theme .slogan-banner {
    background: #1e1e2e;
    border-color: rgba(139, 92, 246, 0.3);
}

.chat-widget.dark-theme .slogan-text {
    color: #c4b5fd;
    background: linear-gradient(135deg, #c4b5fd, #a78bfa, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-widget.dark-theme .input-container {
    background: #2a2a3e;
    border-color: rgba(139, 92, 246, 0.4);
}

.chat-widget.dark-theme .input-container:focus-within {
    background: #1e1e2e;
    border-color: #8b5cf6;
}

.chat-widget.dark-theme .message-input {
    color: #f0f0f0;
}

.chat-widget.dark-theme .typing-content {
    color: #c4b5fd;
}

.chat-widget.dark-theme .typing-dot {
    background: #c4b5fd;
}

/* Melhorias adicionais para modo escuro */
.chat-widget.dark-theme .chat-input {
    background: #1e1e2e;
    border-color: rgba(139, 92, 246, 0.3);
}

.chat-widget.dark-theme .send-button {
    background: linear-gradient(135deg, #6610f2 0%, #8b5cf6 100%);
    color: white;
    border: none;
}

.chat-widget.dark-theme .send-button:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    transform: translateY(-1px);
}

.chat-widget.dark-theme .voice-button {
    color: #c4b5fd;
}

.chat-widget.dark-theme .voice-button:hover {
    background: rgba(196, 181, 253, 0.1);
    color: #ddd6fe;
}

.chat-widget.dark-theme .input-icon {
    color: #9ca3af;
}

.chat-widget.dark-theme .typing-indicator {
    background: #1a1a2a;
    border-color: rgba(139, 92, 246, 0.3);
}

/* Animação suave para transição de tema */
.chat-widget {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.chat-widget .chat-messages {
    transition: background-color 0.3s ease;
}

.chat-widget .bot-message {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.chat-widget .input-container {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.chat-widget .message-input {
    transition: color 0.3s ease;
}

/* Acessibilidade - foco melhorado */
.theme-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.chat-widget.dark-theme .theme-toggle:focus {
    outline-color: rgba(196, 181, 253, 0.8);
}

/* --- Correção de layout para o container do chat n8n --- */
#n8n-chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: 95vw;
  height: 540px;
  max-height: 90vh;
  z-index: 9999;
  background: transparent;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Garante que o chat ocupe todo o container e não afete outros elementos */
#n8n-chat-container > * {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

/* Evita que o chat afete o slogan ou outros elementos do layout */
body {
  /* Garante que o body não expanda por causa do chat */
  overflow-x: hidden;
}

/* --- Correção responsiva para o n8n-chat-container fixo --- */
#n8n-chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: 95vw;
  height: 540px;
  max-height: 90vh;
  z-index: 9999;
  background: transparent;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 900px) {
  #n8n-chat-container {
    width: 98vw;
    max-width: 98vw;
    height: 60vh;
    max-height: 80vh;
    right: 1vw;
    bottom: 1vw;
    border-radius: 10px;
  }
}

@media (max-width: 600px) {
  #n8n-chat-container {
    width: 100vw;
    max-width: 100vw;
    height: 98vh;
    max-height: 98vh;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 0;
  }
}

/* --- FIX: Garantir fundo sólido e impedir vazamento de texto no chat --- */
.chat-widget,
.chat-widget .chat-messages {
    background: #fff !important;
    z-index: 10;
}

body.theme-dark .chat-widget,
body.theme-dark .chat-widget .chat-messages {
    background: #1e1e2e !important;
}

body.theme-dark .chat-messages {
    background: #1a1a2a !important;
}

.chat-widget {
    box-shadow: 0 25px 80px rgba(102, 16, 242, 0.15), 0 0 0 9999px rgba(30,30,46,0.7);
    position: relative;
}

.chat-messages {
    position: relative;
    z-index: 20;
    background-clip: padding-box;
}

.message {
    z-index: 30;
}

/* Corrige possíveis saltos de layout ao adicionar mensagens */
.chat-messages {
    min-height: 0;
    flex: 1 1 0%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Garante que nada do body vaze atrás do chat */
body {
    overflow: hidden;
}

/* --- FIX FINAL: Isolamento visual absoluto do chat --- */
body {
    background: #1a1a2e !important;
    overflow: hidden !important;
}

.chat-widget {
    background: #fff !important;
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    margin: auto;
    z-index: 9999 !important;
    box-shadow: 0 25px 80px rgba(102, 16, 242, 0.15), 0 0 0 9999px rgba(30,30,46,0.7);
    border-radius: 16px;
    max-width: min(60vw, 800px);
    max-height: min(95vh, 850px);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.theme-dark .chat-widget {
    background: #1e1e2e !important;
}

.chat-messages {
    background: #fff !important;
    position: relative;
    z-index: 10;
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.theme-dark .chat-messages {
    background: #1a1a2a !important;
}

.message {
    z-index: 20;
}

/* Dispositivos muito pequenos - melhor garantia do botão de envio */
@media (max-width: 375px) {
    body {
        padding: 2px;
    }
    
    .chat-widget {
        width: calc(100vw - 4px);
        max-width: calc(100vw - 4px);
        height: calc(100vh - 4px);
        height: calc(-webkit-fill-available - 4px);
        border-radius: 6px;
    }
    
    .chat-input {
        padding: 12px 8px;
        gap: 8px;
        flex-wrap: nowrap;
        align-items: center;
    }
    
    .input-container {
        flex: 1;
        min-width: 0;
        padding: 8px 12px;
        min-height: 40px;
    }
    
    .send-button {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        margin-left: 8px;
    }
    
    .message-input {
        font-size: 14px;
        min-height: 20px;
    }
}