/* ═══════════════════════════════════════════════════════════════
   LytikBot — Asistente interactivo DentalLytiks
   ═══════════════════════════════════════════════════════════════ */

/* Boton flotante: estilos gestionados por ly-droplets.css (clase .droplet .droplet-lbot) */

/* ── Panel del chat ─────────────────────────────────────────── */
.lbot-panel {
    position: fixed;
    bottom: 90px;
    left: 24px;
    z-index: 9989;
    width: 380px;
    max-height: 520px;
    background: var(--color-card, #1a2332);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-body, system-ui);
}
.lbot-panel.visible {
    display: flex;
}

/* Header */
.lbot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.lbot-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-accent, #3D8C7A), var(--color-accent-dark, #2E6B5E));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.lbot-header-avatar svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}
.lbot-header-info { flex: 1; min-width: 0; }
.lbot-header-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #e2e8f0);
}
.lbot-header-status {
    font-size: 11px;
    color: var(--color-text-muted, rgba(255,255,255,.5));
    display: flex;
    align-items: center;
    gap: 5px;
}
.lbot-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}
.lbot-header-actions { display: flex; gap: 4px; }
.lbot-header-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--color-text-muted, rgba(255,255,255,.5));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.lbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text, #e2e8f0);
}
.lbot-header-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Messages area */
.lbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 340px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}
.lbot-messages::-webkit-scrollbar { width: 4px; }
.lbot-messages::-webkit-scrollbar-track { background: transparent; }
.lbot-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* Message bubbles */
.lbot-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text, #e2e8f0);
    word-wrap: break-word;
}
.lbot-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border-bottom-left-radius: 4px;
}
.lbot-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--color-accent, #3D8C7A), var(--color-accent-dark, #2E6B5E));
    color: #fff;
    border-bottom-right-radius: 4px;
}
.lbot-msg.bot p { margin: 0 0 6px; }
.lbot-msg.bot p:last-child { margin-bottom: 0; }
.lbot-msg.bot strong { color: var(--color-accent, #7DDCBA); }
.lbot-msg.bot code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-m, monospace);
}
.lbot-msg.bot pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 11px;
    margin: 6px 0;
}
.lbot-msg.bot pre code { background: none; padding: 0; }

/* Typing indicator */
.lbot-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}
.lbot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted, rgba(255,255,255,.4));
    animation: lbot-typing-bounce 1.4s ease-in-out infinite;
}
.lbot-typing span:nth-child(2) { animation-delay: 0.16s; }
.lbot-typing span:nth-child(3) { animation-delay: 0.32s; }

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

/* Navigation card */
.lbot-nav-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(61, 140, 122, 0.1);
    border: 1px solid rgba(61, 140, 122, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 6px;
    text-decoration: none;
    color: inherit;
}
.lbot-nav-card:hover {
    background: rgba(61, 140, 122, 0.2);
    border-color: rgba(61, 140, 122, 0.4);
}
.lbot-nav-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-accent, #3D8C7A), var(--color-accent-dark, #2E6B5E));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.lbot-nav-card-icon svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2; fill: none; }
.lbot-nav-card-name { font-weight: 600; font-size: 13px; }
.lbot-nav-card-desc { font-size: 11px; color: var(--color-text-muted, rgba(255,255,255,.5)); }
.lbot-nav-card-go {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-accent, #7DDCBA);
    font-weight: 600;
}

/* Alert cards */
.lbot-alert-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
    text-decoration: none;
    color: inherit;
    font-size: 12px;
}
.lbot-alert-card:hover { background: rgba(239, 68, 68, 0.15); }
.lbot-alert-card.urgencia-media { border-color: rgba(245, 158, 11, 0.2); background: rgba(245, 158, 11, 0.08); }
.lbot-alert-card svg { width: 16px; height: 16px; stroke: #ef4444; stroke-width: 2; fill: none; flex-shrink: 0; }
.lbot-alert-card.urgencia-media svg { stroke: #f59e0b; }

/* Search results */
.lbot-search-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
    text-decoration: none;
    color: inherit;
}
.lbot-search-item:hover { background: rgba(255, 255, 255, 0.08); }
.lbot-search-item svg { width: 16px; height: 16px; stroke: var(--color-accent, #7DDCBA); stroke-width: 2; fill: none; flex-shrink: 0; }
.lbot-search-item-name { font-size: 13px; font-weight: 500; }
.lbot-search-item-detail { font-size: 11px; color: var(--color-text-muted, rgba(255,255,255,.5)); margin-left: auto; }

/* Tour steps */
.lbot-tour-step {
    padding: 10px 14px;
    background: rgba(61, 140, 122, 0.06);
    border-left: 3px solid var(--color-accent, #3D8C7A);
    border-radius: 0 8px 8px 0;
    margin-top: 6px;
}
.lbot-tour-step-num {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-accent, #7DDCBA);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.lbot-tour-step-title { font-size: 13px; font-weight: 600; margin: 2px 0 4px; }
.lbot-tour-step-text { font-size: 12px; line-height: 1.5; color: var(--color-text-muted, rgba(255,255,255,.7)); }
.lbot-tour-nav {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.lbot-tour-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--color-text, #e2e8f0);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.lbot-tour-btn:hover { background: rgba(255, 255, 255, 0.08); }
.lbot-tour-btn.primary {
    background: var(--color-accent, #3D8C7A);
    border-color: transparent;
    color: #fff;
}
.lbot-tour-btn.primary:hover { opacity: 0.9; }

/* ── Material cards (stock inline) ──────────────────────────── */
.lbot-material-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    margin-top: 4px;
    transition: background 0.15s, border-color 0.15s;
}
.lbot-material-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}
.lbot-material-card.mat-bajo-min {
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.04);
}
.lbot-material-card.mat-sin-stock {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.04);
}
.lbot-mat-info { flex: 1; min-width: 0; }
.lbot-mat-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text, #e2e8f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lbot-mat-meta {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}
.lbot-mat-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(61, 140, 122, 0.15);
    color: var(--color-accent, #7DDCBA);
}
.lbot-mat-ref {
    font-size: 10px;
    color: var(--color-text-muted, rgba(255,255,255,.4));
    font-family: var(--font-m, monospace);
}
.lbot-mat-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    flex-shrink: 0;
}
.lbot-mat-stock-num {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-m, monospace);
}
.lbot-mat-stock-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, rgba(255,255,255,.4));
}
.lbot-mat-stock-min {
    font-size: 9px;
    color: var(--color-text-muted, rgba(255,255,255,.3));
}
.lbot-mat-actions { flex-shrink: 0; }
.lbot-mat-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
    color: var(--color-text, #e2e8f0);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.lbot-mat-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}
.lbot-mat-action-btn.salida {
    background: rgba(61, 140, 122, 0.2);
    border-color: rgba(61, 140, 122, 0.3);
    color: var(--color-accent, #7DDCBA);
}
.lbot-mat-action-btn.salida:hover {
    background: rgba(61, 140, 122, 0.3);
}
.lbot-mat-action-btn svg,
.lbot-mat-action-btn i {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ── Action proposal cards ──────────────────────────────────── */
.lbot-action-card {
    background: rgba(61, 140, 122, 0.08);
    border: 1px solid rgba(61, 140, 122, 0.2);
    border-radius: 12px;
    padding: 12px;
    margin-top: 6px;
    transition: opacity 0.3s;
}
.lbot-action-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-accent, #7DDCBA);
    margin-bottom: 10px;
}
.lbot-action-header svg,
.lbot-action-header i {
    width: 16px;
    height: 16px;
    stroke: var(--color-accent, #7DDCBA);
    stroke-width: 2;
    fill: none;
}
.lbot-action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}
.lbot-action-btn {
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s, transform 0.1s;
}
.lbot-action-btn:active { transform: scale(0.96); }
.lbot-action-btn svg,
.lbot-action-btn i {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}
.lbot-action-btn.confirm {
    background: var(--color-accent, #3D8C7A);
    color: #fff;
}
.lbot-action-btn.confirm:hover { background: #2E6B5E; }
.lbot-action-btn.cancel {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-muted, rgba(255,255,255,.6));
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.lbot-action-btn.cancel:hover { background: rgba(255, 255, 255, 0.1); }
.lbot-action-warning {
    font-size: 11px;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Chips area ─────────────────────────────────────────────── */
.lbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.lbot-chip {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text, #e2e8f0);
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.lbot-chip:hover {
    background: rgba(61, 140, 122, 0.15);
    border-color: rgba(61, 140, 122, 0.3);
    color: var(--color-accent, #7DDCBA);
}

/* ── Input area ─────────────────────────────────────────────── */
.lbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.1);
}
.lbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 9px 14px;
    color: var(--color-text, #e2e8f0);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.lbot-input::placeholder { color: rgba(255, 255, 255, 0.3); }
.lbot-input:focus { border-color: var(--color-accent, #3D8C7A); }
.lbot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--color-accent, #3D8C7A), var(--color-accent-dark, #2E6B5E));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
}
.lbot-send-btn:hover { transform: scale(1.05); }
.lbot-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.lbot-send-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .lbot-panel {
        left: 8px;
        right: 8px;
        bottom: 80px;
        width: auto;
        max-height: 70vh;
    }
    .lbot-fab {
        left: 16px;
        bottom: 16px;
        width: 48px;
        height: 48px;
    }
}
