/* ── Base ────────────────────────────────────────────────────────────────── */
:root {
    --ov-ai-primary: #111827;
    --ov-ai-primary-text: #ffffff;
}

.ov-ai-assistant {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    font-family: inherit;
}

/* ── Botón flotante ──────────────────────────────────────────────────────── */
.ov-ai-toggle {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 999px;
    background: var(--ov-ai-primary);
    color: var(--ov-ai-primary-text);
    box-shadow: 0 18px 45px rgba(0,0,0,.22);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0;
    transition: transform .25s ease, box-shadow .25s ease;
}

.ov-ai-toggle:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 24px 55px rgba(0,0,0,.28);
}

.ov-ai-toggle-icon { font-size: 19px; line-height: 1; }
.ov-ai-toggle-text { font-size: 13px; font-weight: 800; line-height: 1; }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.ov-ai-panel {
    position: absolute;
    right: 0;
    bottom: 82px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border: 1px solid rgba(17,24,39,.08);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(15,23,42,.26);
    overflow: hidden;
    display: none;
}

.ov-ai-assistant.ov-ai-open .ov-ai-panel {
    display: flex;
    flex-direction: column;
    animation: ovAiIn .22s ease both;
}

@keyframes ovAiIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.ov-ai-header {
    background: var(--ov-ai-primary);
    color: var(--ov-ai-primary-text);
    padding: 18px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ov-ai-header strong { display: block; font-size: 16px; line-height: 1.1; }
.ov-ai-header span   { display: block; opacity: .78; font-size: 12px; margin-top: 4px; }

.ov-ai-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.ov-ai-clear {
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: var(--ov-ai-primary-text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 0 12px;
    cursor: pointer;
}

.ov-ai-clear:hover,
.ov-ai-close:hover { background: rgba(255,255,255,.22); }

.ov-ai-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: var(--ov-ai-primary-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Mensajes ────────────────────────────────────────────────────────────── */
.ov-ai-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: #f8fafc;
}

.ov-ai-message {
    width: fit-content;
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 12px;
}

.ov-ai-bot  { background: #ffffff; color: #1f2937; border: 1px solid #e5e7eb; border-bottom-left-radius: 6px; }
.ov-ai-user { margin-left: auto; background: var(--ov-ai-primary); color: var(--ov-ai-primary-text); border-bottom-right-radius: 6px; }

/* ── Resultados ──────────────────────────────────────────────────────────── */
.ov-ai-results { display: grid; gap: 10px; margin-top: 10px; }

.ov-ai-result {
    display: block;
    padding: 0;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #111827;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    overflow: hidden;
}

.ov-ai-result:hover {
    transform: translateY(-2px);
    border-color: var(--ov-ai-primary);
    box-shadow: 0 10px 26px rgba(15,23,42,.08);
    color: #111827;
}

.ov-ai-result-thumb { display: block; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #e5e7eb; }
.ov-ai-result-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }

.ov-ai-result-content { display: block; padding: 12px 13px 13px; }

.ov-ai-result-title   { display: block; font-weight: 800; font-size: 14px; line-height: 1.25; margin-bottom: 6px; }
.ov-ai-result-excerpt { display: block; color: #6b7280; font-size: 12px; line-height: 1.38; }

.ov-ai-result-link {
    display: inline-flex;
    align-items: center;
    margin-top: 9px;
    color: var(--ov-ai-primary);
    font-size: 12px;
    font-weight: 800;
}

.ov-ai-result-price {
    display: block;
    margin-top: 8px;
    margin-bottom: 2px;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.3;
    color: #111827;
}

.ov-ai-result-price ins {
    text-decoration: none;
    color: var(--ov-ai-primary);
}

.ov-ai-result-price del {
    opacity: .55;
    font-size: 12px;
    font-weight: 400;
    margin-right: 4px;
}

/* ── Formulario ──────────────────────────────────────────────────────────── */
.ov-ai-form {
    padding: 14px;
    display: flex;
    gap: 10px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.ov-ai-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d1d5db !important;
    border-radius: 999px !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    outline: none !important;
    background: #fff !important;
    color: #111827 !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.ov-ai-input:focus { border-color: var(--ov-ai-primary) !important; }

.ov-ai-form button {
    border: 0;
    border-radius: 999px;
    background: var(--ov-ai-primary);
    color: var(--ov-ai-primary-text);
    font-weight: 700;
    padding: 0 16px;
    cursor: pointer;
    white-space: nowrap;
}

.ov-ai-form button:disabled { opacity: .6; cursor: not-allowed; }

/* ── Sugerencias rápidas ─────────────────────────────────────────────────── */
.ov-ai-suggestions {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    overflow-x: auto;
    scrollbar-width: none;
}

.ov-ai-suggestions:empty { display: none; }
.ov-ai-suggestions::-webkit-scrollbar { display: none; }

.ov-ai-suggestion {
    flex: 0 0 auto;
    border: 1px solid #e5e7eb !important;
    background: #f8fafc !important;
    color: #374151 !important;
    border-radius: 999px !important;
    padding: 7px 10px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer;
    box-shadow: none !important;
}

.ov-ai-suggestion:hover {
    background: var(--ov-ai-primary) !important;
    border-color: var(--ov-ai-primary) !important;
    color: var(--ov-ai-primary-text) !important;
}

/* ── Meta, badges, related ───────────────────────────────────────────────── */
.ov-ai-result-meta {
    display: inline-flex;
    max-width: 100%;
    margin-bottom: 7px;
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.ov-ai-result-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }

.ov-ai-result-badges span {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    padding: 4px 7px;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
}

.ov-ai-related { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.ov-ai-related-title { display: block; color: #374151; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.ov-ai-related .ov-ai-results { gap: 8px; }
.ov-ai-related .ov-ai-result { border-radius: 14px; }
.ov-ai-related .ov-ai-result-thumb { display: none; }

/* ── Autocomplete ────────────────────────────────────────────────────────── */
.ov-ai-autocomplete { display: none; padding: 10px 14px 0; background: #ffffff; border-top: 1px solid #eef2f7; gap: 7px; flex-wrap: wrap; }
.ov-ai-autocomplete.ov-ai-autocomplete-show { display: flex; }

.ov-ai-autocomplete-item {
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f8fafc;
    color: #111827;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 8px 10px;
    cursor: pointer;
}

.ov-ai-autocomplete-item:hover {
    border-color: var(--ov-ai-primary);
    background: var(--ov-ai-primary);
    color: var(--ov-ai-primary-text);
}

/* ── Thinking ────────────────────────────────────────────────────────────── */
.ov-ai-thinking { display: inline-flex; align-items: center; gap: 6px; color: #374151; font-size: 13px; font-weight: 700; }

.ov-ai-thinking i {
    width: 5px;
    height: 5px;
    display: inline-block;
    border-radius: 999px;
    background: #9ca3af;
    animation: ovAiThinking 1s infinite ease-in-out;
}

.ov-ai-thinking i:nth-child(2) { animation-delay: .12s; }
.ov-ai-thinking i:nth-child(3) { animation-delay: .24s; }

@keyframes ovAiThinking {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ov-ai-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 90px;
        width: auto;
        height: 70vh;
        max-width: none;
    }
}
