/* Chat widget - estilos embebibles */
.kpl-chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    box-sizing: border-box;
}

.kpl-chat-widget * {
    box-sizing: border-box;
}

.kpl-chat-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 99998;
}

.kpl-chat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

.kpl-chat-btn svg {
    width: 28px;
    height: 28px;
}

.kpl-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
}

.kpl-chat-panel-hidden {
    display: none !important;
}

.kpl-chat-header {
    padding: 14px 16px;
    background: #2563eb;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.kpl-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.kpl-chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kpl-chat-msg.sent {
    align-self: flex-end;
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 4px;
}

.kpl-chat-msg.received {
    align-self: flex-start;
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.kpl-chat-msg .time {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 6px;
}

.kpl-chat-msg.sent .time {
    color: rgba(255, 255, 255, 0.9);
}

.kpl-chat-input-wrap {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.kpl-chat-input-row {
    display: flex;
    gap: 8px;
}

.kpl-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.kpl-chat-input:focus {
    border-color: #2563eb;
}

.kpl-chat-send {
    padding: 10px 16px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.kpl-chat-send:hover {
    background: #1d4ed8;
}

.kpl-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.kpl-chat-loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.kpl-chat-empty {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
}
