/* css/copilot.css - Estilos para Logar-AI Copilot Asistente */

/* 1. Botón Flotante Launcher */
#copilot-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #007bff 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

#copilot-launcher:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 123, 255, 0.5);
}

#copilot-launcher .copilot-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background-color: #28a745;
}

#copilot-launcher.disabled .copilot-badge {
    background-color: #6c757d;
}

/* 2. Ventana Flotante del Chat */
#copilot-window {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 440px;
    height: 600px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid #e1e8ed;
    animation: copilotFadeIn 0.25s ease-out forwards;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@keyframes copilotFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Encabezado */
.copilot-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.copilot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.copilot-title-group h4 {
    margin: 0;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.copilot-title-group span {
    font-size: 0.75rem;
    color: #b0c4de;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copilot-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    display: inline-block;
}

.copilot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copilot-btn-icon {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
}

.copilot-btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Área de Mensajes */
.copilot-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: #f8fafc;
}

/* Mensajes */
.copilot-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
}

.copilot-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.copilot-msg-ai {
    align-self: flex-start;
}

.copilot-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.copilot-msg-ai .copilot-msg-avatar {
    background-color: #e2e8f0;
    color: #1e3c72;
}

.copilot-msg-user .copilot-msg-avatar {
    background-color: #007bff;
    color: #ffffff;
}

.copilot-bubble {
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.copilot-msg-user .copilot-bubble {
    background-color: #007bff;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.copilot-msg-ai .copilot-bubble {
    background-color: #ffffff;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.copilot-bubble p {
    margin: 0 0 8px 0;
}

.copilot-bubble p:last-child {
    margin-bottom: 0;
}

.copilot-bubble ul {
    margin: 6px 0 6px 18px;
    padding: 0;
}

.copilot-bubble li {
    margin-bottom: 4px;
}

.copilot-bubble strong {
    color: #1a202c;
    font-weight: 600;
}

.copilot-msg-user .copilot-bubble strong {
    color: #ffffff;
}

/* Sugerencias Rápidas (Pills) */
.copilot-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.copilot-prompt-pill {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.copilot-prompt-pill:hover {
    background-color: #f1f5f9;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
}

/* Indicador de Escritura */
.copilot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background-color: #ffffff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    width: fit-content;
}

.copilot-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #94a3b8;
    animation: copilotTypingBounce 1.4s infinite ease-in-out both;
}

.copilot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.copilot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes copilotTypingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input y Controles Inferiores */
.copilot-footer {
    padding: 12px 14px;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.copilot-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 22px;
    padding: 9px 16px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.copilot-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.copilot-btn-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.copilot-btn-send {
    background-color: #007bff;
    color: #ffffff;
}

.copilot-btn-send:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.copilot-btn-mic {
    background-color: #f1f5f9;
    color: #475569;
}

.copilot-btn-mic:hover {
    background-color: #e2e8f0;
    color: #007bff;
}

.copilot-btn-mic.listening {
    background-color: #dc3545;
    color: #ffffff;
    animation: micPulse 1s infinite alternate;
}

/* Banner de derivación al Portal IA dedicado */
.copilot-portal-banner {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    justify-content: flex-end;
}

.copilot-portal-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
    transition: all 0.2s ease;
}

.copilot-portal-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.4);
}

@keyframes micPulse {
    from { transform: scale(1); box-shadow: 0 0 0 rgba(220, 53, 69, 0.4); }
    to { transform: scale(1.1); box-shadow: 0 0 10px rgba(220, 53, 69, 0.8); }
}

/* Adaptación para pantallas móviles */
@media (max-width: 600px) {
    #copilot-window {
        right: 8px;
        left: 8px;
        bottom: 75px;
        width: auto;
        max-width: none;
        height: calc(100vh - 90px);
        max-height: calc(100vh - 90px);
        border-radius: 12px;
    }
    #copilot-launcher {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}
