/**
 * widget.css — VendaViva iV8
 * Estilo premium isolado - Full Height & Area Ampliada
 */

:root {
    --vv-bg-container: #0b1121;
    --vv-border: #1e293b;
    --vv-text-main: #f8fafc;
    --vv-text-muted: #94a3b8;
    
    --vv-accent: #00F260;
    --vv-accent-hover: #05FF80;
    --vv-user-gradient: linear-gradient(135deg, #00F2FE, #00D2FF);
    --vv-ai-bubble: #1e293b;
    --vv-input-bg: #0f172a;
    
    --vv-radius: 0; /* Full height não usa bordas redondas no limite da tela */
    --vv-font: 'Public Sans', sans-serif;
}

#iv8-agent-root {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 10000;
    font-family: var(--vv-font);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none; /* Deixa clicar fora quando fechado */
}

/* Launcher Button */
.iv8-launcher {
    position: absolute;
    bottom: 24px;
    left: 24px;
    background-color: var(--vv-accent);
    color: #020617;
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 242, 96, 0.2);
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    pointer-events: all;
}

.iv8-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 242, 96, 0.4);
    background-color: var(--vv-accent-hover);
}

/* Main Window - Full Height Panel */
.iv8-window {
    width: 400px;
    height: 100vh;
    background-color: var(--vv-bg-container);
    border-right: 1px solid var(--vv-border);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(-100%);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.iv8-window.iv8-open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

/* Header */
.iv8-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background-color: var(--vv-bg-container);
    flex-shrink: 0;
}

.iv8-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.iv8-header-logo-img {
    height: 24px;
    object-fit: contain;
}

.iv8-header-text {
    display: flex;
    flex-direction: column;
}

.iv8-header-title {
    color: var(--vv-text-main);
    font-weight: 700;
    font-size: 16px;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

.iv8-header-status {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--vv-accent);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.iv8-status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--vv-accent);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--vv-accent);
}

.iv8-header-actions {
    display: flex;
    gap: 12px;
}

.iv8-action-btn {
    background: none;
    border: none;
    color: var(--vv-text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.iv8-action-btn:hover {
    color: var(--vv-text-main);
}

/* Content Area - 2/3 da tela */
.iv8-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

.iv8-content::-webkit-scrollbar { width: 4px; }
.iv8-content::-webkit-scrollbar-track { background: transparent; }
.iv8-content::-webkit-scrollbar-thumb { background-color: var(--vv-border); border-radius: 10px; }

/* Messages */
.iv8-message-wrapper {
    display: flex;
    gap: 12px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.iv8-user-wrapper { flex-direction: row-reverse; }
.iv8-ai-wrapper { flex-direction: row; }

/* Avatars */
.iv8-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.iv8-user-avatar {
    background-color: #1e293b;
    color: var(--vv-text-muted);
}

.iv8-ai-avatar {
    background-color: transparent;
}
.iv8-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Bubbles */
.iv8-bubble {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14.5px;
    line-height: 1.6;
    max-width: 80%;
    word-wrap: break-word;
}

.iv8-user-wrapper .iv8-bubble {
    background: var(--vv-user-gradient);
    color: #020617;
    font-weight: 500;
    border-top-right-radius: 4px;
}

.iv8-ai-wrapper .iv8-bubble {
    background-color: var(--vv-ai-bubble);
    color: var(--vv-text-main);
    border-top-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Input Area - Ocupa 1/3 da altura (aprox 33vh) */
.iv8-input-area {
    height: 33vh; /* Reserva exata de 1/3 do espaço */
    min-height: 200px;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: var(--vv-bg-container);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.iv8-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--vv-input-bg);
    border: 1px solid var(--vv-border);
    border-radius: 16px;
    padding: 12px;
    transition: border-color 0.3s;
    position: relative;
}

.iv8-input-wrapper:focus-within {
    border-color: var(--vv-text-muted);
}

.iv8-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--vv-text-main);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: none;
    padding-bottom: 40px; /* Espaço para o botão não sobrepor texto */
}

.iv8-input::-webkit-scrollbar { width: 4px; }
.iv8-input::-webkit-scrollbar-thumb { background-color: #475569; border-radius: 4px; }

.iv8-send-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: #00F260;
    border: none;
    color: #020617;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.iv8-send-btn:hover {
    transform: scale(1.05);
    background: var(--vv-accent-hover);
}

/* Footer Branding */
.iv8-footer-branding {
    text-align: center;
    padding-top: 16px;
    font-size: 10px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.iv8-footer-branding span {
    color: var(--vv-accent);
    font-weight: 700;
}

/* Animations */
.iv8-typing { display: flex; gap: 4px; padding: 4px 0; }
.iv8-typing-dot { width: 6px; height: 6px; background-color: var(--vv-text-muted); border-radius: 50%; animation: typing 1.4s infinite ease-in-out both; }
.iv8-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.iv8-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
.iv8-system-msg { text-align: center; font-size: 12px; color: var(--vv-text-muted); margin: 10px 0; font-style: italic; }

@media (max-width: 480px) {
    .iv8-window {
        width: 100vw;
    }
}
