/* =========================================================================
   css/agente-ia.css — Estilos del Sistema Multi-Agente IA PH Neutro
   (Agente Administrador + Agente de Caja / Tienda)
   ========================================================================= */

#phn-ai-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 28px rgba(11, 28, 61, 0.35), 0 0 0 2px rgba(255, 255, 255, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#phn-ai-fab.role-admin {
    background: linear-gradient(135deg, #0B1C3D 0%, #1E40AF 55%, #0891B2 100%);
}

#phn-ai-fab.role-caja {
    background: linear-gradient(135deg, #065F46 0%, #0D9488 60%, #0284C7 100%);
}

#phn-ai-fab:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 16px 34px rgba(11, 28, 61, 0.45), 0 0 0 3px rgba(56, 189, 248, 0.4);
}

#phn-ai-fab .ai-badge {
    background: #EF4444;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    animation: phnPulse 1.8s infinite;
}

@keyframes phnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* Panel Lateral del Agente */
#phn-ai-drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 450px;
    max-width: 100vw;
    height: 100vh;
    background: #F8FAFC;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.25);
    transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 1px solid #E2E8F0;
    font-family: inherit;
}

#phn-ai-drawer.open {
    right: 0;
}

.phn-ai-header {
    padding: 16px 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.phn-ai-header.role-admin {
    background: linear-gradient(135deg, #0B1C3D 0%, #1E3A8A 65%, #0891B2 100%);
}

.phn-ai-header.role-caja {
    background: linear-gradient(135deg, #064E3B 0%, #0F766E 65%, #0284C7 100%);
}

.phn-ai-title-wrap {
    display: flex;
    align-items: center;
    gap: 11px;
}

.phn-ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.phn-ai-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    color: #ffffff !important;
}

.phn-ai-subtitle {
    font-size: 0.74rem;
    opacity: 0.88;
    margin: 2px 0 0 0;
    color: #E0F2FE !important;
}

.phn-ai-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 700;
}

.phn-ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Pestañas del Panel */
.phn-ai-tabs {
    display: flex;
    background: #ffffff;
    border-bottom: 1px solid #E2E8F0;
    padding: 0 8px;
}

.phn-ai-tab {
    flex: 1;
    padding: 11px 6px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748B;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.phn-ai-tab.active {
    color: #1E40AF;
    border-bottom-color: #0891B2;
}

/* Acciones Rápidas (Chips) */
.phn-ai-quick-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 9px 12px;
    background: #F1F5F9;
    border-bottom: 1px solid #E2E8F0;
    scrollbar-width: thin;
}

.phn-ai-chip {
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid #CBD5E1;
    color: #1E293B;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.phn-ai-chip:hover {
    background: #EFF6FF;
    border-color: #3B82F6;
    color: #1D4ED8;
}

/* Cuerpo de Mensajes y Vistas */
.phn-ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.phn-msg {
    max-width: 90%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.48;
    word-wrap: break-word;
}

.phn-msg.user {
    align-self: flex-end;
    background: #1E40AF;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.phn-msg.bot {
    align-self: flex-start;
    background: #ffffff;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

/* Tarjeta de Confirmación Previa */
.phn-confirm-card {
    background: #FFFBEB;
    border: 1.5px solid #F59E0B;
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 6px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

.phn-confirm-title {
    font-weight: 800;
    font-size: 0.86rem;
    color: #92400E;
    margin-bottom: 8px;
}

.phn-confirm-list {
    margin: 0 0 10px 0;
    padding-left: 18px;
    font-size: 0.8rem;
    color: #78350F;
}

.phn-confirm-actions {
    display: flex;
    gap: 8px;
}

.phn-btn-confirm {
    flex: 1;
    background: #059669;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

.phn-btn-confirm:hover {
    background: #047857;
}

.phn-btn-cancel {
    background: #FEE2E2;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

/* Barra de Entrada con Micrófono */
.phn-ai-footer {
    padding: 11px 12px;
    background: #ffffff;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.phn-ai-input {
    flex: 1;
    padding: 10px 13px;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    font-size: 0.88rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    color: #0F172A !important;
    background: #ffffff !important;
    outline: none;
    resize: none;
    min-height: 44px !important;
    max-height: 90px;
    line-height: 1.4;
}

.phn-ai-input:focus {
    border-color: #0891B2;
}

.phn-ai-mic-btn,
.phn-ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.phn-ai-mic-btn {
    background: #F1F5F9;
    color: #334155;
    border: 1px solid #CBD5E1;
}

.phn-ai-mic-btn.recording {
    background: #EF4444;
    color: #ffffff;
    border-color: #DC2626;
    animation: phnPulse 1s infinite;
}

.phn-ai-send-btn {
    background: #0891B2;
    color: #ffffff;
}

.phn-ai-send-btn:hover {
    background: #0E7490;
}

/* Tarjetas de Solicitudes Tienda <-> Central */
.phn-sol-card {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
}

.phn-sol-card.pendiente {
    border-left: 4px solid #F59E0B;
}

.phn-sol-card.aprobada,
.phn-sol-card.aprobada_auto_agente {
    border-left: 4px solid #10B981;
}

.phn-sol-card.rechazada {
    border-left: 4px solid #EF4444;
}
